# Mobile Music Recognition based on Deep Neural Network

Authors: Nan Zhang
Journal: Mobile Information Systems
 (2022)

---

## Abstract

The piano, as the king of playing instruments, is the most popular instrument for people to learn to play. Learning to play the piano, on the other hand, necessitates professional instruction and a lot of practice. People do not have enough time for systematic training because of the fast pace of life. At the same time, a lack of professional piano teachers and high tuition fees discourage piano students. If the computer can recognize and evaluate the learner’s piano music in real time, the learner will be able to identify and correct errors in real time. There are currently some music recognition technologies, but the majority of them have the following flaws: first and foremost, the recognition accuracy is poor. Second, the identification process is slow and not real-time. Based on the existing problems, this paper proposes a mobile-based music recognition method. The main work of this paper is as follows: (1) a deep neural network (DNN) is applied to the recognition of piano playing music. The use of deep learning models improves the accuracy of music recognition. (2) In order to make the identification of music easier to use, a mobile application is developed in this paper. The app can be installed on mobile phones and tablets. It can input songs in real-time or offline, outputting misplayed notes and scoring the entire composition. In order to evaluate the effect of this study on music recognition, the experimental part uses multiple models for comparison. The experimental results show that the research in this paper is feasible and effective.


---

## Body

## 1. Introduction

With the advancement of the economy and society, an increasing number of individuals are becoming aware of and interested in music. Many parents start teaching their children to play at least one musical instrument while they are young. Because of its capacity to play an optimum melody, the piano is preferred by the majority of families as an easy-to-learn instrument. The number of individuals learning to play the piano has increased dramatically in recent years. Piano teachers, on the other hand, do not equal the increasing number of pupils quantitatively. Many piano teachers lack teaching principles or have a poor degree of proficiency in their own instruction. Each family is responsible for picking up and dropping off their children at school. Piano lessons are also costly, and they are invoiced in half-hour increments. To summarize, traditional piano instruction cannot satisfy the demands of today’s students. Pattern recognition technology [1, 2] was brought into music recognition with the introduction of pattern recognition technology. Without the direction of a music instructor, most piano novices are prone to misplaying notes. If the computer can identify and analyze real-time piano music, the user can utilize music recognition technology to locate and fix problems in real time. As a result, there is a market for computer-based music identification and mistake correction, while traditional playing music identification suffers from the following drawbacks: (1) there is no way to solve the adaptive challenge of piano music identification. Because the traditional music recognition method closely resembles the speech recognition algorithm, the threshold value for the time domain waveform was chosen to be too perfect. (2) Continuous multinote detection accuracy is weak. Traditional music recognition algorithms may readily produce mistakes in the identification of note beginning and ending locations, influencing the extraction of other music aspects, especially when playing fast-rhythm tunes. (3) It fails to fulfill the note segmentation and fundamental frequency extraction accuracy criteria for piano music note recognition. The typical music identification algorithm extracts the fundamental frequency of the frame sample using the peak-valley value characteristic of a single domain, and the peak-valley characteristic at the fundamental frequency is not noticeable enough, making it simple to make mistakes. (4) The base frequency processing of the frame sample is excessively harsh. When doing fundamental frequency computations with numerous frames of notes, the mean or maximum value is frequently used. In fact, this method of processing is unscientific, and it will result in lower accuracy when calculating the note’s fundamental frequency.With the fast advancement of science and technology in the fields of signal processing and acoustics, an increasing number of researchers have used this technology to music. To recognize a single note from continuous audio, first identify a single note, then extract more complex melody, rhythm, and other information, and then merge all the notes into a whole piece of music. Information like as chords, instruments, and so on must be detected in more sophisticated scenarios. The majority of note onset detection methods are based on the approach of voice endpoint detection, and they identify the start of notes using the signal’s time domain and frequency domain properties. A method of splitting the frequency range and then conducting independent analysis has been advocated by several academics. Reference [3] divides the frequency band into many subbands and defines the note start point as an abrupt change in energy. The results of the experiments demonstrate that this strategy can achieve a higher recognition rate. The signal amplitude of each subband is used as the feature of the detection starting point in reference [4], which uses a six-stage elliptic filter bank to achieve frequency band division. Reference [5] creates a filter bank that divides the frequency range into eight nonoverlapping subbands based on the auditory effect of the human ear. Reference [6] divides frequency bands using a Constant Q conjugated quadrature filter bank and uses the energy and frequency of the signals in the separated 5 frequency bands as the detecting starting point’s characteristics. In addition to the signal’s energy and frequency properties, several researchers have looked into the phase of the signal and presented certain approaches. The phase difference between adjacent frame signals is used by [7] to determine the note onset. The author of the follow-up work refined the method by combining signal energy information to achieve complicated frequency domain onset detection [8]. For musical tones with two fundamental frequency components, [9] performs multibase frequency detection. Based on [9], [10, 11] continue the research and realize the transition from single-base frequency detection to multibase frequency detection. Musicology, instrument physics, psychoacoustics, computer science, and other areas began to use multifundamental frequency detection technology as a result. A subsum autocorrelation technique in combination with a cochlear filter bank is proposed in [12]. Based on [12], [13] provides an upgraded summation autocorrelation technique. To detect various fundamental frequencies, this approach employs an auditory filter bank. By building pitch models for music data and comparing the weights of each pitch model, [14] achieves fundamental frequency detection. This approach successfully detects the music signal’s core fundamental frequency. By building pitch models for music data and comparing the weights of each pitch model, [14] achieves fundamental frequency detection. This approach successfully detects the music signal’s core fundamental frequency. A better pitch model is proposed in [15]. The model uses a constrained mixture of Gaussian models to uniformly describe each set of harmonics and uses expectation maximization to estimate the fundamental frequency of the music. The iterative spectrum elimination approach was suggested and enhanced by [16–18]. The fundamental frequency and its harmonic energy are eliminated from the original spectrum after a fundamental frequency is found. Repeated iterative deletion is used to detect all fundamental frequencies, and this method has a high detection accuracy.Through the analysis of the above research, music recognition based on deep learning algorithm has more advantages in recognition accuracy. It is observed that most of the current deep learning algorithms are applied to the recognition of music scores based on pictures, while the recognition of audio music played live is relatively rare. In real life, real-time recognition based on music is more meaningful. Its application market in the field of computer-aided teaching is wide. Based on this, this paper uses a DNN in the recognition of playing music. Music recognition is to obtain the spectrogram of the signal by analyzing the speech signal and then obtain information from the spectrogram for further processing. Spectrograms generally have structural characteristics, which are affected by factors such as the speaker and the speaker’s environment. Therefore, it is necessary to consider how to eliminate these external factors so as to better reflect the original characteristics of the spectrogram. Temporal and spatial translation-invariant convolutions can be achieved by convolutional neural networks. This idea is applied to the modeling of speech signal, and the characteristics of convolution invariance are used to avoid the interference of other factors on the signal characteristics. The obtained spectrogram is processed and recognized by the DNN used in the image processing process. Using the neural network structure also facilitates the processing of the obtained information. Because the current frameworks related to neural networks are relatively mature, the experimental structure shows that the algorithm used in this paper has obvious effect on music recognition. In order to apply the deep network-based music recognition results to real-world learning, a mobile application is also designed in this paper. Using the trained music recognition model as a tool, it can identify and analyze the input music, output the wrong notes, and guide the learners’ learning in time.


