# Digital Music Waveform Analysis and Retrieval Based on Feature Extraction Algorithm

Authors: Yang Jiao
Journal: Advances in Multimedia
 (2021)

---

## Abstract

In order to improve the feature extraction effect of digital music and improve the efficiency of music retrieval, this paper combines digital technology to analyze music waveforms, extract music features, and realize digital processing of music features. Taking the extraction of waveform music file features as the starting point, this paper combines the digital music feature extraction algorithm to build a music feature extraction model and conducts an in-depth analysis of the digital music waveform extraction process. In addition, by setting the threshold, the linear difference between the sampling points on both sides of the threshold on the leading edge of the waveform is used to obtain the overthreshold time. From the experimental research results, it can be seen that the music feature extraction model based on digital music waveform analysis proposed in this paper has good results.


---

## Body

## 1. Introduction

The so-called separation of sound control refers to the design idea of the separation of sound generation equipment and control software. The task of producing sound is handed over to mature commercial hardware or software, while tasks such as the collection and mapping of interactive device information are handed over to an independent control carrier specially designed for the work. This control carrier may be an independent executable program, a plug-in, or a programmed microcontroller. The purpose of the separation of sound control is to maximize the convenience of the repeated performance of the work, the stability during the real-time performance, and the flexibility in the re-creation of the work.The idea of independently running software to control a hardware synthesizer. In this way of thinking, there is a computer-running-independent control software specially written for the work to complete tasks such as the collection of converter information, data mapping, and data transmission. The so-called independent running software refers to a completely independent executable program. It does not rely on other operating environments to open, the function is single, and the user interface is simple. The idea is to remove all the unnecessary elements of the work and completely serve the normal performance of the work.This design idea can be considered from the perspective of improving work stability. The advantage of this idea is that it can use the mature finished software synthesizer as the controlled target. While the stability of sound generation is ensured, the various control settings required by the work are concentrated into one plug-in and used at the same time. The feature of the host program in the mapping function is to control the software synthesizer inside the host software in real time through this independent plug-in. This is a way to avoid going deep into the bottom of the control because the programming of the software synthesizer itself and the mapping function design of the host software itself are programmed and tested by specialized developers, which will cost the creators to find program vulnerabilities. The time has been shortened to a minimum. The advantage of independently running software to control the hardware synthesizer is that it can use the mature finished software synthesizer as the controlled target.In order to record colorful music, people have invented various music storage media, and various music processing technologies have also emerged at the historic moment. In the era of analog audio processing technology, audio processing mainly relied on various professional equipment for processing, and audio mixing, delay, and change were all done through various equipment. Since the amplification, filtering, delay, and other circuits of various devices may introduce new noise and audio distortion, and the cost of these devices is very expensive, this affects the development of analog audio technology to some extent [1]. With the rapid development of computer technology, computer-centric information processing plays an increasingly important role, and digital audio processing technology has also been rapidly developed. Different from the analog audio processing technology, the digital audio processing technology transforms the analog signal into a series of digital signals to be stored and transmitted after discretization in time and quantization in amplitude [2]. When the audio signal becomes digital, all processing is actually a digital processing. At this time, the theory and various algorithms based on digital signal processing can be implemented on a computer through software. The realization method based on computer software has the advantages of low cost and flexible processing method. In this method, a computer with a sound card and audio processing software can do various processing, and it can be repeatedly modified and processed multiple times. However, with the continuous improvement of computer processing power, its non-real-time shortcomings have gradually been overcome [3].This paper combines digital technology to analyze music waveforms, extracts music features, realizes the digital processing of music features, and combines experimental research to verify the performance of the method proposed in this paper, so as to improve the efficiency of music digital processing.


## 2. Related Work

