A new parallel bat algorithm for musical note recognition

Received Jan 18, 2020 Revised Jun 13, 2020 Accepted Aug 5, 2020 Music is a universal language that does not require an interpreter, where feelings and sensitivities are united, regardless of the different peoples and languages, The proposed system consists of two main stages: the process of extracting important properties using the linear discrimination analysis (LDA) This step is carried out after the initial treatment process using various procedures to remove musical lines, The second stage describes the recognition process using the bat algorithm, which is one of the metaheuristic algorithms after modifying the bat algorithm to obtain better discriminating results. The proposed system was supported by parallel implementation using the (developed bat algorithm DBA), which increased the speed of implementation significantly. The method was applied to 1250 different images of musical notes. The proposed system was implemented using MATLAB R2016a, Work was done on a Windows10 Processor OS (Intel ® Core TM i5-7200U CPU @ 2.50GHZ 2.70GHZ) computer.


INTRODUCTION
Music is a kind of world art that deals with the composition, rhythm and distribution of various melodies. Music is a science that explores melodies' origins and principles in terms of harmony and distinction a language that includes expressive and communicative components. It is an art composed over certain periods of time with sounds and silence [1]. As music is a general process known to those interested in the music industry, the computer had to be used to serve the music Several computer scientists have developed programs, systems and algorithms to recognize and discover various musical notes and applications for music [2].
The pattern distinction refers to the function of putting a particular object in the appropriate distinction based on that object's parameters, Usually done automatically with the aid of a computer after the object's properties have been extracted. The term pattern recognition includes several other important terms such as recognition, description, classification, and grouping of patterns. For example, a pattern may be a fingerprint image, a handwritten word, a human face, or a speech signal [3].
In the year (2011), the two researchers (Joyce Ooi Boon Ee and Alan WC Tan) use box bounding and template matching [4]. In (2014) the two researchers (Yoppy Sazaki and Rosda Ayuni) use the Minimum Spanning Tree algorithm and the Euclidean distance [5]. In (2017) the researchers (Jan Hajiˇc and Pavel Pecina) suggested to use convolutional neural network CNN for discover the head's notes applied to various patterns of handwriting styles [6]. In (2018) Ansam Nizar and Fawzia Mahmoud proposed a method for recognize musical notes using the algorithm (LDA linear discriminate analysis) and an equation of similarity scale index SSIM [7].

Int J Elec & Comp Eng
ISSN: 2088-8708  A new parallel bat algorithm for musical note recognition (Ansam Nazar Younis) 559 The goal of the research is to develop and create an intelligent computer system to recognize images of musical notes and to classify their form in order to help spread musical culture through different segments of society and to ensure simplicity, transparency, accuracy and speed in communicating with users at the same time. The research further aims to teach the computer and apply knowledge to it in the field of music education and to set up a supportive system for music experts to learn musical notes and provide a system for those wanting to learn the meaning of musical scale symbols.

COMMON NOTATION
The music is written in letters that are different from the alphabet, Music notes are a time-bound symbol, depending on the sound of that letter, the duration of each letter or musical symbol on the staff [1,8] note Figure 1.

The staff
Five horizontal lines, including four equal spaces, are parallel and equal in length. Some musical notes are positioned on or at a distance between lines. Additional short lines may be attached to the ledger lines to represent a very high or very low mark that is not in standard condition [8].

Musical notes
It is composed of seven simple musical signs of different sound and the eighth sound is a repetition of the first note: du-ri-mi-fa-la-si then du again. The name of the music note is determined by the key used at the beginning of the music scale, The note form is an oval head that can be complete and empty, and the head may be attached to the stem It may also be linked to one or more flags (flag) This depends on the number of strikes and the length of the note [2]. Many musical notes affect the musical tone in one way or another, and each type of these symbols is written differently from the other and put on the musical scale in different positions and these symbols are:(clef, Accidental symbols, Rests, Time symbols, Breaks, Dynamics symbols, Augmentation Dot, Ties, Articulation, Signs Repeat, Economical symbols, Key Signature, Triad) [9].