## 2. Knowledge about Music Recognition

### 2.1. Expression of Music

Songs have three basic forms of expression, namely, score, Musical Instrument Digital Interface (MIDI), and audio. Music scores use notation information to record notes and pitch information, which is the initial form of music. People play music from sheet music, and music experts manually record sheet music based on what they hear. MIDI is a standard for exchanging musical information between various musical instruments and computers, as well as between electronic musical instruments and music synthesizers. MIDI devices communicate information through digital codes, and these digital codes form an electronic musical score. MIDI files can display staff on the computer and also have a playback function. The music played by the computer is audio. Audio is the music we hear in our daily life, and it is a musical signal that can be perceived through hearing. In recent years, the automatic notation technology researched by scholars at home and abroad has realized the conversion of audio into MIDI. The mutual conversion relationship between the three expressions of music score, MIDI, and audio is shown in Figure1.Figure 1
Conversion relationship.


### 2.2. Signal Characteristics of Playing Music

There are four common characteristics of playing music, namely, pitch, intensity, length, and timbre. Pitch is the frequency at which the articulator vibrates. Because the pronunciation body frequently has more than one vibration mode, when describing the pitch, the frequency with the greatest amplitude in the musical tone spectrum, that is, the fundamental frequency, is used. The loudness of sound waves as perceived by the human ear is referred to as the sound intensity. The change in sound intensity makes the music more expressive and expresses the emotions of the player. The duration of a musical tone is referred to as its length. The rhythm of music is formed by the change and combination of the length of the sound. The corresponding relationship between timbre and objective physical quantities is complex, and it is a unique attribute of a certain type of musical instrument that can even be refined to a certain musical instrument. These four basic musical features have a close correspondence with the physical characteristics of the musical signal. By analyzing the signal characteristics corresponding to these musical sound characteristics, it is helpful to understand the influencing factors of piano sound quality in the field of signal processing and analysis.


