# Recognition and Error Correction of Piano Playing Features Based on Filtering Technology

Authors: Jing Fan
Journal: Security and Communication Networks
 (2022)

---

## Abstract

The extraction of piano features needs to be based on mature technology, but there is no mature technology for feature recognition of music to ensure the correct rate of feature extraction. This article combines filter processing technology to carry out the research on piano playing feature recognition and builds an intelligent error correction system, and it realizes the feature recognition and error correction of piano playing with the support of filter technology. Moreover, this article conducts experimental research on the system constructed. Through experimental research, it can be seen that the piano performance feature recognition system proposed in this article can effectively recognize the piano practitioner’s playing effect and record it for error correction. This intelligent method can effectively improve the piano playing effect.


---

## Body

## 1. Introduction

Music and its performance are always high-level activities that humans engage in. Compared with language, it belongs to a higher level of communication between humans. It is a bridge for expressing emotions between people. When listening to a song, the audience can understand the connotation of the song and can resonate with the emotion of the author. As the process of this kind of emotional transmission, “performance” plays a vital role, and a good player can experience the emotion of music and pass it to the audience through the instrument. However, a failed performance cannot impress the audience or even make the audience feel disgusted. Although the specific music played can be heard, it cannot give the audience a pleasant feeling [1]. The quality of music performance here is a vague concept, and there are many definitions [2], such as fluency of performance, understanding of musical scores, and ability to control musical instruments. In playing teaching, we often hear the teacher say to the students, “Play with your heart.” This is a vague concept. In essence, it is something that cannot be depicted on the performance music score. It can only be explained in abstract language, and then, it is up to the students to grasp it [3]. For example, the score on the music score can describe whether a note is “stressed” or not, but it cannot be expressed as the “absolute physical amplitude” of the sound of each note in different playing environments. This ambiguity and uncertainty have become the factors that distinguish the quality of music performance. This is also the reason why ordinary music players and master performers can give listeners different feelings when playing the same piece.The process of listening to the sound by the audience: the music heard needs to be analyzed by a person with sensitive hearing, and the sound contained in it is represented by a spectrum. The process of musical instruments forming sound waves: the source of sampling is the waveform of the sound, that is, the recording of the amplitude of the sound wave within a certain sampling frequency, such as CB audio. To perform various analyses on this secret audio data, the desired musical characteristics can best be obtained, which involves a large amount of pattern recognition knowledge. Pattern recognition is still a hot research topic, and there are still many areas that need to be improved. Sound pattern recognition has a wide range of applications in speech recognition, and it has also achieved certain research results in music feature extraction.This article combines filter processing technology to carry out the research on the recognition of piano playing features and builds an intelligent error correction system to improve the effect of piano practice and piano performance.This article combines the filtering processing technology to carry out the research on the feature recognition of piano playing, constructs an intelligent error correction system, and realizes the feature recognition and error correction of piano playing with the support of filtering technology. The research shows that the recognition of piano performance features can realize the effective recognition of the performance of piano practitioners and record them for error correction.The organizational structure of this article is as follows: The first part is to describe the needs and background of the identification of piano playing characteristics and to analyze the research motivation of this article. The second part is to analyze the research status of piano exploration characteristics, summarize the literature, and elicit the research content. The third part is the research on the selection method of piano score data smoothing, which is mainly the algorithm improvement part. The fourth part is based on the algorithm based on the recognition of the piano playing features and the construction of the error correction model based on the filtering nursing technology and verify the effect of the model. The conclusion part is a summary of the research method and research content and an outlook.The main contributions of this article are as follows: (1). The improved algorithm in this study overcomes the large error of the traditional model system and improves the accuracy of the selection of the piano score data smoothing method. (2). The filtering technology can effectively eliminate the interference of external factors in the recognition of piano playing features, which is important for feature extraction.


## 2. Related Work

For piano playing training, scholars at home and abroad conduct research through three aspects: the brain mechanism of piano playing training, skill level assessment, and auxiliary training system. Kiliç [4] studied the difference in the participation of the motor cortex of the brain during the training of piano music playing between professional and nonprofessional piano players. Studies have shown that the involvement of the brain’s primary and secondary motor cortex depends on the stage of motor learning and the subject’s experience. In the early training stage, the nonprofessional performers showed that more main and auxiliary motor areas of the brain were activated, and the activation time was longer; in the later training stage, the activity of the main motor cortex of the nonprofessional players decreased rapidly, whereas in the professional players, there was no significant decrease in the activity of the main motor cortex of the brain. Hoffman and Novak [5] proposed a convenient and accurate tool to quantitatively evaluate piano performance techniques. They processed the MIDI files generated during piano performance to obtain the playing interval and key-down speed to evaluate the pianist’s teaching and rehabilitation monitoring. Jia et al. [6] designed a tactile-guided magnetic permeable keyboard system MaGkeys, which combined with the audition learning mode to assist learners in piano playing training. Waldron et al. [7] designed a wearable wireless tactile piano teaching system, PianoTouch, which installed five small vibration motors and a Bluetooth module in a glove, and subjects felt the sound from playing notes while listening to the piano music. The vibration of that finger, the results of the study, showed that subjects wearing PianoTouch with built-in tactile perception had better playing effect when playing piano music. Zhang and Tao [8] extracted MIDI information to represent the rhythm, expressiveness, and musicality of performance through MIDI equipment and then integrates neural network to evaluate performance and finally establishes an evaluation system for piano performance and has a good test effect.Gun [9] conducted relevant experiments on the speed of the piano keys and the spectrum analysis of the keys, and the key touch methods are divided into “raise the finger and press the key quickly” and “paste the key and press the key slowly.” The author believes that the final difference lies in the key touch. The strength of the button is different, and it has nothing to do with whether the finger is raised because these two key touch methods only involve strong and weak strengths. In the experiment, the speed of touching the keys is calculated by measuring the time between the fingers touching the keys and the hammers hitting the strings, and the distance between the keys and the hammers, and finally calculating the speed. The measured speed of piano playing is the average speed, and the speed of the finger when touching the key is not a uniform movement but an acceleration movement. The speed obtained in this way cannot reflect the true state of the finger touching the key [10]. In the spectrum analysis comparing different key touch methods, the author analyzed the time-domain and spectrum characteristics of the sound waveform and the part about spectrum characteristics. There are many studies on the relationship between the material, performance, specifications, and the change of each parameter of the action machine and the timbre spectrum, but this has little connection with the research topic of this article—the key touch method and timbre [11]. Lian [12] gave a detailed explanation of the essentials of vertical and horizontal finger touch actions. Kim et al. [13] divided touch keys into finger force touch keys, hand force touch keys, and arm drop according to the force of the touch keys, touch keys, and full arm touch keys. Kaplan and Haenlein [14] believed that the color change of the piano sound is determined by the different strength of the hammer hitting the strings. The greater the strength, the sharper the sound. This is because the upper overtone is generated, and the appearance of the upper overtone is due to the auxiliary vibration of the string. When the power is small, the upper overtone disappears, and the sound becomes soft. Reyes [15] believed that the touch technique of the finger will lead to the change in the overtone above the tone. The greater the distance between the fingers and the keys, the more obvious the effect of the upper overtones, and the overtones above the keys will be weakened or even disappear when the keys directly touch the keys. Jones [16] believed that the fuller and brighter the sound, the more beautiful it sounds. The player can control the tone by controlling the number of overtones at the touch of a key. Under the premise of maintaining the same key height, if you increase the touch area (folding your fingers increases the touch area), the number of upper overtones will be increased, and the timbre will also be changed.Aithal and Aithal [17] studied the instantaneous motion state of the piano action machine through different key-touching methods and different key-touching strengths. Accelerometers are used to measure the speed of movement of the keys and hammers, and pickups are used to pick up sound signals. The key touch methods they chose were pressed touch and strike touch, and the intensity ranged from weak to strong. The measurement data include the acceleration of the finger key, the acceleration of the hammer string, the time the key is in contact with the key bed, the maximum speed of the hammer, and so on. The conclusion is that the length of time between the finger touching the key and the hammer hitting the string can be roughly regarded as the maximum speed of the hammer after calculation, and this speed is very different between the two key touching methods [18]. But when the two keystrokes touch the keys with little force, the difference in speed becomes smaller.


