# Automatic Classification and Analysis of Music Multimedia Combined with Hidden Markov Model

Authors: Yanjiao Chen
Journal: Advances in Multimedia
 (2021)

---

## Abstract

Music multimedia is one of the more popular types of digital music. This article is based on the hidden Markov model (HMM) and proposed this kind of music multimedia automatic classification method. The method not only analyzes the characteristics of traditional music in detail but also fully considers the important characteristics of other music. At the same time, it uses bagging to train two groups of HMMs and automatically classifies them to achieve a better classification effect. This paper optimizes the variable parameters from different aspects such as model structure, data form, and model change to obtain the optimal HMM parameter value. This method not only considers the prior knowledge of feature words, word frequency, and number of documents but also fuses the meaning of the feature words into the hidden Markov classification model. Finally, by testing the hidden Markov model used in this paper on the music multimedia data set, the experimental results show that the method in this paper can effectively perform automatic classification according to the melody characteristics of music multimedia.


---

## Body

## 1. Introduction

With the continuous development of Internet technology and the improvement of the technological level, different Internet-based music multimedia began to emerge. Music multimedia is one of the more popular types of digital music, so its automatic classification and recognition has become the focus of domestic scholars’ research [1–3]. However, how to obtain the specific content source from the initial music multimedia data, lacking the definition of the music content, has become a huge challenge for the current automatic classification of music multimedia because the music multimedia signal belongs to a way of time sequence, which can be concealed according to its concealment. Using the hidden Markov model, at present, other classification methods are relatively simple, and the characteristics of music multimedia are not accurate [4–7].In this paper, the hidden Markov model is applied to the automatic classification process of music multimedia. This method can be based on the characteristics of the automatic lyrics of the music multimedia, and the lyrics, word frequency, content, and meaning of the lyrics of the music multimedia are used as the current prior knowledge. It is suitable for the automatic classification of music multimedia, classification process. We use the information gain method to obtain the music content of the music multimedia content, use the hidden Markov model to limit the weight of the lyrics and the semantic information of the music, and integrate the lyrics with high meaning similarity to construct various types of music multimedia content. Automatic classification mode, music multimedia, should be classified automatically [8–10].


## 2. Hidden Markov Model

The hidden Markov model is usually composed of multiple different states. Because of the continuous change of time, the hidden Markov model can stay in a certain state and can also switch between different states. Each observation vector can get different output frequencies for different states. In this paper, a hidden Markov model with four states S1～S4 is used for computational processing. The input observation sequence is represented byo1,o2,…,oT, and the transition probability between each state or between the states is represented by a0, where each observation sequence is used as each frame MFCC parameters. In this model, the observation sequence o1,o2,…,oT is used as the observable input sequence, but the state at each time cannot be directly observed [11, 12].The time complexity and space complexity of music multimedia automatic processing depend on the dimension of music multimedia automatic feature vector. In order to improve the accuracy of model classification, music multimedia needs to be processed automatically in the descending order, and finally, lyrics are selected to display documents. In the information gain, the measurement standard is to see how much information the average information of the class can bring to the classification system. The more information it brings, the more important the average information of the class is. For the average amount of information of a class, the amount of information will change when the system has it or not, and the difference between the amount of information before and after is the amount of information brought to the system by the average amount of information of this class.The pitch part adopts the pitch period judgment method. When the difference between the pitch of the next frame and the average of the pitches of all previously stored frames is less than the threshold, it is determined that these frames are frames of one category, and the frame is saved until the difference between the pitch of the next frame is greater than the threshold. All these frames are processed as one frame, and the melting spectrum parameter Mel-ceptral (MCEP) is calculated to obtain the 13th MCP. The threshold defined in the experiment is 1. The schematic diagram is shown in Figure1.Figure 1
Pitch classification and recognition model.In order to maintain the balance of the data in the subsequent spectrum average (CMS) and the correlation spectrum (PASTA) algorithm, we copy the calculated MCPP data in the corresponding 10 ms frame and perform spectral region filtering on it. The first-order and second-order differences are performed on the filtered parameters to obtain 39-order parameters. Finally, the parameters are Gaussized to improve the recognition rate.The Markov model uses the Baum–Welch algorithm to solve the Markov parameter estimation problem and solve the hidden Markov training problem. Usually, when using a given sequence of observationsO=o1,o2,…,oT, this method uses the determined λ = (A, B, π) parameter to ensure that the value of P(O|λ) can reach the maximum value.According to the related definitions of forward probability and backward probability, we know(1)PO|λ=∑i=1N∑j=1Nαtiaijbjot+1βt+1j,1≤t≤T−1.When usingP(O|λ) to reach the maximum value, since the training sequence of each experiment is limited, the best method cannot be realized for estimating the parameters. In this case, the Baum–Welch algorithm uses P(O|λ) with a recursive idea, the part is very large, and finally, the model parameter λ = (A, B, π) is obtained.The revaluation formula of the Baum–Welch algorithm is derived by recursion as(2)π¯i=ξ1i,a¯ij=∑t=1T−1ξti,j∑t=1T−1ξti,b¯jk=∑t=1andOt=VkTξtj∑t=1T−1ξtj.Among them,ξti,j represents the given training sequence O and the model parameter λ, the probability that the Markov chain is in the θi state at time t, and the θi state at time t + 1 and ∑t=1T−1ξti represents the expected value of the number of transitions from the state θi to the state θi.Define the auxiliary function as(3)Qλ,λ¯=1PO|λ∑allSPO,S|λlnPO,S|λ¯.Among them,λ is the original model parameter λ = (A, B, π), λ¯ is the model parameter λ¯=A¯,B¯,π¯ to be solved, O is the observation sequence used for training and O=o1,o2,…,oT, and S are the state sequence S=q1,q2,…,qT.The Markov model can not only find a good enough state transition path but also quickly calculate the output probability corresponding to the path. At the same time, the amount of calculation required by the method of using the Markov model to calculate the output probability is much less than that in the total probability formula.Defineδti as the maximum probability of o1,o2,…,ot along a path q1,q2,…,qt at time t and q1=θi, which is(4)δti=maxq1,q2,…,qt−1Pq1,q2,…,qt,q1=θi,o1,o2,…,ot|λ.The recursive form of the hidden Markov model is as follows:(1)
Initialization:(5)δti=πibio1,1≤i≤N,ψ1i=0.(2)
Recursion:(6)δtj=max1≤i≤Nδt−1iaijbjot,2≤t≤T,1≤j≤N,ψtj=argmax1≤i≤Nδt−1iaij,2≤t≤T,1≤j≤N.(3)
End:(7)P∗=max1≤i≤NδTi,(8)qT∗=argmax1≤i≤NδTi.(4)
Find the state sequence:(9)qt∗=ψt+1qt+1∗,1≤t≤T−1.Among them,δti represents the probability of accumulating the output value of the ith state at time t, ψti represents the continuous state parameter of the ith state at time t, qt∗ is the state at time t in the optimal state sequence, and P∗ is the final output probability.