#### 2.2.1. Time Domain Features

The time domain features of the piano sound signal can be used to describe the pitch characteristics of the musical tones. Tones of different lengths can be combined to form music with different rhythms, and rhythm is one of the factors that affects the style of music. In addition to the tone length, other time-domain characteristics of a musical tone can also be obtained by solving its time-domain amplitude envelope. Piano music goes through three stages, which are shown in Figure2:Figure 2
The three stages of piano tones.The stage from the beginning of the tone to the peak is called the onset phase, and the duration of this stage is called the onset time. From the point of view of music theory, theoretically, if this period of time is longer, it will appear too soft, not clear, and rigid enough, so a shorter start-up time can represent better musical sound quality. However, if the start-up time is too short, there will be a stiff feeling with metal, so the start-up time should not be too short. The time from the peak to a certain decay is the decay phase, and the length of this period has a certain relationship with the striking strength of different keys. The total length of the decay period has a great effect on the fullness of the tone. This period characterizes the time it takes for the vibration to stop after the string is no longer excited and is called the release phase. The length of this period is also related to the different keys and how the different keys are actuated.


#### 2.2.2. Frequency Domain Features

The spectrum of the piano sound is formed by the linear filtering of the soundboard and the air and has a corresponding relationship with the spectrum of the string vibration. The corresponding characteristics of the vibration of the strings will be reflected in the frequency spectrum of the piano sound signal. In general, the characteristic parameters used for simple analysis in the spectral structure include the number of spectral harmonics and the harmonic energy. The sound spectrum curve can be used to describe the overall situation of the characteristics of these two parameters. The decay of the spectral curve envelope is related to the sound properties of the sound such as bright, full, and thin. Although the analysis of frequency domain features is the most important step in the process of piano sound quality analysis, the nature of the signal frame within a small time window of the music signal is invariable throughout the entire period. Therefore, in order to make better use of the frequency domain features of the entire music signal, it is also necessary to analyze the short-term frequency domain features. The extraction of short-time frequency domain features mainly uses the method of short-time Fourier transform. The entire music signal is time-windowed, and Fourier transform is performed on each small segment to obtain its frequency spectrum.


#### 2.2.3. Spatial Domain Features

The formation of the piano sound field is closely related to the soundboard of the piano. The soundboard has the functions of resonance, energy amplification, and sound optimization of the vibration transmitted by the piano strings, their control components and auxiliary components. In this process, a good soundboard should complete the following three functions: (1) minimize the loss of energy during the entire process of sound waves being transmitted from the strings to the soundboard and then to the air. (2) Play a certain filtering role. Reduce the radiation of the overtone range that deteriorates the sound quality, so that the sound filtered and amplified by the soundboard is more beautiful and pleasant and has sufficient loudness and durability. (3) Ensure that the sound transition of the piano’s low, middle, and high ranges is even. The spatial characteristics are the music signals collected at different positions using the microphone array acquisition device near the piano soundboard, and the characteristics formed after the overall analysis of the signal characteristics of each position. To a certain extent, the spatial feature can describe the spatial contribution of the music signals at different positions of the piano to the sound quality, so it can be used as a feature of the sound quality difference of different pianos.


## 2.1. Expression of Music

Songs have three basic forms of expression, namely, score, Musical Instrument Digital Interface (MIDI), and audio. Music scores use notation information to record notes and pitch information, which is the initial form of music. People play music from sheet music, and music experts manually record sheet music based on what they hear. MIDI is a standard for exchanging musical information between various musical instruments and computers, as well as between electronic musical instruments and music synthesizers. MIDI devices communicate information through digital codes, and these digital codes form an electronic musical score. MIDI files can display staff on the computer and also have a playback function. The music played by the computer is audio. Audio is the music we hear in our daily life, and it is a musical signal that can be perceived through hearing. In recent years, the automatic notation technology researched by scholars at home and abroad has realized the conversion of audio into MIDI. The mutual conversion relationship between the three expressions of music score, MIDI, and audio is shown in Figure1.Figure 1
Conversion relationship.


## 2.2. Signal Characteristics of Playing Music