The literature [4] established a Gaussian density function model for each pure tone and its harmonics. The literature [5] proposed a new algorithm for extracting the fundamental frequency of the main melody in multivoice music. The literature [6] systematically studied the theory of sound source identification and separation and sought to find a way to convert multivoice music into single-voice music through the separation of music signals in order to finally realize automatic music labeling. Automatic music labeling and its core technology multibase frequency estimation have broad application prospects, such as music retrieval based on semantic content, and sound signal separation. Musicians or music synthesizer software can also reproduce or improve original music works according to the results of music annotations, so it is a very meaningful research work. However, this is also the most difficult job in the field of music analysis. Therefore, although a large number of researchers have done a lot of work in this area, the research results in this field are still very immature, and there is still a long way to go.People have reflected on music analysis methods, such as automatic music labeling. Since a person with professional music training may not be able to easily label the music he hears as a sequence of notes, then we have to make a specific approach to music in reality. Is the automatic labeling system of voice music (in fact, most of the music in reality is multivoice music and very few single-voice music) is too high and far-reaching? If we analyze the process of ordinary people’s appreciation of music, we will find that, in fact, we do not need to translate all the notes we hear in order to appreciate music. We are most likely to directly start from the musical semantics such as melody, tonality, structure, rhythm, timbre, and chord. The above factors directly feel the music. It is based on these reflections that people began to seek to start from the perspective of ordinary music listeners, try to bypass the step of note labeling, and directly conduct music analysis and retrieval from the perspective of musical semantics. The results of these attempts are encouraging. Literature [7] extracts a feature called Beat Spectrum from audio features to search for similar music. Using the degree of beat spectrum similarity, you can retrieve music from the database that are similar to the audio music input by the user in terms of rhythm characteristics. Or, according to the similarity of scores, the music in the database is sorted to automatically generate a playback sequence table of music so that music with similar styles can be played continuously. There are others that analyze music from the beat and rhythm, such as the literature [8] using beat detection to do chord detection. Literature [9] studied music analysis from the perspective of beats and made useful explorations. In terms of musical structure, literature [10] explored a new method of using the long-term structure of music to retrieve music. In terms of music abstracts, literature [11] proposed a music abstract algorithm based on Chroma feature representation and proposed an algorithm to extract chorus in music. Literature [12] proposed some algorithms for pattern discovery in music. Literature [13] studies music abstracts from the perspective of extracting key phrases. Literature [14] further proposes an algorithm for extracting music abstracts and chorus segments (chorus) using the results of structural analysis by analyzing the hierarchical structure of music signals. Literature [15] studies music abstracts from the self-similarity analysis of music signals. Literature [16] proposed music clustering based on similarity analysis of music content and tried to apply it to the automatic generation of playlists of music playback software. Due to the importance of music similarity measurement to the above various studies, literature [17] systematically studied the problem of music similarity measurement. Literature [18] further proposed methods of real-time music understanding based on various music scene recognition research.


## 3. Music Wave Feature Extraction Based on Digital Technology