## 3. Feature Extraction

### 3.1. Timbre Feature Extraction

For audio with similar pitch and melody, timbre characteristics can be used to distinguish. The feature of timbre is a short-term concept. In order to extract the feature of timbre, the frame is firstly divided [13, 14]. The original audio signal is divided into fixed-length frames, and there is a certain overlap between frames. In order to make the signal smoother, the frame needs to be turned on. The frame length used by this system is 524 (sampling rate 50 Hz about 25 ms), overlapping 26 points, and each frame adds a Hamming window to reduce the influence of edges. After dividing the frames, the fast Fourier can obtain the frequency spectrum of the signal of each frame and can also extract the spectral features [15].


#### 3.1.1. Skewness and Kurtosis

In addition to the mean and variance, common statistics include skewness and kurtosis. Skewness is a measure of the asymmetry of a signal and can represent the relative tendency of tonal and nontonal components in the band. For a sequencex of length N, the mean is ∑n=1Nxn−u3 and the standard deviation is σ. The mathematical expression of skewness is as follows:(10)skewness=∑n=1Nxn−u3N−1σ3.It measures the peak state of the probability distribution of a real random variable. The peak height of the dataset distribution means that there are individual peaks near the average value. The peak can plot the effective dynamic range of the spectrum. The peak formula is as follows:(11)Kurtosis=∑n=1Nxn−u4N−1δ4−3.


#### 3.1.2. Spectral Centroid

The center of the spectrum is the center of gravity of the STFT amplitude spectrum. Determine the most concentrated point of spectral energy, which is related to the most dominant frequency in the signal. The mathematical performance of the spectral center () is as follows:(12)ct=∑n=1NMtn∗n∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


#### 3.1.3. Spectral Flux

The spectral fluxFt is defined as the second moment of the difference between the spectra of two adjacent frames, which can be used to measure the speed of the energy spectrum change and determine the timbre of the audio signal. The mathematical performance of spectral flux () is as follows:(13)Ft=∑n=1NNtn−Nt−1n2,where Ntn and Nt−1n, respectively, represent the nth value in the normalized amplitude spectrum of the tth frame and the t − 1th frame signal.


#### 3.1.4. Spectral Rolloff

Spectral rolloffRt is defined as the spectrum that measures the bandwidth of the audio signal and concentrates 79% of the energy on the first point less than the frequency:(14)∑n=1RtMtn=0.85∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


#### 3.1.5. Spectral Spread