There are four common characteristics of playing music, namely, pitch, intensity, length, and timbre. Pitch is the frequency at which the articulator vibrates. Because the pronunciation body frequently has more than one vibration mode, when describing the pitch, the frequency with the greatest amplitude in the musical tone spectrum, that is, the fundamental frequency, is used. The loudness of sound waves as perceived by the human ear is referred to as the sound intensity. The change in sound intensity makes the music more expressive and expresses the emotions of the player. The duration of a musical tone is referred to as its length. The rhythm of music is formed by the change and combination of the length of the sound. The corresponding relationship between timbre and objective physical quantities is complex, and it is a unique attribute of a certain type of musical instrument that can even be refined to a certain musical instrument. These four basic musical features have a close correspondence with the physical characteristics of the musical signal. By analyzing the signal characteristics corresponding to these musical sound characteristics, it is helpful to understand the influencing factors of piano sound quality in the field of signal processing and analysis.


### 2.2.1. Time Domain Features

The time domain features of the piano sound signal can be used to describe the pitch characteristics of the musical tones. Tones of different lengths can be combined to form music with different rhythms, and rhythm is one of the factors that affects the style of music. In addition to the tone length, other time-domain characteristics of a musical tone can also be obtained by solving its time-domain amplitude envelope. Piano music goes through three stages, which are shown in Figure2:Figure 2
The three stages of piano tones.The stage from the beginning of the tone to the peak is called the onset phase, and the duration of this stage is called the onset time. From the point of view of music theory, theoretically, if this period of time is longer, it will appear too soft, not clear, and rigid enough, so a shorter start-up time can represent better musical sound quality. However, if the start-up time is too short, there will be a stiff feeling with metal, so the start-up time should not be too short. The time from the peak to a certain decay is the decay phase, and the length of this period has a certain relationship with the striking strength of different keys. The total length of the decay period has a great effect on the fullness of the tone. This period characterizes the time it takes for the vibration to stop after the string is no longer excited and is called the release phase. The length of this period is also related to the different keys and how the different keys are actuated.


### 2.2.2. Frequency Domain Features

The spectrum of the piano sound is formed by the linear filtering of the soundboard and the air and has a corresponding relationship with the spectrum of the string vibration. The corresponding characteristics of the vibration of the strings will be reflected in the frequency spectrum of the piano sound signal. In general, the characteristic parameters used for simple analysis in the spectral structure include the number of spectral harmonics and the harmonic energy. The sound spectrum curve can be used to describe the overall situation of the characteristics of these two parameters. The decay of the spectral curve envelope is related to the sound properties of the sound such as bright, full, and thin. Although the analysis of frequency domain features is the most important step in the process of piano sound quality analysis, the nature of the signal frame within a small time window of the music signal is invariable throughout the entire period. Therefore, in order to make better use of the frequency domain features of the entire music signal, it is also necessary to analyze the short-term frequency domain features. The extraction of short-time frequency domain features mainly uses the method of short-time Fourier transform. The entire music signal is time-windowed, and Fourier transform is performed on each small segment to obtain its frequency spectrum.


### 2.2.3. Spatial Domain Features

The formation of the piano sound field is closely related to the soundboard of the piano. The soundboard has the functions of resonance, energy amplification, and sound optimization of the vibration transmitted by the piano strings, their control components and auxiliary components. In this process, a good soundboard should complete the following three functions: (1) minimize the loss of energy during the entire process of sound waves being transmitted from the strings to the soundboard and then to the air. (2) Play a certain filtering role. Reduce the radiation of the overtone range that deteriorates the sound quality, so that the sound filtered and amplified by the soundboard is more beautiful and pleasant and has sufficient loudness and durability. (3) Ensure that the sound transition of the piano’s low, middle, and high ranges is even. The spatial characteristics are the music signals collected at different positions using the microphone array acquisition device near the piano soundboard, and the characteristics formed after the overall analysis of the signal characteristics of each position. To a certain extent, the spatial feature can describe the spatial contribution of the music signals at different positions of the piano to the sound quality, so it can be used as a feature of the sound quality difference of different pianos.


## 2.2.1. Time Domain Features