## 3. Selection of Piano Score Data Smoothing Method

### 3.1. Linear Smoothing of Filter Data

The polynomial least-squares fitting method uses a polynomial of degreen and 2m + 1 data points to perform smooth fitting section by section to achieve the purpose of smoothness. This method takes each data of the γ-wave spectrum original data as the center and takes m data (total 2 m + 1) to the left and right sides for smoothing. The corresponding data channel value coordinate is −m.−m+1.−m+2…−1.0.1…m−2.m−1.m, and the corresponding channel value count is y−m,y−m−1,y−m−2…y−1.y0.y1…ym−2⋅ym−1⋅ym°. This article uses an n-degree polynomial to fit these data (n is less than 2m + 1):(1)f˜i=∑k=0nbnkik=bn0+bn1i+bn2i2+⋯+bnnikn.According to the requirements of the nonlinear least square method, the difference between the actual observation valueyi and the polynomial calculation value fi should be the smallest, that is,(2)∂∂nnk∑i=−mm∑k=0nbnkik−yi22=0.Forbn0,(3)∂∂nn0∑i=−mmbn0+bn1i+⋯bnnin−yi22=0.For generalbni:(4)∑knbnk∑i=−mmik+r=∑i=−mmyiir.For 2m + 1 data points, a polynomial of degree n is used as the least squares fitting formula, and the general formula is derived:(5)y˜l=1Kb∑j=−mmAjAyi+j.According to formula (5), the smoothing coefficient j, A and the normalization constant b, K are calculated according to the corresponding filter. We use the Savitzky-Golay filter to obtain the coefficient calculation formula of the second or third-degree polynomial spectrum smoothing formula [19]:(6)fw,j=1w1+15w2−4w2−112−j2w=5,7…2m+1.According to formula (6), the five-point smoothing formula of cubic polynomial used in this article is given as follows [20]:(7)yi=135−3yi−2+12yi−1+17yi+12yi+1−3yi+2.According to formula (7), the table of smoothing coefficients of the third-order smoothing method at 5, 7, 9, and 11 points can be obtained as shown in Table 1.Table 1
Parameter table of least squares fitting method.
Smoothing points57911kb35.021.0231.0429.0y117.07.059.089.0yi±112.06.054.084.0yi±2−3.03.039.069.0yi±3−2.014.044.0yi±4−21.09.0yi±5−36.0The five-point smooth first derivative formula of the cubic polynomial used in this article is(8)datai′=112datai−2−8×datai−1+8×datai+1−datai+2.From the actual effect point of view, the quality of the spectral line smoothing effect also has a great influence on the peak finding results. When the spectral line is not smoothed, the peak position cannot be found at all. If the smoothing effect is not good, misidentification and missed peak identification will occur. The derivative method is effective in identifying single peaks, strong peaks, and weak peaks, but there are problems in the identification of overlapping peaks. From the sensitivity point of view, the sensitivity of the first-order peak search is the highest, and the second-order is the second. When searching for peak positions, some additional conditions are added to enhance the accuracy of peak searching. The flowchart is shown in Figure1.Figure 1
Flow chart of derivative peak finding.The additional conditions are as follows:(1)
The distance N between the two negative poles of the first derivative is between 1 time the half-height width and 4 times the half-height width(2)
The count at the peak position track value should be greater than 4(3)
It cannot be a mutation (a mutation is not allowed within a few tracks on the left and right sides of the peak)(4)
The slopes on the left and right sides of the peak position are set with corresponding thresholdsThe peak positions found by the derivative peak finding method are all integer channels. For the needs of qualitative analysis, the peak positions should be obtained more accurately. This article uses the second-order difference polynomial to accurately calculate the peak positions. First, the algorithm performs fitting at the three pointsi − 1, i, and i + 1 around the peak position i found, data=a+b×i+c×i2, and the extreme point is the peak position [21]:(9)ps=−b2c=i+12datai+1−datai−12datai−datai+1−datai−1.In actual measurement, the peak width will be different for different detectors, different total channel values, and energy intervals. Therefore, in order to make the peak search have good adaptability, for different detectors and total track values, set the corresponding peak width interval. After inputting the parameters into the software, even if the detector is changed, it can be directly measured without manual modification on-site, and the algorithm’s adaptability is enhanced. The specific parameters are shown in Table2.Table 2
Corresponding peak widths of different total channels.
Total number of channels (LaBr3 (Ce))102420484096Total number of channels (NaI (T1))5121024Energy window width16.0–72.035.0–100.049.0–170.0Energy window width15.0–60.028.0–114.0There will be deviations between the actual calculated peak position and the theoretical peak position, so an energy window needs to be set. When the energy difference between the peak position energy obtained by the peak finding and the feature peak of the piano audio feature in the piano audio feature library is less than a specific energy threshold, it is considered that the peak may belong to the retrieved corresponding piano audio feature.