This concept is mentioned in Lench’s “Audio Content Analysis” [14, 15]. Spectrum spread can be referred to as a temporary bandwidth and describes the concentration of the energy spectrum near the center of the spectrum. Spectral propagation can be regarded as the standard deviation of the energy spectrum near the center of the spectrum. It is defined as follows:(15)spread=∑n=1Nn−ct2⋅Mtn2∑n=1NMtn2,where Ct is the center of the spectrum and the amplitude spectrum Mt of the signal.


#### 3.1.6. Spectral Flatness

The flatness of the spectrum is also used to describe the shape of the spectrum and is provided to quantify the melody of the sound. In the formula of spectral flatness (F),(16)F=exp1/N∑n=1NlnMtn1/N∑n=1NMtn,where Mt is the amplitude spectrum of the signal.


#### 3.1.7. Zero Crossing

Measure the number of times the audio signal passes the zero value in a given time intervalZt. For natural noise, this value is random. Therefore, for silent segments, since the zero-crossing rate is higher than that of voiced segments, it is often used to distinguish whether the audio has sound. The zero-crossing rate () formula is as follows:(17)Zt=12∑n=1Nsgnxn−sgnxn−1,where sgn(x) is a symbolic function.


#### 3.1.8. Mel Frequency Cepstrum Coefficient (MFCC)

MFCC is triggered by human auditory characteristics and is based on the audio characteristics of STFT. According to the characteristics of human hearing, the perception of human ears becomes a logarithmic relationship with the actual changes in the size and amplitude of the sound. After taking the logarithm of the amplitude spectrum, the FFT coefficients are divided into multiple frequency bands and smoothed according to the Mel frequency. Since the Mel spectrum vectors obtained in this way are highly correlated, in order to eliminate their correlation, transformation is required, and DCT is used for processing here. The overall MFCC extraction process is shown in Figure2.Figure 2
Extracting MFCC from audio.Since the first coefficient of MFCC represents the DC component in the signal, it is often truncated in practical applications. MFCC has the differential component AMFCC again and twice and has a certain meaning. As a result of the experimental test, the system finally extracted 12 times (with the 0th coefficient removed) MFCC and its 1st difference component as the feature vector.


### 3.2. Melody Feature Extraction

The melody of music multimedia can see that the melody of music multimedia changes with time. The characteristics of melody are mainly composed of the characteristics, rhythm, and speed of music multimedia. Using the distribution histogram, the characteristics of the music multimedia melody can be extracted, that is, the distribution histogram can be obtained according to the wavelet decomposition of the signal, and at the same time, the relevant high-pass and low-pass filtering can be performed on the signal in the domain.According to the histogram, 6 different types of eigenvalues can be obtained. From the first peak in the histogram, it can be expressed according to the period of the peak (using bpm per minute). The sum of the ratio corresponds to the width of the first two peaks and the overall amplitude of the histogram. The operation of the distribution histogram is shown in Figure3.Figure 3
The calculation of the histogram.


## 3.1. Timbre Feature Extraction

For audio with similar pitch and melody, timbre characteristics can be used to distinguish. The feature of timbre is a short-term concept. In order to extract the feature of timbre, the frame is firstly divided [13, 14]. The original audio signal is divided into fixed-length frames, and there is a certain overlap between frames. In order to make the signal smoother, the frame needs to be turned on. The frame length used by this system is 524 (sampling rate 50 Hz about 25 ms), overlapping 26 points, and each frame adds a Hamming window to reduce the influence of edges. After dividing the frames, the fast Fourier can obtain the frequency spectrum of the signal of each frame and can also extract the spectral features [15].


### 3.1.1. Skewness and Kurtosis

In addition to the mean and variance, common statistics include skewness and kurtosis. Skewness is a measure of the asymmetry of a signal and can represent the relative tendency of tonal and nontonal components in the band. For a sequencex of length N, the mean is ∑n=1Nxn−u3 and the standard deviation is σ. The mathematical expression of skewness is as follows:(10)skewness=∑n=1Nxn−u3N−1σ3.It measures the peak state of the probability distribution of a real random variable. The peak height of the dataset distribution means that there are individual peaks near the average value. The peak can plot the effective dynamic range of the spectrum. The peak formula is as follows:(11)Kurtosis=∑n=1Nxn−u4N−1δ4−3.


### 3.1.2. Spectral Centroid

The center of the spectrum is the center of gravity of the STFT amplitude spectrum. Determine the most concentrated point of spectral energy, which is related to the most dominant frequency in the signal. The mathematical performance of the spectral center () is as follows:(12)ct=∑n=1NMtn∗n∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


### 3.1.3. Spectral Flux

The spectral fluxFt is defined as the second moment of the difference between the spectra of two adjacent frames, which can be used to measure the speed of the energy spectrum change and determine the timbre of the audio signal. The mathematical performance of spectral flux () is as follows:(13)Ft=∑n=1NNtn−Nt−1n2,where Ntn and Nt−1n, respectively, represent the nth value in the normalized amplitude spectrum of the tth frame and the t − 1th frame signal.