The time domain features of the piano sound signal can be used to describe the pitch characteristics of the musical tones. Tones of different lengths can be combined to form music with different rhythms, and rhythm is one of the factors that affects the style of music. In addition to the tone length, other time-domain characteristics of a musical tone can also be obtained by solving its time-domain amplitude envelope. Piano music goes through three stages, which are shown in Figure2:Figure 2
The three stages of piano tones.The stage from the beginning of the tone to the peak is called the onset phase, and the duration of this stage is called the onset time. From the point of view of music theory, theoretically, if this period of time is longer, it will appear too soft, not clear, and rigid enough, so a shorter start-up time can represent better musical sound quality. However, if the start-up time is too short, there will be a stiff feeling with metal, so the start-up time should not be too short. The time from the peak to a certain decay is the decay phase, and the length of this period has a certain relationship with the striking strength of different keys. The total length of the decay period has a great effect on the fullness of the tone. This period characterizes the time it takes for the vibration to stop after the string is no longer excited and is called the release phase. The length of this period is also related to the different keys and how the different keys are actuated.


## 2.2.2. Frequency Domain Features

The spectrum of the piano sound is formed by the linear filtering of the soundboard and the air and has a corresponding relationship with the spectrum of the string vibration. The corresponding characteristics of the vibration of the strings will be reflected in the frequency spectrum of the piano sound signal. In general, the characteristic parameters used for simple analysis in the spectral structure include the number of spectral harmonics and the harmonic energy. The sound spectrum curve can be used to describe the overall situation of the characteristics of these two parameters. The decay of the spectral curve envelope is related to the sound properties of the sound such as bright, full, and thin. Although the analysis of frequency domain features is the most important step in the process of piano sound quality analysis, the nature of the signal frame within a small time window of the music signal is invariable throughout the entire period. Therefore, in order to make better use of the frequency domain features of the entire music signal, it is also necessary to analyze the short-term frequency domain features. The extraction of short-time frequency domain features mainly uses the method of short-time Fourier transform. The entire music signal is time-windowed, and Fourier transform is performed on each small segment to obtain its frequency spectrum.


## 2.2.3. Spatial Domain Features

The formation of the piano sound field is closely related to the soundboard of the piano. The soundboard has the functions of resonance, energy amplification, and sound optimization of the vibration transmitted by the piano strings, their control components and auxiliary components. In this process, a good soundboard should complete the following three functions: (1) minimize the loss of energy during the entire process of sound waves being transmitted from the strings to the soundboard and then to the air. (2) Play a certain filtering role. Reduce the radiation of the overtone range that deteriorates the sound quality, so that the sound filtered and amplified by the soundboard is more beautiful and pleasant and has sufficient loudness and durability. (3) Ensure that the sound transition of the piano’s low, middle, and high ranges is even. The spatial characteristics are the music signals collected at different positions using the microphone array acquisition device near the piano soundboard, and the characteristics formed after the overall analysis of the signal characteristics of each position. To a certain extent, the spatial feature can describe the spatial contribution of the music signals at different positions of the piano to the sound quality, so it can be used as a feature of the sound quality difference of different pianos.


## 3. Deep Neural Networks for Song Identification

Assume thatXj=x1,x2,…,xnT is the input vector, xi1≤i≤n is the input of the ith neuron, and n is the number of input neurons. Lij1≤i≤j denotes the strength of the connection between nodes i and j. The threshold of neuron j is denoted by vj. The threshold node is represented by the fixed bias input node of x0 = 1, and the link strength with the neuron is −vj. The output weighted sum of neuron j can be calculated using the above parameters:(1)hj=∑i=0nxilij=∑i=1nxilij−vj.At the same time, the output state of neuronj can also be obtained:(2)yj=fhj=f∑i=1nxilij−vj,where function f() is the neuron’s activation function, and the function reflects the neuron’s input and output relationship. This function generally employs the Sigmoid function, and its input range is limited to [0, 1]. The function is written as follows:(3)y=fx=ex−e−xex+e−x,x∈R.By connecting individual neurons at a certain level, a DNN can be obtained [19]. A multilayer neural network model is shown in Figure 3.Figure 3
Multilayer neural network model.The majority of speech recognition frameworks are based on GMM-HMM; however, the level of this model is shallow, and deep features between data cannot be captured using this model alone [20]. The DNN-HMM model can compensate for this shortcoming by leveraging DNN’s strong learning ability to outperform the GMM model. The structure diagram of the DNN-HMM system used in this paper is shown in Figure 4. The Hidden Markov Model (HMM) describes the dynamic changes of the audio signal in this structure, and the output of each node in the DNN is used to estimate the posterior probability of a certain HMM state.Figure 4
DNN-HMM structure.If the acoustic input of the audio signal isU=u1,u2,…,un, it is the acoustic feature vector obtained during the audio signal’s feature processing. The piece is called L=l1,l2,…,ln, and it consists of a series of notes. Then, given the acoustic input, the task of music recognition is to determine the most likely output, which can be expressed using the following formula:(4)L=argmaxLPL|U.To obtain the best recognition result,PL|U needs to be maximized, then equation (4) can be expanded to get the following:(5)L=argmaxLPW|U=argmaxLpU|LPLPU=argmaxLpU|LPL,P(W) is the audio model in a recognition system, and PU|L is the acoustic model. Let T=t1,t2,…,tn be a state transition sequence; using the Viterbi decoding algorithm, the acoustic model can be expressed as follows:(6)PU|L=∑QPU,S|LPS|L≈maxπs0∏t=1Tast−1st∏t=1Tput|st,where ast−1st is the transition probability between states st−1 and st. DNN can only provide the posterior probability pst|ut of the state on each node of the output layer when used.(7)put|st=pst|utputpst.