The easiest way to extract time information from a waveform is to perform voltage discrimination on the leading edge of the waveform. For the quantized discrete waveform, as shown in Figure1(a), the threshold can be set by using the sampling points on both sides of the threshold on the leading edge of the waveform to make a linear difference to obtain the threshold time. At the same time, the voltage noise on the sampling point will cause the deviation of the time measurement, as shown in Figure 1(b). If it is assumed that the amplitude of the signal is U, the rise time of the signal is tr, the voltage noise at the sampling point is Δu, and the resulting uncertainty of the overshoot time is Δt; Δt can be expressed as [19](1)ΔuΔt=Utr.Figure 1
Schematic diagram of time accuracy calculation. (a) Ideal situation. (b) Voltage noise. (c) Multiple sampling points on the leading edge.
(a)(b)(c)If the sampling rate is high enough, as shown in Figure1(c), there are n sampling points on the leading edge of the waveform, we can first fit these n sampling points, and then use the fitted waveform to calculate the dead time. Because the noise voltage at each sampling point can be considered uncorrelated, the time uncertainty can be reduced to 1/n times (only for linear fitting). At the same time, because for a waveform with a fixed leading edge time, the number of sampling points on the leading edge is determined by the sampling frequency, and the number of sampling points n can be roughly expressed as the product of the sampling frequency fs and the rise time tr; Δt can be expressed as [20](2)Δt=ΔuU⋅tr⋅1n=ΔuUtrtr⋅fs=ΔuU⋅trfs.It can be seen from formula (2) that the time measurement accuracy is determined by the sampling rate, signal rise time, and signal-to-noise ratio (SNR). The higher the sampling rate, the larger the SNR, and the shorter the rise time, the higher the time measurement accuracy.For very fast signals, the rise time of the signal received by the final chip is limited by the input analog bandwidth of the chip, and the approximate relationship between the two is(3)tr≅13f3dB.We can get the following by putting it into formula (2):(4)Δt=ΔuU⋅trfs=ΔuU13fs⋅f3dB.Formula (4) shows the relationship between the time-view accuracy and voltage noise, sampling rate, and input analog bandwidth. It should be noted that formula (4) is only an approximate deduction under a relatively simple model, and the actual measurement accuracy will also be affected by factors, such as waveform shape and noise spectrum. However, it is still a very effective method of evaluation, and it has also undergone a lot of practical verification.After that, we aim at the goal of 10 ps time measurement accuracy and determine the various index parameters. Most high-time-resolution detectors are based on MRPC and MCP-PMT. The output signal rise time is within 1 ns and is attenuated by preamplifiers and transmission lines. The signal rise time to the front-end electronics module is about 1 ns. The estimated relationship between signal rise time and bandwidth is as follows:(5)f3dB=0.35tr.Therefore, the SCA ASIC bandwidth needs to be greater than 350 MHz, and the design target is set at 400 MHz. At present, the sampling rate of existing SCA ASICs is mostly concentrated within 5 Gsps, and it samples smaller process ASICs, such as PSEC4, which can reach more than 10 Gsps. However, the swing of the analog signal, leakage current, and other factors are taken into consideration, and the mainstream process used in the SCAASIC design is still 180 nm and above. Therefore, in this design, the 180 nm process will also be used for the SCA ASIC design, and the sampling rate is determined to be up to 5 Gsps, which also meets the requirement of sampling at least 4 to 5 points on the leading edge of the waveform. In order to meet the needs of different applications, the sampling rate is designed to be adjustable from 1 to 5 Gsps.The prerequisite for achieving high analog bandwidth is a detailed analysis of the limiting factors of analog bandwidth. First of all, the core circuit of SCA is a sampling unit circuit, and its structure is generally a sampling switch in series with a storage capacitor. The bandwidth of this part is equivalent to the bandwidth of an RC circuit, which can be expressed as(6)f3dB=12πRonCH.Among them,Ron is the on-resistance of the switch, and CH is the storage capacitor. If Ron is less than 500 Ω, CH is less than 200 fF. In this way, an analog bandwidth of more than 1.5 GHz can be achieved, which has far exceeded the general application requirements. It can be seen that the simple sampling circuit is not the main factor that restricts the analog bandwidth of the SCA chip.In addition to the sampling circuit, the bandwidth of the chip is more affected by various parasitic parameters and the size of the sampling window. For example, in the IO model (GF0.18 IB_IOPANALOG) in Chartered 0.18μm CMOS process (as shown in Figure 2), R1 is about 0.3 Ω, and C1 is about 4.5 pF. In addition, coupled with various parasitic capacitances such as package pins and off-chip PCB traces, the total input capacitance is about 10 pF or more, which will become an important factor that limits the input analog bandwidth.Figure 2
Chip Pad parasitic model.Another factor that has a greater impact on bandwidth is the parasitic parameters of the input bus. Because the switch of each sampling unit in the channel is connected to the input bus, it will contribute to parasitic capacitance. The input bus itself also has parasitic resistance and parasitic capacitance. The equivalent parasitic resistance-capacitance network is shown in Figure3. This will make the bandwidth of the sampling unit farther from the input port lower, which will eventually lead to distortion of the sampling waveform. Therefore, the parasitic effects should be reduced as much as possible in the design.Figure 3
Chip Pad parasitic model.In addition, the size of the sampling window has a great influence on the bandwidth. The larger the sampling window, the more storage capacitors connected to the input bus at the same time and the greater the capacitive load of the bus. Intuitively, increasing the analog bandwidth only needs to reduce the switch size, reduce the storage capacitor, and reduce the sampling window at the same time. However, these measures will lead to a decrease in sampling accuracy. Therefore, it is necessary to construct a more accurate analog bandwidth calculation model during actual design. Through parameter extraction, simulation optimization, and comprehensive consideration, the final circuit parameters are determined.The speed of a switched capacitor circuit can be characterized by the time it takes for the output voltage to follow the input voltage. In the circuit shown in Figure4, the input amplitude is V0 step signal. In the switch closing phase, the output signal can be expressed as [21](7)Vout=V01−e−t/τ.Figure 4
The relationship between the on-resistance of MOS and the input voltage.
(a)(b)Among them,τ is the time constant of the circuit. To achieve a following error of less than 0.1%, the minimum following time required is 7τ, which is usually easier to meet.When the input signal is a dynamic signal, the situation is more complicated. Next, this paper analyzes the situation where the input signal is a sine wave. We set the initial output state to be 0 and the input signal as(8)Vint=Acosωt+ϕ.Then, the relationship of the output signal with time is expressed as [22](9)Voutt=Acosϕ−θ1+ωt2⋅e−t/τ+Acosωt+ϕ−θ1+ωt2,(10)θ=arctanωt.The former term of formula (9) is the transient response, and the latter term is the steady-state response. The transient response can be reduced to negligible after a certain period of time, and the final following error comes from the steady-state response term. The steady-state response term and the input signal of equation (8) are compared and found that there is a difference in amplitude between the two by a gain coefficient, which is related to the frequency of the input signal and the circuit time constant. The final following error can be defined as(11)Aerr=A/1+ωt2−AA=1−11+2πfinτ2.It can be seen that for a specific frequency input, the following error is determined by the time constant of the circuit. For a waveform with a leading edge of 1 ns, the signal bandwidth is about 350 MHz. In formula (11), fin is taken as 350 MH. τ needs to be less than 20 ps to achieve a following error of less than 0.1%. In this case, if the storage capacitor value CH is taken as 80 f, the on-resistance of the switch needs to be less than 250 Ω. In the actual circuit, the switch is realized by a MOS tube. NMOS tube is taken as an example; its on-resistance RON is [23](12)RON=1μnCoxW/LVDD−Vin−VTH.It can be seen from the expression ofRON that the on-resistance of the NMOS tube changes with the input voltage. The higher the input voltage, the greater the on-resistance. When the input voltage Vin approaches VDD−VTH, the on-resistance tends to infinity; that is, the switch is in the off state. PMOS also has the same characteristics, as shown in Figure 4.Therefore, if a singleN tube or a single Р tube is used as a switch, it will cause serious waveform distortion. There are usually two solutions. One is the use of a bootstrap switch structure, which allows the gate and input of the MOS tube to maintain a fixed voltage difference through circuit design, so as to achieve a relatively flat switch on-resistance in the entire input range. However, the structure of the bootstrap switch is relatively complicated, and it is not suitable for a highly integrated circuit, such as a switched capacitor array.The second solution is to use CMOS switches. The on-resistance of the CMOS switch is a parallel connection of the on-resistances of NMOS and PMOS, which can achieve a relatively flat on-resistance in the entire input range, as shown in Figure5.Figure 5
CMOS switch and its on-resistance.In short, for switched capacitor circuits, a MOS tube with a large aspect ratio or a smaller sampling capacitor can achieve a higher circuit speed.The accuracy problem is mainly to analyze the deviation between the sampling voltage and the input voltage. In the previous analysis, we found that the methods to improve the circuit speed include using a larger WL MOS or reducing the sampling capacitor. However, this will cause a decrease in sampling accuracy. In addition, the sampling accuracy is also affected by factors such as KT/C noise, charge injection, clock feedthrough, and harmonic distortion caused by uneven on-resistance. These are discussed separately below.For an RC low-pass filter circuit composed of a resistor and capacitor in series, the RMS value of the noise voltage obtained by integrating the thermal noise generated by the resistor on the capacitor iskT/C. Among them, k is Boltzmann’s constant and T is the absolute temperature. The sampling circuit is similar. The on-resistance of the sampling switch introduces a noise voltage with an RMS value of kT/C at the output. When the open end is disconnected, the noise voltage and the input voltage are stored on the capacitor at the same time. The only way to reduce this noise is to increase the size of the storage capacitor. The relationship between the noise and the capacitance value is shown in Figure 6. For a design with a full scale of 1V and a quantization resolution of 12 bits, if the thermal noise is to be less than 1LSB, the storage capacitor needs to be at least 78 fF.Figure 6
The relationship betweenkT/C noise and storage capacitor value.When the MOS tube is turned on, there is an inversion layer at the interface of silicon dioxide and silicon, that is, the so-called channel. The amount of charge in the channel can be expressed as(13)Qch=WLCoxVGS−VTH.When the switch is turned off, the charge in the channel is discharged from both ends of the source and drain, as shown in Figure7. However, the charge flowing to the capacitor Cx will cause a change in the voltage on the capacitor, and an error will be generated. The worst case is that all channel charges are injected into the storage capacitor. The resulting voltage error is(14)Vout=Vin−WLCoxVGS−VTHCH=Vin1+WLCoxCH−WLCoxCHVDD−VTH.Figure 7
Schematic diagram of charge injection and clock feedthrough effects.It can be seen from equation (14) that, due to the influence of channel charge injection, there are gain deviations and DC offsets between the input and output voltages. Moreover, in the DC offset term, the threshold voltage VTH is the amount that changes with the input signal (body effect). Therefore, the actual linear relationship between input and output voltage is not strict.There are two main methods to reduce the charge injection effect: one is to reduce the size of the switch and the amount of charge in the channel; the other is to use a compensation structure to offset the charge injection effect. The size of the switch is related to performance such as on-resistance and circuit speed, and the reduced space is effective. Therefore, a cancellation structure is usually used to reduce the impact of charge injection.When the clock signal of the gate of the MOS tube jumps, the jump signal will be coupled to the storage capacitor through the gate-source or gate-drain overlap capacitance, which will cause sampling errors. For a clock signal with a transition amplitude ofVCK, the voltage amplitude coupled to the storage capacitor can be expressed as(15)ΔV=VCKCOVCOV+CH.Among them,Cov is the size of the overlap capacitor. The clock feedthrough effect can be cancelled by using the circuit structure in Figure 8(a), or it can be eliminated by a differential input structure.Figure 8
RC circuit.The harmonic distortion discussed here mainly refers to the signal distortion caused by the on-resistance being uneven in the input voltage range. This paper first analyzes the pure RC circuit, as shown in Figure8.The transfer function of the circuit is(16)Hω=11+jωRC.The RC circuit will not only attenuate the amplitude of the input signal, but also delay the phase. The magnitude of the delay phase can be expressed as(17)Δϕ=arctanωRC.Formulas (9) and (10) deduced before can also get the same conclusion. The phase can be expressed as(18)Δϕ=ωΔt.Therefore, the phase delay is equivalent to the time delay(19)Δt=arctanωRCω≈RCωRC⟶0.Formula (19) shows that when the input frequency is low, the delay of the circuit to the signal is equal to the time constant of the circuit. The simulation is verified, R is 500 Ω, C is 80 f, AC simulation is carried out with Cadence, and the delay size corresponding to different frequencies is calculated using formula (18) and the phase frequency response result, as shown in Figure 9.Figure 9
The relationship between RC delay and the frequency of the input signal.It can be seen from the simulation results that in the 500 MHz input signal frequency range, the delay generated by the RC circuit is basically independent of the frequency of the input signal, and it is equal to the time constant of the circuit.