### 3.1.4. Spectral Rolloff

Spectral rolloffRt is defined as the spectrum that measures the bandwidth of the audio signal and concentrates 79% of the energy on the first point less than the frequency:(14)∑n=1RtMtn=0.85∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


### 3.1.5. Spectral Spread

This concept is mentioned in Lench’s “Audio Content Analysis” [14, 15]. Spectrum spread can be referred to as a temporary bandwidth and describes the concentration of the energy spectrum near the center of the spectrum. Spectral propagation can be regarded as the standard deviation of the energy spectrum near the center of the spectrum. It is defined as follows:(15)spread=∑n=1Nn−ct2⋅Mtn2∑n=1NMtn2,where Ct is the center of the spectrum and the amplitude spectrum Mt of the signal.


### 3.1.6. Spectral Flatness

The flatness of the spectrum is also used to describe the shape of the spectrum and is provided to quantify the melody of the sound. In the formula of spectral flatness (F),(16)F=exp1/N∑n=1NlnMtn1/N∑n=1NMtn,where Mt is the amplitude spectrum of the signal.


### 3.1.7. Zero Crossing

Measure the number of times the audio signal passes the zero value in a given time intervalZt. For natural noise, this value is random. Therefore, for silent segments, since the zero-crossing rate is higher than that of voiced segments, it is often used to distinguish whether the audio has sound. The zero-crossing rate () formula is as follows:(17)Zt=12∑n=1Nsgnxn−sgnxn−1,where sgn(x) is a symbolic function.


### 3.1.8. Mel Frequency Cepstrum Coefficient (MFCC)

MFCC is triggered by human auditory characteristics and is based on the audio characteristics of STFT. According to the characteristics of human hearing, the perception of human ears becomes a logarithmic relationship with the actual changes in the size and amplitude of the sound. After taking the logarithm of the amplitude spectrum, the FFT coefficients are divided into multiple frequency bands and smoothed according to the Mel frequency. Since the Mel spectrum vectors obtained in this way are highly correlated, in order to eliminate their correlation, transformation is required, and DCT is used for processing here. The overall MFCC extraction process is shown in Figure2.Figure 2
Extracting MFCC from audio.Since the first coefficient of MFCC represents the DC component in the signal, it is often truncated in practical applications. MFCC has the differential component AMFCC again and twice and has a certain meaning. As a result of the experimental test, the system finally extracted 12 times (with the 0th coefficient removed) MFCC and its 1st difference component as the feature vector.


## 3.1.1. Skewness and Kurtosis

In addition to the mean and variance, common statistics include skewness and kurtosis. Skewness is a measure of the asymmetry of a signal and can represent the relative tendency of tonal and nontonal components in the band. For a sequencex of length N, the mean is ∑n=1Nxn−u3 and the standard deviation is σ. The mathematical expression of skewness is as follows:(10)skewness=∑n=1Nxn−u3N−1σ3.It measures the peak state of the probability distribution of a real random variable. The peak height of the dataset distribution means that there are individual peaks near the average value. The peak can plot the effective dynamic range of the spectrum. The peak formula is as follows:(11)Kurtosis=∑n=1Nxn−u4N−1δ4−3.


## 3.1.2. Spectral Centroid

The center of the spectrum is the center of gravity of the STFT amplitude spectrum. Determine the most concentrated point of spectral energy, which is related to the most dominant frequency in the signal. The mathematical performance of the spectral center () is as follows:(12)ct=∑n=1NMtn∗n∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


## 3.1.3. Spectral Flux

The spectral fluxFt is defined as the second moment of the difference between the spectra of two adjacent frames, which can be used to measure the speed of the energy spectrum change and determine the timbre of the audio signal. The mathematical performance of spectral flux () is as follows:(13)Ft=∑n=1NNtn−Nt−1n2,where Ntn and Nt−1n, respectively, represent the nth value in the normalized amplitude spectrum of the tth frame and the t − 1th frame signal.


## 3.1.4. Spectral Rolloff

Spectral rolloffRt is defined as the spectrum that measures the bandwidth of the audio signal and concentrates 79% of the energy on the first point less than the frequency:(14)∑n=1RtMtn=0.85∑n=1NMtn,where Mtn represents the nth value in the amplitude spectrum of the tth frame signal.


## 3.1.5. Spectral Spread

This concept is mentioned in Lench’s “Audio Content Analysis” [14, 15]. Spectrum spread can be referred to as a temporary bandwidth and describes the concentration of the energy spectrum near the center of the spectrum. Spectral propagation can be regarded as the standard deviation of the energy spectrum near the center of the spectrum. It is defined as follows:(15)spread=∑n=1Nn−ct2⋅Mtn2∑n=1NMtn2,where Ct is the center of the spectrum and the amplitude spectrum Mt of the signal.