BAT ALGORITHM BA
The Bats algorithm is one of the metaheuristic algorithms created by the world (Yang) in 2010, an algorithm inspired by nature [10]. Based on the previous features, The following three basic rules were developed for the algorithm: Bats use distance sensing echolocation and "learn" the difference between food, prey and backbones, In position Xi, the bat flies at velocity (Vi) with the qmin frequency, with the variable wavelength λ and the loudness L0 to hunt for the prey. It can automatically adjust the wave length (or frequency) from its emitted pulse and adjust the pulse emission rate (0, 1) according to its proximity to the target. Although the loudness may differ from one to another in many respects, it is assumed that the loudness is usually limited and that L0 varies from a large fixed value to a minimum constant value of Lmin [11].
Bat Algorithm steps [12]: 1) Determine the target function so that it represents: where n is the maximum number of bats, then determines the initial velocity for each bat (Vi).
3) Define pulse frequency (qi ) at Xi location. 4) Configure pulse rates (ri)and loudness rate (Li). 5) Repeat the following steps until the condition is met (getting the maximum of the duplicates). The virtual bat movement is by simulating the virtual bat movement naturally. We have three basic rules where Xi and Vi are determined in d-dimensional and how to update it. The new solutions Xi t and velocities Vit at time t are given using the following equations [13]: β ϵ (0, 1) is a random vector taken from a regular distribution. X* represents the best current general location (solution) which is located after comparing all the solutions among all n bats. For the local search segment. Once a solution has been identified among the best current solutions, a new solution for each bat is created locally using random walking as in (4): Rϵ (-1, 1) is a random number, Lt=(Lit) is the mean of loudness of all Bat in this time step [13]. The Li loudness and the pulse emission rate must be updated with repetition, according to the following equations: α and γ are constant values. For each: 0<α<1 and γ>0.
The selection of parameters requires some experimentation. Initially, each bat must have different values for the loudness rate and the pulse emission rate. This can be achieved by random distribution [14].

FEATURE EXTRACTION
Feature extraction methods are used in the process of dimensional reduction of the original highdimensional data and are stronger than the methods of character selection [7,15]. The process of extracting attributes represents the process of creating a new set of features that are more important by mixing the original features in linear or nonlinear ways [16,17]. Linear discriminate analysis (LDA) is a commonly supervised modality (ie taking classification into account) And is commonly used in computer vision, pattern recognition, machine learning and the like, also known as Fisher's linear discriminator. To the British statistical world (Ronald Aylmer Fisher), who initially proposed the approach and is an effective method of discrimination, since it is a linear method of linear data reduction and a classification method [18]. LDA attempts to define a new axis to reduce inter-class variation due to session/channel effects and to maximize differences between classes [19]. The linear discrimination analysis algorithm aims at finding vectors that maximize the difference between the different classes (Between-Class Scatter Matrix CB), Reducing sample variability within each category Within-Class Scatter Matrix (CW) [18,19].

PARALLEL PROCESSING
Parallel processing means faster program execution by splitting the program into multiple parts and performing at the same time as each part runs on a separate processor or on a separate kernel. The program implemented in N processors is approximately N faster than the same program on a single processor [20]. Its characteristics can be summarized as follows [21]: -Uses more than one processing unit (CPUs).
-Divide the problem into separate parts can be solved synchronously.
-Divide each part into a series of prompts.
-The instructions from each part are carried out simultaneously on different processing units.
-All implementation is under control.

Multicore processors
This type of processors is also called the Chip Multiprocessor, combining two or more processors (called Cores) on one piece of silicon (called the mold). Each kernel consists of all components of an independent processor, such as Registers, ALU, Control Unit, As well as data storage (L1 data caches). In addition to multiple cores, contemporary multi-core chips also include L2 cache and L3 cache in some cases [22].

DESIGN THE PROPOSED SYSTEM
The proposed PBMRS (parallel bat musical notes recognition system) system was designed to build a smart computer program to recognize musical notes and to display useful information about each musical score. The proposed system goes through two phases: training and testing.

Design of the training phase
Building database of images: In this stage, read the 1000 musical notes images of the training phase of 100 different music labels. Preprocessing: Initial treatment includes the following steps: a. Resize each image and unify the size of all images b. converting images from color images (RGB) to gray colors (Gray) c. Converting images from Gray color to Binary images (black and white), in order to reduce the number of colors, it is easy to distinguish the color of the mark from the background color. d. Delete the white frame surrounding the musical mark and the background, thereby removing the important information to focus only on the shape of the mark. e. Resize the image after the process of deleting the frame. f.
Feature extraction: find the matrix of weights for a musical mark model as a result of the linear discrimination analysis algorithm (LDA). Recognition using the bat algorithm: a. Intelligent bat algorithm developed: The traditional bats algorithm was developed by adding several steps to improve the results and their suitability to the discriminating process. The proposed algorithm was called the developed bat algorithm DBA which is consists of the following steps (steps added in bold): 1) Define the target function represented by the musical input.
2) Parameters configuration: Given the initial values and constant values of the parameters for implementing the algorithm as follows: a) Determining the number of bats with the number of models of the musical notes. b) Sets the velocities (V i ) of the bats by defining a matrix that is equal in size musical notes. c) Determine the pulse frequency (Q i ) so that the frequency value is between Q min and Q max . 3) The weights matrix for the target function and for the current bat for each cycle are initialized as a new step supported by the algorithm and represent the weights derived from the linear discrimination analysis algorithm (LDA). 4) Find the fitness function for each matrix of bat weights for the weight matrix of the target function by using the correlation between the two matrices represented by the following formula [23]: W: represents the weight matrix of a bat whose size is m*n. B: represents the weight matrix of the target function whose size is also m*n, Create new solutions by adjusting frequency and updating speeds and positions by the following equations: As: Q i : The new frequency of the bat i. If the condition is met, it will continue, otherwise it will be referred to step 5. 9) Arrange bats and find the best X * current, by finding the largest current fitness function. 10) Find the best solution site, which represents the best bat site. 11) Display results. b. Parallel bats implementation algorithm: a parallel-developed bats algorithm with a single multi-core processor was suggested. Parallel programming model used for this purpose is SPMD model. Each core performs one program in the processor at one time on different datasets. This model is based on a type of parallel programming model, the master-slave Model. Parallel method used in this developed bat algorithm was the algorithm-level.