## 4. Music Feature Extraction System Based on Digital Music Waveform Analysis

Musical signals produced by musical instruments are analog signals that change continuously in time and amplitude. Therefore, to use a computer to process it, it is necessary to transform the original signal into a discrete digital signal through the process of quantization and sampling. Generally, filter processing is required before discretization. The purpose is to enhance the signal-to-noise ratio of the signal. The filtering operation is mainly divided into two steps, namely, antialiasing filtering and antipower frequency interference filtering.When the sampling frequency is less than 2 times the highest frequency of the analog signal, the sampled digital signal cannot completely save the information in the original signal, and frequency aliasing will occur. As shown in Figure10, the two sine waves have the same sample value, but the original signals are completely different. The signal with frequency aliasing will make subsequent processing meaningless. Therefore, it is necessary to select a sampling frequency that satisfies the sampling theorem. In this paper, the sampling frequency of the music signal is uniformly set to 44100 Hz.Figure 10
Frequency aliasing phenomenon.Different from the traditional hierarchical matching method, this paper uses a clustering algorithm to classify candidate song sets before matching retrieval. That is, before searching, this paper clusters the audio features of the music database and marks the center of each cluster and stores them in the feature database. Then, this paper first matches the piece of music to be matched with the center of each cluster, selects the cluster class where the cluster center with higher similarity is located, and then precisely matches the music to be matched with each music feature in the cluster. The experimental results show that this method greatly reduces the time required for retrieval while ensuring high retrieval accuracy. The block diagram of the hierarchical clustering process is shown in Figure11.Figure 11
Block diagram of the hierarchical clustering process.After constructing the above system model, the system model is tested and researched. This paper uses the system constructed in this paper to identify the data and compares the recognition results with the standard frequency spectrum, explores the accuracy and speed of music feature extraction, and obtains the result shown in Figure12.Figure 12
Music feature extraction effect based on digital music waveform analysis.From the above experimental research results, the music feature extraction model based on digital music waveform analysis proposed in this paper has good results, can effectively improve the accuracy of music feature extraction, and has an important role in promoting the development of digital music.


## 5. Conclusion

Among the many content-based music retrievals, melody-based retrieval has been a popular research direction in recent years. The retrieval method is based on music characteristics, such as music melody, rhythm, etc. It involves many issues such as expression of music melody, feature extraction of music melody, user query structure, music melody matching, and music database structure. The purpose is to enable users to retrieve media information with the help of an intelligent query interface. Taking the extraction of waveform music file features as the starting point, this paper combines the digital music feature extraction algorithm to construct a music feature extraction model. Moreover, this paper conducts an in-depth analysis of the digital music waveform extraction process. By setting the threshold, the linear difference between the sampling points on both sides of the threshold on the leading edge of the waveform is used to obtain the threshold time. In addition, the voltage noise on the sampling point will cause the deviation of the time measurement. Finally, this paper verifies the music feature extraction method in this paper through experimental research. From the experimental research results, the music feature extraction model based on digital music waveform analysis proposed in this paper has good results.



---

*Source: 7131992-2021-12-08.xml*