## 3.1.6. Spectral Flatness

The flatness of the spectrum is also used to describe the shape of the spectrum and is provided to quantify the melody of the sound. In the formula of spectral flatness (F),(16)F=exp1/N∑n=1NlnMtn1/N∑n=1NMtn,where Mt is the amplitude spectrum of the signal.


## 3.1.7. Zero Crossing

Measure the number of times the audio signal passes the zero value in a given time intervalZt. For natural noise, this value is random. Therefore, for silent segments, since the zero-crossing rate is higher than that of voiced segments, it is often used to distinguish whether the audio has sound. The zero-crossing rate () formula is as follows:(17)Zt=12∑n=1Nsgnxn−sgnxn−1,where sgn(x) is a symbolic function.


## 3.1.8. Mel Frequency Cepstrum Coefficient (MFCC)

MFCC is triggered by human auditory characteristics and is based on the audio characteristics of STFT. According to the characteristics of human hearing, the perception of human ears becomes a logarithmic relationship with the actual changes in the size and amplitude of the sound. After taking the logarithm of the amplitude spectrum, the FFT coefficients are divided into multiple frequency bands and smoothed according to the Mel frequency. Since the Mel spectrum vectors obtained in this way are highly correlated, in order to eliminate their correlation, transformation is required, and DCT is used for processing here. The overall MFCC extraction process is shown in Figure2.Figure 2
Extracting MFCC from audio.Since the first coefficient of MFCC represents the DC component in the signal, it is often truncated in practical applications. MFCC has the differential component AMFCC again and twice and has a certain meaning. As a result of the experimental test, the system finally extracted 12 times (with the 0th coefficient removed) MFCC and its 1st difference component as the feature vector.


## 3.2. Melody Feature Extraction

The melody of music multimedia can see that the melody of music multimedia changes with time. The characteristics of melody are mainly composed of the characteristics, rhythm, and speed of music multimedia. Using the distribution histogram, the characteristics of the music multimedia melody can be extracted, that is, the distribution histogram can be obtained according to the wavelet decomposition of the signal, and at the same time, the relevant high-pass and low-pass filtering can be performed on the signal in the domain.According to the histogram, 6 different types of eigenvalues can be obtained. From the first peak in the histogram, it can be expressed according to the period of the peak (using bpm per minute). The sum of the ratio corresponds to the width of the first two peaks and the overall amplitude of the histogram. The operation of the distribution histogram is shown in Figure3.Figure 3
The calculation of the histogram.


## 4. Automatic Classification of Music Multimedia

### 4.1. HMM Training

Since only the observation sequence O of the HMM can be obtained in advance, it is considered how to use the sequence to estimate the parameter input of the HMM. Generally, based on the maximum likelihood criterion, the Baum–Welch algorithm can be used to find the local optimization [13]. From the obtained observation sequence, the Kmeans clustering algorithm is used to cluster them into M classes%. After the initial parameters are input, the Baum–Welch algorithm outputs a set of new parameters A, and the observation sequence, O=o1o2⋯oT:(18)PO|λ≥PO|λ.The calculation method is the forward-backward algorithm.PO|λ, for the HMM parameter λ and state i, defines the forward probability αti:(19)αii=Po1o2⋯oT,qt=o|λ.αti is the probability o1o2⋯ot that the parameter A generates a sequence and the otstate is at time t.PO|λ can be calculated by the following forward algorithm.(1)
Initialization:(20)α1j=bjjo1,1≤j≤N.(2)
Recursion:(21)αti=bioi∑j=1Nαt−1jαji,1≤t≤T,1≤i≤N.(3)
Termination:(22)PO|λ=∑j=1NαTj.Defineβti and ξti,j call at the same time:(23)βti=Pot+1ot+2⋯oT,|qt=i,λ,(24)ξti,j=Pqt=i,qt+1=j|O,λ.The calculation methodξti,j from forward to backward can be expressed as [2](25)ξti,j=Pqt=i,qt+1=j|O,λPO|λ=αiiαijbjot+1βi+1jPO|λ=αtiαijbjot+1βt+1j∑i=1N∑j=1Nαtiαijbjot+1βt+1j.The probability that the system is in themth mixed component γti,m of state i at time t is(26)γti,m=αtiβti∑i=1Nαtiβtiμj,mNot,μj,m,Σj,m∑m=1Mωj,mNot,μj,m,Σj,m.


### 4.2. Automatic Classification Using HMM