Design of the test phase
The test database was created from a collection of different musical tag images. Different models of the training models are created from each type of musical label, as well as the creation of models that include the musical lines and the creation of models that are strange to the music labels. In the folder (Testing) 500 (300+200) different image of 100 different types of musical labels, as well as 50 other strange images.

EVALUATION SYSTEM PERFORMANCE MEASURES
a. Detection rate DR: The ratio of the recognizing of music notes in the system is correct. b. True negative TN: The number of images of wrong musical notes, and recognized wrong. c. False positive rate FPR: The number of wrong musical notes images and recognized correct. d. True positive rate TPR: It represents the number of correct music notes, and is properly categorized. e. False negative FN: It represents the number of correct music notes, and is properly wrong categorized. f. Sensitivity: Measures the ability of the discriminating system to find images of wrong musical notes. g. Specificity: Measures the ability of the discriminating system to find images of correct musical notes. h. False rejection ratio FRR: The proportion of wrongly tagged music images (not found). i. Wrong acceptance ratio WRR: The proportion of wrongly accepted music scores (Wrong result).
The following equations can be calculated from line ratios above

IMPLEMENTATION OF THE PROPOSED ALGORITHM
Implementation were conducted and the proposed PBMRS system was tested to identify the different musical notes in two ways (deleting the musical lines and not deleting the musical lines) and using two types of implementation methods (sequential and parallel).

System training and testing stage
The data were trained in the proposed PBMRS system consisting of 700 images. The results of the training was obtained according to the evaluation measures, where FN, FPR, FRR and WRR equal to 0%. The value of DR, NPR, PP, Sensitivity and Specificity is 100%. The proposed PBMRS algorithm was tested on a collection of 300 images of musical notes.

Recent experiences
200 new images were added to the images of the notes, the first section contains the staff lines and another section is free from the lines, and a group of exotic images (50 pictures), which represent images of some shapes and symbols, are added to the musical notes. Image the test results were as shown in the Table 1. The execution time on n cores (14) Speed up Efficiency=(Speed Up)/n (15) n : represents the number of cores used in the implementation, the system was implemented in a sequential and parallel manner using two and three and four cores, and the results indicated in the Table 2 were obtained:

DISCUSSION
It was noted in Table 2 that the percentage of discrimination reached 95.5% by deleting musical lines, while 86.5% by not deleting those lines. The use of the process of deleting music lines is the best way to obtain clearer images and thus get higher results of discrimination and standards at better rates. It was observed in Table 2 that the use of three cores and four cores achieves a higher speed than two cores, although the use of three core and four core achieves a higher acceleration factor than the use of two core in the implementation. However, the use of two core is the most efficient, especially the use of the method of deleting the lines of the musical scale as the efficiency of the speed of the system about (0.80844) because the size of data used in each nucleus in the implementation of the use of two core is larger than the size of data used in each core in the three-cores and four implementation. A comparison was made between the results of the proposed PBMRS system and the results of a number of researchers in the same field as shown in Table 3.

CONCLUSION
The extraction of properties using LDA algorithm helped reduce the reservoir capacity of the images and reduce the implementation time of the system. After the size of the images used about 1000*625, it became a matrix of characteristics with two dimensions about 625*625. Also choose a small constant random value represented by the value (0.001) which is used to determine the amount of step (flight distance) of the bat. It is an important step added to the algorithm because the step amount in the bat is usually large because it is waiting for echo before deciding the type of target and determining its destination. Determining the amount of stock step reduces the unnecessary large dimensions that do not fit their use. So the percentage of discrimination in the manner of deleting the lines was equal to (96.6%) and the percentage of discrimination by way of non-deletion of lines equal to (93%).

565
As a future works: Adding the method for principle components analysis (PCA), then using the linear discrimination analysis method to obtain stronger characteristics of the images, and thus obtain better discrimination, The use of a greater number of image models of musical notes, which strengthens the process of distinguishing and benefiting from the advantages of parallel implementation in a more efficient manner, such as adding handwritten musical signs, and analyze the musical notes placed on the staff by determining their position on the staff lines and what tone they produce based on the Clef.