## 4. Experiment of Music Recognition based on Mobile Terminal

### 4.1. Experimental Data and Environment

The dataset in this paper is the recording data of piano playing in a quiet environment. A total of 200 pieces of piano playing audio data were recorded in this experiment. 160 pieces of data are randomly selected as training samples, and the remaining 40 pieces are used as test samples. The average duration of each track recorded is 180 ms. The recorded pieces basically cover the piano’s 88 tones. Since the datasets used are all in audio file format, they cannot be directly input into the deep neural network, and they also need to be converted into spectrograms. In this paper, the Sound eXchange (SoX) tool is used to draw the spectrogram. SoX is a cross-platform command-line tool, widely used in the field of acoustic processing, known as the Swiss Army Knife of audio processing. This article uses only its “spectrogram” command to draw spectrograms. The size of the spectrogram is900∗600. The experimental environment of this paper is shown in Table 1:Table 1
Experimental environment.
Hardware environmentCPU processorIntel core i9-9900KGPUNVIDIA RTX3070Memory32GDDR4Hard diskSamsung 1T solid state driveSoftware environmentOperating systemWin10Development environmentTensorFlow


### 4.2. Experimental Comparison

In order to verify the performance of the algorithm used in this paper, the selected comparison algorithms are CNN [21], RNN [22], AlexNet [23], VGGNet [24], and LSTM [25]. In order to quantitatively compare the recognition results of various algorithms for notes in piano music, the evaluation index used is the classification accuracy. By comparing the multinote name, start and end time between the reference label of the test audio and the recognition result, the evaluation of the piano multinote recognition system is realized. The correct rate is defined as follows:(8)P=N−N1−N2N,where N is the total number of multinotes in the reference annotation, N1 is the number of multinote recognitions whose start and end times are within the time tolerance range, but the recognition result is wrong, and the tolerance time is generally set within 50 ms. N2 is the number of multinotes whose start and end times exceed the recognition range, which is set to 100 ms in this paper. The note recognition results of each network model for piano music are shown in Table 2 and Figure 5:Table 2
Note recognition results.
ModelCNNRNNAlexNetVGGNetLSTMProposedPMeanStdMeanStdMeanStdMeanStdMeanStdMeanStd0.76830.02330.78930.03210.74670.02750.75320.04320.80360.03250.83430.0186Figure 5
Comparison of note recognition results.The experimental results show that the recognition rates obtained under each model are between 0.7 and 0.85. Among them, the recognition rate of the method in this paper is 0.8343, which is 7.91%, 5.39%, 10.5%, 9.72%, and 3.68% higher than the recognition rates of CNN, RNN, AlexNet, VGGNet, and LSTM, respectively. The recognition performance of AlexNet is the worst, because the model not only is slow to train, but also has an inherently low recognition rate. CNN uses the gradient descent algorithm to easily converge the training result to the local minimum rather than the global minimum. The pooling layer will waste a lot of valuable information by ignoring the correlation between the local and the overall. These are the underlying causes of the poor final recognition effect. The RNN recognition rate has improved, but it is still difficult to achieve a higher recognition rate due to the network’s difficulties in obtaining information from a long time ago and its inability to consider any future input of the current state. Because the depth of the network is deeper in VGGNet than in AlexNet, the recognition rate is slightly higher, but the training time will also increase accordingly. Because the network improves the long-term dependency problem in RNN, the recognition rate of LSTM has been greatly improved when compared to other networks. In general, LSTMs outperform temporal recurrent neural networks and hidden Markov models. As a nonlinear model, LSTM can be used to build larger deep neural networks as a complex nonlinear unit. However, since each LSTM cell means that there are 4 fully connected layers, if the time span of the LSTM is large, and the network is very deep, this calculation will be very large and time-consuming.


### 4.3. Design of Mobile Music Recognition System