First, train various types of HMMs using labeled training kits. Set the type to be automatically classified,k=1,2,…,K. The various types are for model parameters, λk. Use the maximum likelihood criterion to maximize the posterior probability. At the same time, the Beggs formula must be considered. We have(27)k¯=argmax1≤k≤KPO|λk=argmax1≤k≤KPO|λkPλkPO.Assuming that the prior probabilities of all typesPλk are the same and P(O) is independent of k, the criterion is simply(28)k¯=argmax1≤k≤KPO|λk.Due to its small size, overflow will occur below floating point during computer operations,PO|λk. Therefore, the logarithm is usually taken. For multiple observation sequences, we only need to weigh each formula [13].


## 4.1. HMM Training

Since only the observation sequence O of the HMM can be obtained in advance, it is considered how to use the sequence to estimate the parameter input of the HMM. Generally, based on the maximum likelihood criterion, the Baum–Welch algorithm can be used to find the local optimization [13]. From the obtained observation sequence, the Kmeans clustering algorithm is used to cluster them into M classes%. After the initial parameters are input, the Baum–Welch algorithm outputs a set of new parameters A, and the observation sequence, O=o1o2⋯oT:(18)PO|λ≥PO|λ.The calculation method is the forward-backward algorithm.PO|λ, for the HMM parameter λ and state i, defines the forward probability αti:(19)αii=Po1o2⋯oT,qt=o|λ.αti is the probability o1o2⋯ot that the parameter A generates a sequence and the otstate is at time t.PO|λ can be calculated by the following forward algorithm.(1)
Initialization:(20)α1j=bjjo1,1≤j≤N.(2)
Recursion:(21)αti=bioi∑j=1Nαt−1jαji,1≤t≤T,1≤i≤N.(3)
Termination:(22)PO|λ=∑j=1NαTj.Defineβti and ξti,j call at the same time:(23)βti=Pot+1ot+2⋯oT,|qt=i,λ,(24)ξti,j=Pqt=i,qt+1=j|O,λ.The calculation methodξti,j from forward to backward can be expressed as [2](25)ξti,j=Pqt=i,qt+1=j|O,λPO|λ=αiiαijbjot+1βi+1jPO|λ=αtiαijbjot+1βt+1j∑i=1N∑j=1Nαtiαijbjot+1βt+1j.The probability that the system is in themth mixed component γti,m of state i at time t is(26)γti,m=αtiβti∑i=1Nαtiβtiμj,mNot,μj,m,Σj,m∑m=1Mωj,mNot,μj,m,Σj,m.


## 4.2. Automatic Classification Using HMM

First, train various types of HMMs using labeled training kits. Set the type to be automatically classified,k=1,2,…,K. The various types are for model parameters, λk. Use the maximum likelihood criterion to maximize the posterior probability. At the same time, the Beggs formula must be considered. We have(27)k¯=argmax1≤k≤KPO|λk=argmax1≤k≤KPO|λkPλkPO.Assuming that the prior probabilities of all typesPλk are the same and P(O) is independent of k, the criterion is simply(28)k¯=argmax1≤k≤KPO|λk.Due to its small size, overflow will occur below floating point during computer operations,PO|λk. Therefore, the logarithm is usually taken. For multiple observation sequences, we only need to weigh each formula [13].


## 5. Construction of Automatic Classification System of Music Multimedia

### 5.1. Audio Feature Extraction

The processing of timbre features divides the input signal into 512 points in length through preprocessing and superimposes them on a frame of 256 points and then performs spectral energy, spectral center, spectral beam, spectral rolloff, spectral spread, and spectral flatness on each analysis window. Due to the zero-crossing rate and the total 31-dimensional vectors of the first 12MFCC and AMFCC, the average value and dispersion of the feature vector of each analysis window are obtained in the structure window. According to the low energy value obtained by the calculation, it is necessary to perform the window value of different structures. We extract the dimensional feature vector.


### 5.2. Automatic Classifier Training

For the adopted music multimedia feature system, it is necessary to extract music feature values of different types of music multimedia and optimize the hidden Markov models obtained under different types of training according to the feature vectors used. Determine the structural characteristics of the initial state and hidden Markov model in different states, and connect all the connections with the left-right structure. In the process of automatic classification of music multimedia, it is necessary to perform TC sequence operations in the audio feature extraction process to calculate the probability values of observation sequences composed of different types of HMM models, and at the same time, we perform automatic classification into the type with higher probability.In a system that effectively combines TC and RC at the same time, according to different types of music multimedia types, the music multimedia features are extracted from timbre and rhythm features, and different types of feature values are used in turn for corresponding classification training. In the automatic classification process, it is necessary to input the TC and RC sequences corresponding to the audio at the same time, calculate the sum of the probabilities of the observation sequences formed by the HMM under different types, and sort them according to the level. The structure of the system is shown in Figure4.Figure 4
Structure diagram of audio automatic classification system.


## 5.1. Audio Feature Extraction