### 3.2. Piano Audio Characteristic Activity Measurement

In the process of measuring piano audio feature activity, in addition to the energy emitted by the piano audio feature itself, there will also be other interference factors that affect the calculation of the piano audio feature content. In order to eliminate interference factors and improve the accuracy of calculating piano audio feature activity, a portable spectrometer is required to automatically identify and remove filter processing counts other than the full-peak area.The current background subtraction methods are mainly divided into two categories: one is the background subtraction method of the characteristic peak area: this type of method selects a section of the all-powerful peak area to be analyzed and selects the specific peak area according to the actual characteristic parameters, such as peak shape and peak width. The background subtraction method using the background subtraction method is used to calculate the background to obtain the background count and net count of each track. The other type is the background subtraction method for the whole spectrum: this method obtains the entire spectrum by calculating the background counts of all the trace values of the entire spectrum and then subtracting the corresponding background counts from the entire spectrum one by one (net count of lines). At present, most spectral analysis software adopts the background subtraction method of characteristic peak area. Combined with existing research and experimental analysis, the results shown in Figures2–4 are obtained.Figure 2
Linear filter processing.Figure 3
Step filter processing.Figure 4
Parabolic filtering processing.


#### 3.2.1. Linear Filter Processing

This method uses the coordinates of the left and right boundary track addresses of each full-wave peak or overlapping peak as parameters to fit a straight line. The counts below the straight line are treated as filtering, and the counts above are treated as net counts. The method is simple to operate. However, the quality of the boundary parameters of the peak area has a great influence on the deduction effect. In particular, the influence of Compton scattering or other rays will result in poor filtering processing deduction. The straight line is used as the baseline to deduct the filtering process, which is susceptible to other scattering effects and has poor anti-interference ability. Generally, the linear filtering process generally only has a better effect when it is used at the full peak of the single energy, as shown in Figure2.


#### 3.2.2. Step Filter Processing

If the filtering processing of the low-energy end of the full-wave peak is much higher than the filtering processing of the high-energy end, a step function can be used to represent the filtering processing count of the overlapping peaks, as shown in Figure3. The height of the steps is determined by the maximum value and minimum value of the boundary track value. The data under the step function is regarded as the filter processing count of the full-wave peak, and the above count is the net count.


#### 3.2.3. Parabolic Filtering Processing

In some cases, most of the filter processing counts are on the measured spectrum, as shown in Figure4. At this time, there will be a fast-rising filter processing in the low-energy part of the full-wave peak. The parabolic filtering process uses the least square method to fit the data, and the count calculated by the submethod is lower than the high-energy end and lower than the straight-line filtering process.


#### 3.2.4. New Filter Processing Deduction Method