In order to make it easier for piano learners to learn and practice playing music, this paper designs an application that can be installed on mobile devices to identify whether the played music is correct. The software is developed based on AndroidStudio. The functional modules of the software are shown in Figure6:Figure 6
System function modules.As can be seen from Figure6, this application software mainly includes three functional modules: real-time identification, offline identification, and identification report. By clicking the buttons corresponding to the three function modules in the main interface, you can jump to the corresponding function module page. On the real-time recognition page, click the start button to start recording sound. After recording, click the recognition button, and the recognition result will appear at the bottom of the page. On the offline recognition page, click the upload button to upload the audio file to be recognized to the software, click the recognition button, and the recognition result will appear at the bottom of the page. In the identification report interface, you can select the statistical results of identification within a period of time. This allows learners to master their own learning situation and to also intuitively see the effect of learning.In order to further test the performance of the mobile application, 200 and 100 piano pieces were uploaded in the real-time recognition module and the offline recognition module, respectively. The identification results are shown in Table3 and Figure 7.Table 3
Mobile application test results.
Functional moduleNumber of samplesNumber of correct samplesNumber of wrong samplesRecognition rate (%)Real-time identification2001663482.5Offline recognition100842684Figure 7
Comparison chart of mobile application recognition results.The data in Table3 and Figure 7 shows that the recognition rate obtained by the real-time recognition module is relatively low. This is because, in the process of real-time detection, it is possible that the noise of the surrounding environment is entered, which causes the detection effect to be less than ideal in the experimental environment. The recognition effect obtained by offline recognition of uploaded audio is slightly better than real-time recognition. This has a lot to do with the environment in which the audio was recorded. When the noise in the environment is small, or the quality of the recording device is high, the recorded audio data is of high quality. High-quality audio is input into the recognition module, and the recognition results obtained will be ideal. It can be seen from the results obtained by the two modules that the recognition rates are within the range of the experimental results given in the fourth section. If the recognition rate exceeds 80%, it is feasible to apply it to the teaching of real playing music.


## 4.1. Experimental Data and Environment

The dataset in this paper is the recording data of piano playing in a quiet environment. A total of 200 pieces of piano playing audio data were recorded in this experiment. 160 pieces of data are randomly selected as training samples, and the remaining 40 pieces are used as test samples. The average duration of each track recorded is 180 ms. The recorded pieces basically cover the piano’s 88 tones. Since the datasets used are all in audio file format, they cannot be directly input into the deep neural network, and they also need to be converted into spectrograms. In this paper, the Sound eXchange (SoX) tool is used to draw the spectrogram. SoX is a cross-platform command-line tool, widely used in the field of acoustic processing, known as the Swiss Army Knife of audio processing. This article uses only its “spectrogram” command to draw spectrograms. The size of the spectrogram is900∗600. The experimental environment of this paper is shown in Table 1:Table 1
Experimental environment.
Hardware environmentCPU processorIntel core i9-9900KGPUNVIDIA RTX3070Memory32GDDR4Hard diskSamsung 1T solid state driveSoftware environmentOperating systemWin10Development environmentTensorFlow


## 4.2. Experimental Comparison

In order to verify the performance of the algorithm used in this paper, the selected comparison algorithms are CNN [21], RNN [22], AlexNet [23], VGGNet [24], and LSTM [25]. In order to quantitatively compare the recognition results of various algorithms for notes in piano music, the evaluation index used is the classification accuracy. By comparing the multinote name, start and end time between the reference label of the test audio and the recognition result, the evaluation of the piano multinote recognition system is realized. The correct rate is defined as follows:(8)P=N−N1−N2N,where N is the total number of multinotes in the reference annotation, N1 is the number of multinote recognitions whose start and end times are within the time tolerance range, but the recognition result is wrong, and the tolerance time is generally set within 50 ms. N2 is the number of multinotes whose start and end times exceed the recognition range, which is set to 100 ms in this paper. The note recognition results of each network model for piano music are shown in Table 2 and Figure 5:Table 2
Note recognition results.
ModelCNNRNNAlexNetVGGNetLSTMProposedPMeanStdMeanStdMeanStdMeanStdMeanStdMeanStd0.76830.02330.78930.03210.74670.02750.75320.04320.80360.03250.83430.0186Figure 5
Comparison of note recognition results.The experimental results show that the recognition rates obtained under each model are between 0.7 and 0.85. Among them, the recognition rate of the method in this paper is 0.8343, which is 7.91%, 5.39%, 10.5%, 9.72%, and 3.68% higher than the recognition rates of CNN, RNN, AlexNet, VGGNet, and LSTM, respectively. The recognition performance of AlexNet is the worst, because the model not only is slow to train, but also has an inherently low recognition rate. CNN uses the gradient descent algorithm to easily converge the training result to the local minimum rather than the global minimum. The pooling layer will waste a lot of valuable information by ignoring the correlation between the local and the overall. These are the underlying causes of the poor final recognition effect. The RNN recognition rate has improved, but it is still difficult to achieve a higher recognition rate due to the network’s difficulties in obtaining information from a long time ago and its inability to consider any future input of the current state. Because the depth of the network is deeper in VGGNet than in AlexNet, the recognition rate is slightly higher, but the training time will also increase accordingly. Because the network improves the long-term dependency problem in RNN, the recognition rate of LSTM has been greatly improved when compared to other networks. In general, LSTMs outperform temporal recurrent neural networks and hidden Markov models. As a nonlinear model, LSTM can be used to build larger deep neural networks as a complex nonlinear unit. However, since each LSTM cell means that there are 4 fully connected layers, if the time span of the LSTM is large, and the network is very deep, this calculation will be very large and time-consuming.