The processing of timbre features divides the input signal into 512 points in length through preprocessing and superimposes them on a frame of 256 points and then performs spectral energy, spectral center, spectral beam, spectral rolloff, spectral spread, and spectral flatness on each analysis window. Due to the zero-crossing rate and the total 31-dimensional vectors of the first 12MFCC and AMFCC, the average value and dispersion of the feature vector of each analysis window are obtained in the structure window. According to the low energy value obtained by the calculation, it is necessary to perform the window value of different structures. We extract the dimensional feature vector.


## 5.2. Automatic Classifier Training

For the adopted music multimedia feature system, it is necessary to extract music feature values of different types of music multimedia and optimize the hidden Markov models obtained under different types of training according to the feature vectors used. Determine the structural characteristics of the initial state and hidden Markov model in different states, and connect all the connections with the left-right structure. In the process of automatic classification of music multimedia, it is necessary to perform TC sequence operations in the audio feature extraction process to calculate the probability values of observation sequences composed of different types of HMM models, and at the same time, we perform automatic classification into the type with higher probability.In a system that effectively combines TC and RC at the same time, according to different types of music multimedia types, the music multimedia features are extracted from timbre and rhythm features, and different types of feature values are used in turn for corresponding classification training. In the automatic classification process, it is necessary to input the TC and RC sequences corresponding to the audio at the same time, calculate the sum of the probabilities of the observation sequences formed by the HMM under different types, and sort them according to the level. The structure of the system is shown in Figure4.Figure 4
Structure diagram of audio automatic classification system.


## 6. Test Results and Analysis

### 6.1. Automatic Classification System Based on Timbre Characteristics

Automatic classification considering only music feature values is a traditional method. Considering that the state of the hidden Markov model is set to 4, 5, and 6 states, the calculated Gaussian mixture distribution values are 1 and 2 in turn, taking into account at the same time to all the connections and the actual application of the left-right model. Table1 shows the relationship between the automatic classification accuracy and the number of HMM states calculated by the HMM model under different types and the relationship between the two and the number of mixed Gaussian distributions. For the different state values in the table, the automatic classification accuracy is only 1%. It can be seen that there is little correlation between the automatic classification accuracy and the number of states. For the mixed Gaussian distribution value, the intermediate value of 2 can achieve better results, and the accuracy can also be increased to 62.2%, mainly due to the inability to accurately calculate the HMM characteristics under the Gaussian distribution, but the components greater than three or more lack correlation training samples. The result obtained under the HMM model is left-right better, but the accuracy of the related connection model in this system is relatively high.Table 1
Automatic classification results of different HMM structures (features of timbre only).
NCNS456(a) Fully connected (%)160.261.363.2263.664.463.3360.359.158.3(b) Left-right (%)159.159.857.2261.363.458.8358.457.451.8Note. NS represents the number of states of the HMM and NC represents the number of output components of the mixed Gaussian.In the actual category of the first element table of the column, the column element represents the frequency of being classified into the corresponding category of the row. Table2 is the result of specific automatic classification confusion in the best case, that is, HMM is connected to the automatic classification result. As a result, for music multimedia with relatively clear features such as Classcal, Hphop, Jazz, Metal, and Pop, HMM can achieve higher accuracy (≥68%), and the accuracy of classical reaches 88%. The features of Blues, Reggae, Rock, etc., are not clear, so the accuracy of automatic classification is very low. In addition, it should be noted that a lot of music multimedia that is not a rock genre is classified as a rock genre. The reason for this result may be due to the extraction of sound features that cannot distinguish these types of music multimedia well. The experiment shows that only 70% of people have not been trained to automatically classify music multimedia.Table 2
Confusion matrix of GTZAN dataset (using timbre characteristics).
BlClCoDiHiJaMePoReRoBl50194455167Cl59021171111Co1925932313720Di4255695671515Hi111571123184Ja49213721134Me61742577229Po113138427845Re10024100462Ro1822120561413742


### 6.2. Automatic Classification System Based on Timbre and Melody Characteristics

The sound quality and melody characteristics are automatically classified in the HMM model as a classification method. Set the number of states under the corresponding timbre characteristic HMM model to 5, and output all connected models with a mixed Gaussian distribution value of 2. The number of states of melody characteristics and the number of Gaussian mixture distributions need to be reconfirmed. The test results obtained are shown in Table3. It can still be found that the effect of all the coupled models is better. For a mixture of Gaussian distributions with a state number of 6, the accuracy of the 4 model reaches 66.8%. The accuracy here is higher than just considering the tone.Table 3
Automatic classification results under different HMM structures.
NCNS456(a) Fullyconnected (%)163.458.661.8258.662.663.836260.459.2(b) Left-right (%)163.258.461.6258.562.563.7361.559.958.7Note. NS represents the number of states of the HMM and NC represents the number of output components of the mixed Gaussian.Table4 is a comparison of the accuracy of various automatic classification algorithms. Compared with the latest research results, the accuracy of this thesis system is still far away.Table 4
Comparison of accuracy of different automatic classification algorithms.
ClassifierClassification accuracy (%)LPNTF93.6Visual91ELM86.35OSC + SVM85.29GSV + Gabor filters83.3DWCH + SVM79.7HMM68HMM64.4GMM and KNN62.2