This method fits the filter processing with a function, which is regarded as filter processing. Currently, the commonly used methods include SNIP filter processing method, Fourier filter processing method, wavelet transform method, and so on. The SNIP method is a widely recognized and applied method abroad.This article improves the algorithm and sets the adaptive parameters according to the voice recognition requirements used. In the filtering process and subtraction process, the natural logarithm method can get good results when the count rate is high, and the square root method can also get good results when the count rate is low. Therefore, the LIS logarithmic transformation can be performed on the spectrum, and then the filter processing can be removed by the SNIP method, and finally, the LIS inverse transformation can be performed to obtain the filter processing count. The specific steps of the SNIP algorithm are as follows:(1)
The algorithm first uses the LLS operator to transform each count of the spectrum:(10)vi=lnlnyi+1+1+1.Among them,i is the corresponding channel value, y(i) is the count corresponding to the channel value, and v is the result retention vector. This can compress the range of the count rate and, at the same time, enhance the sensitivity of weak peak recognition.(2)
The algorithm performs multiple iterations on the data and replaces the original value with the obtained value:(11)vpi=minvp−1i,12vp−1i+p+vp−1i−p,m is the total number of iterations, andp is the p-th iteration. In the p-th iteration, the algorithm takes the smallest value of vp−1i and 1/2[vp−1i+p+$$vp−1i−p as the value of vpi. Ryan performs 24 iterations on the algorithm and shrinks the window size by 1/2 in the last 8 times to eliminate possible oscillations in the results.(3)
The algorithm gets the filter processing count:(12)bi=expexpvi−12,bi represents the count of the filtering processing of the full peak.(4)
The net peak area of the full-wave peak is given as(13)ni=yi−bi.The width of the energy window isW, the number of iterations is m, and the relationship between w and m is w = 2m + 1. It can be seen that the selection of the full-wave crest boundary has a great influence on the deduction effect of the filtering process. Figure 5 shows the deduction effect of the filtering process with different iteration times. It can be seen from Figure 6 that when the number of iterations is about 0.5 w, the deduction effect is similar to linear filtering.Figure 5
SNIP filter processing deduction effect.Figure 6
Test data statistics. (a) Effect diagram of SNIP filtering processing subtraction method. (b) Linear filter processing. (c) Step filter processing.
(a)(b)(c)


### 3.3. SNIP Algorithm Improvement

This article improves the algorithm based on the original SNIP algorithm. First, the method of decreasing the width of the energy window fromm to 1 is used to iteratively calculate formula (11). Second, in selecting the number of iterations, the value of m is determined by the difference between the heights of the full-wave crests. Finally, the fourth-order filter function is used for iteration instead of the second-order filter function, as shown in formula (14):(14)a=yi;b=yi−m+yi+m2c=−yi−m+4yi−m/2+4yi+m/2−yi+m6y′i=mina,maxb,c.After comparative analysis of the measured data, it is found that selecting 1/3 of the height difference between the left and right borders of the full-wave crest is better for iteration, as shown in Figure6(a). Figures 6(b) and 6(c) show the deduction effects of linear filter processing and step filter processing.For heavy peaks (independent feature peaks), SNIP filtering processing method cannot be used to directly subtract. First, this article uses the found boundary to perform linear filter processing and subtraction and then performs Gaussian fitting on the two peaks after subtracting the filter processing count. After that, this article redetermines the boundary of the two peaks based on the fitted function and the peak position and half-height scale information of the two peaks. Finally, this article uses the SNIP filter processing subtraction method to perform filter processing subtraction to obtain the filter processing count, as shown in Figures7(a) and 7(b).Figure 7
Filter processing count. (a) Linear filter processing. (b) Redetermine the boundary for SNIP filtering processing deduction.
(a)(b)In spectrum analysis, peak area determination is the most important step of quantitative identification. This method reflects the content and activity of piano audio features by calculating the peak area count of feature peaks. Obviously, the accuracy of the peak area calculation directly affects the performance of the piano audio feature activity calculation usually. There are two types of methods for calculating peak areas. The first type is counting addition. This method only needs to select the peak area that needs to be calculated and add the counts in the peak area to get the value of the peak area. It is usually used when there is no single peak that interferes with each other. The calculation results also have corresponding accuracy. The second is called function fitting method. This method uses a function to fit the full peaks (such as Gaussian function fitting, polynomial fitting, and the like) and then integrates the fitted function to obtain the corresponding peak area and half-height width and other corresponding parameters. This method needs to be run on a computer and is usually used in the fitting analysis of heavy peaks, and the calculation results also have relatively good accuracy. For portable smart devices, too complex fitting functions cannot be used.The counting addition method can be divided into full-peak area method, Covell method, Wasson method, Sterlinski method, and Quittner method according to the difference of leakage filtering processing and boundary selection method.


#### 3.3.1. Full-Peak Area Method

This method is also called the TPA method, which uses the peak position and boundary found, adds up all counts within the left and right boundaries of the peak, and deducts the filtering process to obtain the net count. Filter processing can choose the corresponding method according to the actual situation. In the process of determining the peak area, there are various reasons that can cause errors. The error of the full-peak area method mainly comes from two aspects. First, which method is used for the filtering method to reduce the error is to be determined according to the actual spectrum. Therefore, when the computer automatically performs the filtering process, it is difficult to adaptively select the corresponding method, and there is no filtering process deduction method that can well adapt to all filtering processes. At the same time, the filtering process is not limited to the environmental filtering process, but it also includes the improvement of the filtering process caused by other high-energy interference piano audio features of the Compton platform. Therefore, this method is susceptible to the inaccuracy of the filtering processing deduction. For a single peak, this article uses this method to calculate the area of the full peak, and the method of subtracting the filtering processing uses the improved SNIP method for filtering processing subtraction, which has achieved good results. The test proves that this method is obviously better than the linear filtering processing subtraction method. The second is to count statistical errors, and the formula for statistical errors is(15)σN2=N+12L−R−1B.According to formula (15), it can be seen that the variance of the peak area is related to the full-peak area N and the filter processing count B. However, the coefficient factor of B is 0.5 (L−R−1) and the coefficient of N is 1. It can be seen that the influence of the filtering process on the error is far greater than the influence of the peak area. Therefore, it is very important to choose a good filtering method. Therefore, other methods have been developed. Although TPA has higher requirements for filter processing and deduction, it uses all pulse counts within the peak and is minimally affected by peak drift and resolution. Therefore, it is still widely used in the calculation of single peaks.


### 3.4. Full-Peak Fitting

The function fitting method uses a known function to describe the peak based on the measured peak area data and calculates all the relevant parameters in the function (such as half-height and peak height). Then, the peak area can be calculated by integration. Commonly used function fitting functions include Gaussian function fitting, least square fitting, polynomial fitting, and so on.In this article, Gaussian fitting is used to fit the full peaks of heavy peaks. The basic process is as follows:A peak can be described by a Gaussian function, that is, the relationship between each track county(x) in the peak area and the track number X is given as(16)yx=y0e−x−x0/2σ2.In the formula,x0 is the number of peak center channels, and y0 represents the peak center channel count, namely, y0=yx0. σ is a parameter describing the width of the peak distribution (root mean square error), and its relationship with the half-maximum width (FWHM) is(17)FWHM=22ln2σ=2.36σ.According to the peak information, this article first analyzes the peak to find whether it is a single peak or a heavy peak (the peak position is separated, and the peak area partially overlaps). For a single peak, the algorithm directly calculates the total peak area by counting and adding and then uses the SNIP method to subtract the filtering process to obtain the net peak area of the full peak. For heavy peaks, it is divided into the following three steps:.(1)
The overlapping peaks are first subjected to linear filtering processing to subtract, and the count of the peak area is obtained. The linear filter processing deduction is shown in Figure8(a).(2)
The algorithm performs Gaussian fitting on the two peaks deducted from the linear filtering process. The peak fitting method on the left is Gaussian fitting using the noncoincident part on the left side of the peak position. Similarly, the peak on the right is also Gaussian fitting using the noncoincident part on the right of the peak. After that, the algorithm uses the FWHM scale function to find the FWHM of the peak and uses the FWHM and the peak position track value to redetermine the left and right boundaries of the peak, as shown in Figure8(b).(3)
The algorithm uses the redetermined boundary to perform SNIP filtering processing deduction, and then, it uses the fitted total count to subtract the filtering processing count to obtain the net count of the full peak.Figure 8
Value determination. (a) Straight-line filter processing deduction. (b) Heavy peak fitting and filtering processing.
(a)(b)


## 3.1. Linear Smoothing of Filter Data

The polynomial least-squares fitting method uses a polynomial of degreen and 2m + 1 data points to perform smooth fitting section by section to achieve the purpose of smoothness. This method takes each data of the γ-wave spectrum original data as the center and takes m data (total 2 m + 1) to the left and right sides for smoothing. The corresponding data channel value coordinate is −m.−m+1.−m+2…−1.0.1…m−2.m−1.m, and the corresponding channel value count is y−m,y−m−1,y−m−2…y−1.y0.y1…ym−2⋅ym−1⋅ym°. This article uses an n-degree polynomial to fit these data (n is less than 2m + 1):(1)f˜i=∑k=0nbnkik=bn0+bn1i+bn2i2+⋯+bnnikn.According to the requirements of the nonlinear least square method, the difference between the actual observation valueyi and the polynomial calculation value fi should be the smallest, that is,(2)∂∂nnk∑i=−mm∑k=0nbnkik−yi22=0.Forbn0,(3)∂∂nn0∑i=−mmbn0+bn1i+⋯bnnin−yi22=0.For generalbni:(4)∑knbnk∑i=−mmik+r=∑i=−mmyiir.For 2m + 1 data points, a polynomial of degree n is used as the least squares fitting formula, and the general formula is derived:(5)y˜l=1Kb∑j=−mmAjAyi+j.According to formula (5), the smoothing coefficient j, A and the normalization constant b, K are calculated according to the corresponding filter. We use the Savitzky-Golay filter to obtain the coefficient calculation formula of the second or third-degree polynomial spectrum smoothing formula [19]:(6)fw,j=1w1+15w2−4w2−112−j2w=5,7…2m+1.According to formula (6), the five-point smoothing formula of cubic polynomial used in this article is given as follows [20]:(7)yi=135−3yi−2+12yi−1+17yi+12yi+1−3yi+2.According to formula (7), the table of smoothing coefficients of the third-order smoothing method at 5, 7, 9, and 11 points can be obtained as shown in Table 1.Table 1
Parameter table of least squares fitting method.
Smoothing points57911kb35.021.0231.0429.0y117.07.059.089.0yi±112.06.054.084.0yi±2−3.03.039.069.0yi±3−2.014.044.0yi±4−21.09.0yi±5−36.0The five-point smooth first derivative formula of the cubic polynomial used in this article is(8)datai′=112datai−2−8×datai−1+8×datai+1−datai+2.From the actual effect point of view, the quality of the spectral line smoothing effect also has a great influence on the peak finding results. When the spectral line is not smoothed, the peak position cannot be found at all. If the smoothing effect is not good, misidentification and missed peak identification will occur. The derivative method is effective in identifying single peaks, strong peaks, and weak peaks, but there are problems in the identification of overlapping peaks. From the sensitivity point of view, the sensitivity of the first-order peak search is the highest, and the second-order is the second. When searching for peak positions, some additional conditions are added to enhance the accuracy of peak searching. The flowchart is shown in Figure1.Figure 1
Flow chart of derivative peak finding.The additional conditions are as follows:(1)
The distance N between the two negative poles of the first derivative is between 1 time the half-height width and 4 times the half-height width(2)
The count at the peak position track value should be greater than 4(3)
It cannot be a mutation (a mutation is not allowed within a few tracks on the left and right sides of the peak)(4)
The slopes on the left and right sides of the peak position are set with corresponding thresholdsThe peak positions found by the derivative peak finding method are all integer channels. For the needs of qualitative analysis, the peak positions should be obtained more accurately. This article uses the second-order difference polynomial to accurately calculate the peak positions. First, the algorithm performs fitting at the three pointsi − 1, i, and i + 1 around the peak position i found, data=a+b×i+c×i2, and the extreme point is the peak position [21]:(9)ps=−b2c=i+12datai+1−datai−12datai−datai+1−datai−1.In actual measurement, the peak width will be different for different detectors, different total channel values, and energy intervals. Therefore, in order to make the peak search have good adaptability, for different detectors and total track values, set the corresponding peak width interval. After inputting the parameters into the software, even if the detector is changed, it can be directly measured without manual modification on-site, and the algorithm’s adaptability is enhanced. The specific parameters are shown in Table2.Table 2
Corresponding peak widths of different total channels.
Total number of channels (LaBr3 (Ce))102420484096Total number of channels (NaI (T1))5121024Energy window width16.0–72.035.0–100.049.0–170.0Energy window width15.0–60.028.0–114.0There will be deviations between the actual calculated peak position and the theoretical peak position, so an energy window needs to be set. When the energy difference between the peak position energy obtained by the peak finding and the feature peak of the piano audio feature in the piano audio feature library is less than a specific energy threshold, it is considered that the peak may belong to the retrieved corresponding piano audio feature.


## 3.2. Piano Audio Characteristic Activity Measurement

In the process of measuring piano audio feature activity, in addition to the energy emitted by the piano audio feature itself, there will also be other interference factors that affect the calculation of the piano audio feature content. In order to eliminate interference factors and improve the accuracy of calculating piano audio feature activity, a portable spectrometer is required to automatically identify and remove filter processing counts other than the full-peak area.The current background subtraction methods are mainly divided into two categories: one is the background subtraction method of the characteristic peak area: this type of method selects a section of the all-powerful peak area to be analyzed and selects the specific peak area according to the actual characteristic parameters, such as peak shape and peak width. The background subtraction method using the background subtraction method is used to calculate the background to obtain the background count and net count of each track. The other type is the background subtraction method for the whole spectrum: this method obtains the entire spectrum by calculating the background counts of all the trace values of the entire spectrum and then subtracting the corresponding background counts from the entire spectrum one by one (net count of lines). At present, most spectral analysis software adopts the background subtraction method of characteristic peak area. Combined with existing research and experimental analysis, the results shown in Figures2–4 are obtained.Figure 2
Linear filter processing.Figure 3
Step filter processing.Figure 4
Parabolic filtering processing.


### 3.2.1. Linear Filter Processing

This method uses the coordinates of the left and right boundary track addresses of each full-wave peak or overlapping peak as parameters to fit a straight line. The counts below the straight line are treated as filtering, and the counts above are treated as net counts. The method is simple to operate. However, the quality of the boundary parameters of the peak area has a great influence on the deduction effect. In particular, the influence of Compton scattering or other rays will result in poor filtering processing deduction. The straight line is used as the baseline to deduct the filtering process, which is susceptible to other scattering effects and has poor anti-interference ability. Generally, the linear filtering process generally only has a better effect when it is used at the full peak of the single energy, as shown in Figure2.


### 3.2.2. Step Filter Processing

If the filtering processing of the low-energy end of the full-wave peak is much higher than the filtering processing of the high-energy end, a step function can be used to represent the filtering processing count of the overlapping peaks, as shown in Figure3. The height of the steps is determined by the maximum value and minimum value of the boundary track value. The data under the step function is regarded as the filter processing count of the full-wave peak, and the above count is the net count.


### 3.2.3. Parabolic Filtering Processing

In some cases, most of the filter processing counts are on the measured spectrum, as shown in Figure4. At this time, there will be a fast-rising filter processing in the low-energy part of the full-wave peak. The parabolic filtering process uses the least square method to fit the data, and the count calculated by the submethod is lower than the high-energy end and lower than the straight-line filtering process.


### 3.2.4. New Filter Processing Deduction Method

This method fits the filter processing with a function, which is regarded as filter processing. Currently, the commonly used methods include SNIP filter processing method, Fourier filter processing method, wavelet transform method, and so on. The SNIP method is a widely recognized and applied method abroad.This article improves the algorithm and sets the adaptive parameters according to the voice recognition requirements used. In the filtering process and subtraction process, the natural logarithm method can get good results when the count rate is high, and the square root method can also get good results when the count rate is low. Therefore, the LIS logarithmic transformation can be performed on the spectrum, and then the filter processing can be removed by the SNIP method, and finally, the LIS inverse transformation can be performed to obtain the filter processing count. The specific steps of the SNIP algorithm are as follows:(1)
The algorithm first uses the LLS operator to transform each count of the spectrum:(10)vi=lnlnyi+1+1+1.Among them,i is the corresponding channel value, y(i) is the count corresponding to the channel value, and v is the result retention vector. This can compress the range of the count rate and, at the same time, enhance the sensitivity of weak peak recognition.(2)
The algorithm performs multiple iterations on the data and replaces the original value with the obtained value:(11)vpi=minvp−1i,12vp−1i+p+vp−1i−p,m is the total number of iterations, andp is the p-th iteration. In the p-th iteration, the algorithm takes the smallest value of vp−1i and 1/2[vp−1i+p+$$vp−1i−p as the value of vpi. Ryan performs 24 iterations on the algorithm and shrinks the window size by 1/2 in the last 8 times to eliminate possible oscillations in the results.(3)
The algorithm gets the filter processing count:(12)bi=expexpvi−12,bi represents the count of the filtering processing of the full peak.(4)
The net peak area of the full-wave peak is given as(13)ni=yi−bi.The width of the energy window isW, the number of iterations is m, and the relationship between w and m is w = 2m + 1. It can be seen that the selection of the full-wave crest boundary has a great influence on the deduction effect of the filtering process. Figure 5 shows the deduction effect of the filtering process with different iteration times. It can be seen from Figure 6 that when the number of iterations is about 0.5 w, the deduction effect is similar to linear filtering.Figure 5
SNIP filter processing deduction effect.Figure 6
Test data statistics. (a) Effect diagram of SNIP filtering processing subtraction method. (b) Linear filter processing. (c) Step filter processing.
(a)(b)(c)


## 3.2.1. Linear Filter Processing

This method uses the coordinates of the left and right boundary track addresses of each full-wave peak or overlapping peak as parameters to fit a straight line. The counts below the straight line are treated as filtering, and the counts above are treated as net counts. The method is simple to operate. However, the quality of the boundary parameters of the peak area has a great influence on the deduction effect. In particular, the influence of Compton scattering or other rays will result in poor filtering processing deduction. The straight line is used as the baseline to deduct the filtering process, which is susceptible to other scattering effects and has poor anti-interference ability. Generally, the linear filtering process generally only has a better effect when it is used at the full peak of the single energy, as shown in Figure2.


## 3.2.2. Step Filter Processing

If the filtering processing of the low-energy end of the full-wave peak is much higher than the filtering processing of the high-energy end, a step function can be used to represent the filtering processing count of the overlapping peaks, as shown in Figure3. The height of the steps is determined by the maximum value and minimum value of the boundary track value. The data under the step function is regarded as the filter processing count of the full-wave peak, and the above count is the net count.


## 3.2.3. Parabolic Filtering Processing

In some cases, most of the filter processing counts are on the measured spectrum, as shown in Figure4. At this time, there will be a fast-rising filter processing in the low-energy part of the full-wave peak. The parabolic filtering process uses the least square method to fit the data, and the count calculated by the submethod is lower than the high-energy end and lower than the straight-line filtering process.


## 3.2.4. New Filter Processing Deduction Method

This method fits the filter processing with a function, which is regarded as filter processing. Currently, the commonly used methods include SNIP filter processing method, Fourier filter processing method, wavelet transform method, and so on. The SNIP method is a widely recognized and applied method abroad.This article improves the algorithm and sets the adaptive parameters according to the voice recognition requirements used. In the filtering process and subtraction process, the natural logarithm method can get good results when the count rate is high, and the square root method can also get good results when the count rate is low. Therefore, the LIS logarithmic transformation can be performed on the spectrum, and then the filter processing can be removed by the SNIP method, and finally, the LIS inverse transformation can be performed to obtain the filter processing count. The specific steps of the SNIP algorithm are as follows:(1)
The algorithm first uses the LLS operator to transform each count of the spectrum:(10)vi=lnlnyi+1+1+1.Among them,i is the corresponding channel value, y(i) is the count corresponding to the channel value, and v is the result retention vector. This can compress the range of the count rate and, at the same time, enhance the sensitivity of weak peak recognition.(2)
The algorithm performs multiple iterations on the data and replaces the original value with the obtained value:(11)vpi=minvp−1i,12vp−1i+p+vp−1i−p,m is the total number of iterations, andp is the p-th iteration. In the p-th iteration, the algorithm takes the smallest value of vp−1i and 1/2[vp−1i+p+$$vp−1i−p as the value of vpi. Ryan performs 24 iterations on the algorithm and shrinks the window size by 1/2 in the last 8 times to eliminate possible oscillations in the results.(3)
The algorithm gets the filter processing count:(12)bi=expexpvi−12,bi represents the count of the filtering processing of the full peak.(4)
The net peak area of the full-wave peak is given as(13)ni=yi−bi.The width of the energy window isW, the number of iterations is m, and the relationship between w and m is w = 2m + 1. It can be seen that the selection of the full-wave crest boundary has a great influence on the deduction effect of the filtering process. Figure 5 shows the deduction effect of the filtering process with different iteration times. It can be seen from Figure 6 that when the number of iterations is about 0.5 w, the deduction effect is similar to linear filtering.Figure 5
SNIP filter processing deduction effect.Figure 6
Test data statistics. (a) Effect diagram of SNIP filtering processing subtraction method. (b) Linear filter processing. (c) Step filter processing.
(a)(b)(c)


## 3.3. SNIP Algorithm Improvement

This article improves the algorithm based on the original SNIP algorithm. First, the method of decreasing the width of the energy window fromm to 1 is used to iteratively calculate formula (11). Second, in selecting the number of iterations, the value of m is determined by the difference between the heights of the full-wave crests. Finally, the fourth-order filter function is used for iteration instead of the second-order filter function, as shown in formula (14):(14)a=yi;b=yi−m+yi+m2c=−yi−m+4yi−m/2+4yi+m/2−yi+m6y′i=mina,maxb,c.After comparative analysis of the measured data, it is found that selecting 1/3 of the height difference between the left and right borders of the full-wave crest is better for iteration, as shown in Figure6(a). Figures 6(b) and 6(c) show the deduction effects of linear filter processing and step filter processing.For heavy peaks (independent feature peaks), SNIP filtering processing method cannot be used to directly subtract. First, this article uses the found boundary to perform linear filter processing and subtraction and then performs Gaussian fitting on the two peaks after subtracting the filter processing count. After that, this article redetermines the boundary of the two peaks based on the fitted function and the peak position and half-height scale information of the two peaks. Finally, this article uses the SNIP filter processing subtraction method to perform filter processing subtraction to obtain the filter processing count, as shown in Figures7(a) and 7(b).Figure 7
Filter processing count. (a) Linear filter processing. (b) Redetermine the boundary for SNIP filtering processing deduction.
(a)(b)In spectrum analysis, peak area determination is the most important step of quantitative identification. This method reflects the content and activity of piano audio features by calculating the peak area count of feature peaks. Obviously, the accuracy of the peak area calculation directly affects the performance of the piano audio feature activity calculation usually. There are two types of methods for calculating peak areas. The first type is counting addition. This method only needs to select the peak area that needs to be calculated and add the counts in the peak area to get the value of the peak area. It is usually used when there is no single peak that interferes with each other. The calculation results also have corresponding accuracy. The second is called function fitting method. This method uses a function to fit the full peaks (such as Gaussian function fitting, polynomial fitting, and the like) and then integrates the fitted function to obtain the corresponding peak area and half-height width and other corresponding parameters. This method needs to be run on a computer and is usually used in the fitting analysis of heavy peaks, and the calculation results also have relatively good accuracy. For portable smart devices, too complex fitting functions cannot be used.The counting addition method can be divided into full-peak area method, Covell method, Wasson method, Sterlinski method, and Quittner method according to the difference of leakage filtering processing and boundary selection method.


### 3.3.1. Full-Peak Area Method

This method is also called the TPA method, which uses the peak position and boundary found, adds up all counts within the left and right boundaries of the peak, and deducts the filtering process to obtain the net count. Filter processing can choose the corresponding method according to the actual situation. In the process of determining the peak area, there are various reasons that can cause errors. The error of the full-peak area method mainly comes from two aspects. First, which method is used for the filtering method to reduce the error is to be determined according to the actual spectrum. Therefore, when the computer automatically performs the filtering process, it is difficult to adaptively select the corresponding method, and there is no filtering process deduction method that can well adapt to all filtering processes. At the same time, the filtering process is not limited to the environmental filtering process, but it also includes the improvement of the filtering process caused by other high-energy interference piano audio features of the Compton platform. Therefore, this method is susceptible to the inaccuracy of the filtering processing deduction. For a single peak, this article uses this method to calculate the area of the full peak, and the method of subtracting the filtering processing uses the improved SNIP method for filtering processing subtraction, which has achieved good results. The test proves that this method is obviously better than the linear filtering processing subtraction method. The second is to count statistical errors, and the formula for statistical errors is(15)σN2=N+12L−R−1B.According to formula (15), it can be seen that the variance of the peak area is related to the full-peak area N and the filter processing count B. However, the coefficient factor of B is 0.5 (L−R−1) and the coefficient of N is 1. It can be seen that the influence of the filtering process on the error is far greater than the influence of the peak area. Therefore, it is very important to choose a good filtering method. Therefore, other methods have been developed. Although TPA has higher requirements for filter processing and deduction, it uses all pulse counts within the peak and is minimally affected by peak drift and resolution. Therefore, it is still widely used in the calculation of single peaks.


## 3.3.1. Full-Peak Area Method

This method is also called the TPA method, which uses the peak position and boundary found, adds up all counts within the left and right boundaries of the peak, and deducts the filtering process to obtain the net count. Filter processing can choose the corresponding method according to the actual situation. In the process of determining the peak area, there are various reasons that can cause errors. The error of the full-peak area method mainly comes from two aspects. First, which method is used for the filtering method to reduce the error is to be determined according to the actual spectrum. Therefore, when the computer automatically performs the filtering process, it is difficult to adaptively select the corresponding method, and there is no filtering process deduction method that can well adapt to all filtering processes. At the same time, the filtering process is not limited to the environmental filtering process, but it also includes the improvement of the filtering process caused by other high-energy interference piano audio features of the Compton platform. Therefore, this method is susceptible to the inaccuracy of the filtering processing deduction. For a single peak, this article uses this method to calculate the area of the full peak, and the method of subtracting the filtering processing uses the improved SNIP method for filtering processing subtraction, which has achieved good results. The test proves that this method is obviously better than the linear filtering processing subtraction method. The second is to count statistical errors, and the formula for statistical errors is(15)σN2=N+12L−R−1B.According to formula (15), it can be seen that the variance of the peak area is related to the full-peak area N and the filter processing count B. However, the coefficient factor of B is 0.5 (L−R−1) and the coefficient of N is 1. It can be seen that the influence of the filtering process on the error is far greater than the influence of the peak area. Therefore, it is very important to choose a good filtering method. Therefore, other methods have been developed. Although TPA has higher requirements for filter processing and deduction, it uses all pulse counts within the peak and is minimally affected by peak drift and resolution. Therefore, it is still widely used in the calculation of single peaks.


## 3.4. Full-Peak Fitting

The function fitting method uses a known function to describe the peak based on the measured peak area data and calculates all the relevant parameters in the function (such as half-height and peak height). Then, the peak area can be calculated by integration. Commonly used function fitting functions include Gaussian function fitting, least square fitting, polynomial fitting, and so on.In this article, Gaussian fitting is used to fit the full peaks of heavy peaks. The basic process is as follows:A peak can be described by a Gaussian function, that is, the relationship between each track county(x) in the peak area and the track number X is given as(16)yx=y0e−x−x0/2σ2.In the formula,x0 is the number of peak center channels, and y0 represents the peak center channel count, namely, y0=yx0. σ is a parameter describing the width of the peak distribution (root mean square error), and its relationship with the half-maximum width (FWHM) is(17)FWHM=22ln2σ=2.36σ.According to the peak information, this article first analyzes the peak to find whether it is a single peak or a heavy peak (the peak position is separated, and the peak area partially overlaps). For a single peak, the algorithm directly calculates the total peak area by counting and adding and then uses the SNIP method to subtract the filtering process to obtain the net peak area of the full peak. For heavy peaks, it is divided into the following three steps:.(1)
The overlapping peaks are first subjected to linear filtering processing to subtract, and the count of the peak area is obtained. The linear filter processing deduction is shown in Figure8(a).(2)
The algorithm performs Gaussian fitting on the two peaks deducted from the linear filtering process. The peak fitting method on the left is Gaussian fitting using the noncoincident part on the left side of the peak position. Similarly, the peak on the right is also Gaussian fitting using the noncoincident part on the right of the peak. After that, the algorithm uses the FWHM scale function to find the FWHM of the peak and uses the FWHM and the peak position track value to redetermine the left and right boundaries of the peak, as shown in Figure8(b).(3)
The algorithm uses the redetermined boundary to perform SNIP filtering processing deduction, and then, it uses the fitted total count to subtract the filtering processing count to obtain the net count of the full peak.Figure 8
Value determination. (a) Straight-line filter processing deduction. (b) Heavy peak fitting and filtering processing.
(a)(b)


## 4. Recognition and Error Correction of Piano Playing Features Based on Filtering Technology

The system in this article is implemented on the Matlab platform. This article combines the previous algorithm to identify the features of piano playing and builds an intelligent piano-assisted practice error correction system. As shown in Figure9, the overall architecture of the system consists of three parts. The first one is the web backend, including business logic code, object storage, database, and the like. The second part is the web front end, including the page displayed on the WeChat official account and the page displayed on the PC. The third part is the iPad client, and performance-related services are implemented in this part.Figure 9
System overall architecture.With the support of filtering technology, the system can realize the feature recognition and error correction of piano playing. This article conducts experimental research on the system constructed, and studies the difference between keystrokes and keystrokes. From experience, the difference between keystrokes and keystrokes basically does not exist. Therefore, there is no difference between the two settings, and on this basis, the waveform processing is carried out through the system of this study. The frequency spectrum of “hit the key “and “press the key” is shown in Figure10.Figure 10
The frequency spectrum of “hit the key” and “press the key”.On the basis of the above research, the piano playing feature recognition and error correction effect evaluation of the system constructed are carried out through experimental analysis of multiple sets of playing. The research content of this article is compared with the literature [3], and the results are shown in Tables 1 and 2, and the results are shown in Tables 3 and 4.Table 3
Piano playing feature recognition and error correction effect evaluation.
NumberThe method of this paperThe method of literature [3]NumberThe method of this paperThe method of literature [3]182.9080.072786.0877.90280.7572.382881.0976.24388.2782.822984.3780.01480.5878.613090.4889.26581.7170.183182.0071.18688.2478.753282.8971.95780.1677.733390.0982.13890.7588.703492.1087.69991.2285.613585.9583.771085.8078.823688.5387.441191.8978.713787.9886.151279.5072.803884.5077.421389.4088.743992.6192.551485.6280.854086.4980.321582.5875.544192.4782.311690.6187.234290.4488.241790.4788.164381.2776.761886.3576.214484.7383.871986.5982.644586.3678.632088.0082.194683.1178.752182.8577.344786.6477.042284.9978.664890.5680.012380.9073.174980.7371.852479.1876.055081.5471.722592.8182.815184.8479.432685.1482.665289.3778.95Table 4
Error correction effect evaluation.
NumberThe method of this paperThe method of literature [3]NumberThe method of this paperThe method of literature [3]181.9770.312787.3179.53279.0370.692878.8073.18379.0670.552988.1881.78475.8365.673074.8667.64574.8071.553174.9770.68678.9270.373286.1176.11789.9287.513374.6266.45872.8472.313484.2081.69988.4576.323577.6376.311077.0969.743672.5566.801183.0577.293789.2278.931276.9575.323888.0176.931381.2673.563985.2483.591482.8273.324078.1471.211573.0667.634175.3575.161687.1581.534281.7880.681789.5377.694384.2572.411872.3569.214475.7768.121980.0678.784573.3170.882085.0178.654685.6481.702178.7067.054779.1676.702283.1681.804873.2662.752375.7375.134980.7879.632487.4581.265077.3969.942572.0668.335176.5066.662679.9375.305284.9581.26From the above research, it can be seen that the piano playing feature recognition and error correction system based on filter processing technology proposed in this study has good results, so the system can be used as an aid in subsequent piano playing.


## 5. Conclusion

An isolated note and a chord cannot make up music, but when multiple notes are combined, they can show a beautiful piece of music in a certain rhythm. The good or bad grasp of factors such as tone, chord, melody, and so on when playing has become the basis for judging whether a piece of music is good to hear. The features of piano performance directly reflect the emotional features of music. Today, with the rapid development of information technology, the type and amount of information that people obtain is advancing by leaps and bounds. As the main carrier of current information, multimedia technology has attracted more and more attention. Audio is one of the important forms of multimedia information. Through the recognition of piano performance characteristics, the effective recognition of piano practitioners’ playing effects can be realized, and errors can be recorded and corrected. Moreover, this intelligent method can effectively enhance the effect of piano playing. Therefore, this article combines the filter processing technology to carry out the research on the recognition of piano playing characteristics and builds an intelligent error correction system to improve the effect of piano practice and piano performance.



---

*Source: 6382743-2022-03-23.xml*