## 4.3. Design of Mobile Music Recognition System

In order to make it easier for piano learners to learn and practice playing music, this paper designs an application that can be installed on mobile devices to identify whether the played music is correct. The software is developed based on AndroidStudio. The functional modules of the software are shown in Figure6:Figure 6
System function modules.As can be seen from Figure6, this application software mainly includes three functional modules: real-time identification, offline identification, and identification report. By clicking the buttons corresponding to the three function modules in the main interface, you can jump to the corresponding function module page. On the real-time recognition page, click the start button to start recording sound. After recording, click the recognition button, and the recognition result will appear at the bottom of the page. On the offline recognition page, click the upload button to upload the audio file to be recognized to the software, click the recognition button, and the recognition result will appear at the bottom of the page. In the identification report interface, you can select the statistical results of identification within a period of time. This allows learners to master their own learning situation and to also intuitively see the effect of learning.In order to further test the performance of the mobile application, 200 and 100 piano pieces were uploaded in the real-time recognition module and the offline recognition module, respectively. The identification results are shown in Table3 and Figure 7.Table 3
Mobile application test results.
Functional moduleNumber of samplesNumber of correct samplesNumber of wrong samplesRecognition rate (%)Real-time identification2001663482.5Offline recognition100842684Figure 7
Comparison chart of mobile application recognition results.The data in Table3 and Figure 7 shows that the recognition rate obtained by the real-time recognition module is relatively low. This is because, in the process of real-time detection, it is possible that the noise of the surrounding environment is entered, which causes the detection effect to be less than ideal in the experimental environment. The recognition effect obtained by offline recognition of uploaded audio is slightly better than real-time recognition. This has a lot to do with the environment in which the audio was recorded. When the noise in the environment is small, or the quality of the recording device is high, the recorded audio data is of high quality. High-quality audio is input into the recognition module, and the recognition results obtained will be ideal. It can be seen from the results obtained by the two modules that the recognition rates are within the range of the experimental results given in the fourth section. If the recognition rate exceeds 80%, it is feasible to apply it to the teaching of real playing music.


## 5. Conclusion

The rapid development of modern science and technology demonstrates that as human exploration deepens, the derivation and correlation between disciplines become stronger and stronger. At the moment, with the general public’s interest in learning musical instruments on the rise, the number of high-quality and professional teachers is clearly insufficient to meet the needs. As a result of this situation, there is a greater demand for intelligent teaching tools. This paper uses the piano as an example to conduct identification research on music playing. This paper trains a DNN model to more accurately identify each note in the music. The experimental results show that DNN has a better recognition effect than other deep learning algorithms and has some recognition advantages. As a result, DNN is finally used in this paper for the identification of piano and other playing music. After training, the network is encapsulated into a functional function to make it easier for learners to use the recognition function. And an application that can be installed on the mobile terminal is created using the Android development environment. The app can recognize not only real-time recorded compositions, but also offline compositions. After learning to play a musical instrument for a period of time, the learner can review the learning situation for that time period in the application’s identification statistics module. This module will not only count the notes that learners are most likely to play incorrectly, but it will also provide professional learning suggestions for learners to consider. In the future, we will experiment to verify the identification effect of this method in other playing music in order to further expand the identification of musical instrument types in this study such as guitars and zithers.



---

*Source: 2541933-2022-06-22.xml*