## 6.1. Automatic Classification System Based on Timbre Characteristics

Automatic classification considering only music feature values is a traditional method. Considering that the state of the hidden Markov model is set to 4, 5, and 6 states, the calculated Gaussian mixture distribution values are 1 and 2 in turn, taking into account at the same time to all the connections and the actual application of the left-right model. Table1 shows the relationship between the automatic classification accuracy and the number of HMM states calculated by the HMM model under different types and the relationship between the two and the number of mixed Gaussian distributions. For the different state values in the table, the automatic classification accuracy is only 1%. It can be seen that there is little correlation between the automatic classification accuracy and the number of states. For the mixed Gaussian distribution value, the intermediate value of 2 can achieve better results, and the accuracy can also be increased to 62.2%, mainly due to the inability to accurately calculate the HMM characteristics under the Gaussian distribution, but the components greater than three or more lack correlation training samples. The result obtained under the HMM model is left-right better, but the accuracy of the related connection model in this system is relatively high.Table 1
Automatic classification results of different HMM structures (features of timbre only).
NCNS456(a) Fully connected (%)160.261.363.2263.664.463.3360.359.158.3(b) Left-right (%)159.159.857.2261.363.458.8358.457.451.8Note. NS represents the number of states of the HMM and NC represents the number of output components of the mixed Gaussian.In the actual category of the first element table of the column, the column element represents the frequency of being classified into the corresponding category of the row. Table2 is the result of specific automatic classification confusion in the best case, that is, HMM is connected to the automatic classification result. As a result, for music multimedia with relatively clear features such as Classcal, Hphop, Jazz, Metal, and Pop, HMM can achieve higher accuracy (≥68%), and the accuracy of classical reaches 88%. The features of Blues, Reggae, Rock, etc., are not clear, so the accuracy of automatic classification is very low. In addition, it should be noted that a lot of music multimedia that is not a rock genre is classified as a rock genre. The reason for this result may be due to the extraction of sound features that cannot distinguish these types of music multimedia well. The experiment shows that only 70% of people have not been trained to automatically classify music multimedia.Table 2
Confusion matrix of GTZAN dataset (using timbre characteristics).
BlClCoDiHiJaMePoReRoBl50194455167Cl59021171111Co1925932313720Di4255695671515Hi111571123184Ja49213721134Me61742577229Po113138427845Re10024100462Ro1822120561413742


## 6.2. Automatic Classification System Based on Timbre and Melody Characteristics

The sound quality and melody characteristics are automatically classified in the HMM model as a classification method. Set the number of states under the corresponding timbre characteristic HMM model to 5, and output all connected models with a mixed Gaussian distribution value of 2. The number of states of melody characteristics and the number of Gaussian mixture distributions need to be reconfirmed. The test results obtained are shown in Table3. It can still be found that the effect of all the coupled models is better. For a mixture of Gaussian distributions with a state number of 6, the accuracy of the 4 model reaches 66.8%. The accuracy here is higher than just considering the tone.Table 3
Automatic classification results under different HMM structures.
NCNS456(a) Fullyconnected (%)163.458.661.8258.662.663.836260.459.2(b) Left-right (%)163.258.461.6258.562.563.7361.559.958.7Note. NS represents the number of states of the HMM and NC represents the number of output components of the mixed Gaussian.Table4 is a comparison of the accuracy of various automatic classification algorithms. Compared with the latest research results, the accuracy of this thesis system is still far away.Table 4
Comparison of accuracy of different automatic classification algorithms.
ClassifierClassification accuracy (%)LPNTF93.6Visual91ELM86.35OSC + SVM85.29GSV + Gabor filters83.3DWCH + SVM79.7HMM68HMM64.4GMM and KNN62.2


## 7. Conclusions

This paper uses the hidden Markov model to automatically classify music multimedia and improves the accuracy of classification by obtaining the optimal parameter values of the HMM model. Finally, an example analysis result shows that the introduction of the hidden Markov model into the independent classification of music multimedia can achieve accurate and rapid classification. At the same time, combined with the melody characteristics of the music multimedia, the accuracy of the music multimedia classification of the HMM model can be increased to 67.9%. Therefore, the independent classification based on the characteristics of music multimedia is mainly because it is easier to distinguish different types of samples according to the characteristics of music multimedia.



---

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