Music frequency spectrum analytical approach, music frequency spectrum display device and music player
[technical field]
The invention belongs to the voice process technology field, relate to a kind of music frequency spectrum analytical approach and music frequency spectrum display device and music player.
[background technology]
Music player on the previous PC has only music playback function, afterwards in order to enrich user's music experience more, visually for the user the dynamic window that shows frequency spectrum graphics in real time is provided according to the rhythm and the intensity of music.
In the limited embedded device music player of current each item hardware performance; Though the function that also has music frequency spectrum to show; But this music frequency spectrum figure is the dynamic background picture of having made in advance, and when music, its wave pattern shows along with opening of player; Real-time and dynamic shows the frequency jitter curve of music if desired, and then its internal memory that takies and processor ratio are quite big.
[summary of the invention]
The present invention has proposed a kind of new music frequency spectrum analytical approach, music frequency spectrum display device and music player just in order to solve above-mentioned technical matters.
The present invention provides a kind of music frequency spectrum analytical approach, and this method comprises:
Obtain the Wave data of the digital signal that generates behind the audio decoder;
This Wave data is carried out the conversion of time-domain signal to frequency-region signal.
Digital signal behind the described audio decoder comprises left channel signals and right-channel signals, and the Wave data that obtains the digital signal that generates behind the audio decoder comprises, extracts the Wave data of one of them sound channel signal.
Said Wave data is carried out the conversion of time-domain signal to frequency-region signal; Comprise: adopt the fast discrete Fourier mapping algorithm that Wave data is carried out the conversion of time-domain signal to frequency-region signal; When carrying out FFT, the frequency domain sequence of time domain sequences and output is all arranged according to natural order.
Comprise further after the said Wave data step of obtaining the digital signal that generates behind the audio decoder that once sampling digital signal is at set intervals obtained the Wave data of this digital signal.
The described frequency that digital signal is sampled is 2 ~ 4 times of quilt sampling wave frequency, is preferably 3 times.
The present invention also provides a kind of music frequency spectrum display device, and this device adopts arm processor to handle like the arbitrary said music frequency spectrum analysis task of claim 1-5, and this music frequency spectrum display device comprises:
The audio decoder module is used to obtain original audio data, and this voice data decoded generates original audio digital signals;
The waveform transformation module is used for the Wave data of this audio digital signals is carried out the conversion of time-domain signal to frequency-region signal, forms this waveform in each frequency band amplitude size distribution data;
The waveform display module is used for this this waveform is shown through bar chart in each frequency band amplitude size distribution data.
This device also comprises:
The signal sampling module is used for the decoded audio digital signals of audio decoder module is sampled, and once sampling digital signal is at set intervals obtained the Wave data of this digital signal, and this Wave data is sent to the waveform transformation module.
The described frequency that digital signal is sampled is 2 ~ 4 times of quilt sampling wave frequency, is preferably 3 times.
The present invention also provides a kind of music player that comprises above-mentioned music frequency spectrum display device, it is characterized in that, this device also comprises the voice data memory module, is used for stores audio data; The voice data read module is used for the access stored module, and reads the voice data of storing in the memory module, and these data are sent to the audio decoder module; Audio A/D modular converter is used to obtain audio digital signals, and the audio frequency simulation digital signal transition is become audio analog signals; Audio playing module is used to obtain audio analog signals, and with after this audio analog signals amplification filtering; Externally play back in the power amplifier; It is characterized in that behind the described audio decoder module decoded portion voice data, described data are replicated two parts; Send to audio A/D modular converter and waveform transformation module respectively simultaneously, convert voice signal and frequency spectrum graphics respectively to.
Described music player also is provided with control module, is used to control the opening and closing of frequency spectrum display device.
Beneficial technical effects of the present invention is:
The present invention has enriched the dynamic rhythm of music through in music player, adding frequency spectrum display device, gives the user with the dynamic direct feel of music.
Through frequency spectrum analysis method reasonable in design, reduced the computational load of processor.
[description of drawings]
Fig. 1 is the process flow diagram of embodiment 1 frequency spectrum analysis method;
Fig. 2 is the oscillogram of digital signal of the present invention;
Fig. 3 is the process flow diagram of embodiment 2 frequency spectrum analysis methods;
Fig. 4 is the structured flowchart of embodiment 3 frequency spectrum display devices;
Fig. 5 is the structured flowchart of embodiment 4 frequency spectrum display devices;
Fig. 6 is a spectrogram of the present invention;
Fig. 7 is embodiment 5 music player structured flowcharts.
[embodiment]
The music player that the present invention designs a kind of music frequency spectrum analytical approach, utilizes this frequency spectrum analysis method to obtain the frequency spectrum device shown and include this frequency spectrum display device.Below in conjunction with embodiment the present invention is done further elaboration and explanation:
Embodiment 1
Like Fig. 1, a kind of Wave data the music crude sampling converts the waveform method of the intensity of sound size distribution situation of the frequency band that can hear of people's ear at a time into, i.e. music frequency spectrum analytical approach, and this method comprises:
101, obtain the Wave data of the digital signal that generates behind the audio decoder.This step is specially; The audio decoder module generates audio digital signals 1011 after digital audio file is decoded, and has comprised the Wave data of sound crude sampling in this audio digital signals, duplicates this audio digital signals 1012; Described audio digital signals comprises left channel signals and right-channel signals; The Wave data that extracts one of them sound channel signal is as the Wave data 1013 that will change, and said Wave data is as shown in Figure 2.
102, this Wave data is carried out the conversion of time-domain signal to frequency-region signal.Said time-domain signal is that the ripple of a certain frequency is the x axle with the time shaft; With the amplitude is the Wave data of y axle; Said frequency-region signal is the frequency spectrum data in a certain moment of y axle with the amplitude for being the x axle with the frequency, the operand when time-domain signal is transformed into frequency-region signal and need uses Fourier conversion and can reduce data-switching; Because the Wave data of the digital signal behind the process audio decoder is for being discrete data, so can change with the fast discrete Fourier mapping algorithm.
When carrying out FFT; The frequency domain sequence of time domain sequences and output is all arranged according to natural order; Adopting this kind method with dacimation-in-time odd even decomposition method time domain sequences to be decomposed with frequency domain sequence compares; Though the intermediate storage unit that takies in the intermediate operations process is bigger than the intermediate storage unit that takies, its operand is littler than dacimation-in-time odd even decomposition method
Embodiment 2
On the basis of embodiment 1; In order to save the occupancy of intermediate storage unit; And the reduction operand, further comprise 1014 at the Wave data that extracts one of them sound channel signal as after the Wave data step that will change: once sampling digital signal at set intervals; Obtain the Wave data of this digital signal, the described frequency that digital signal is sampled is 3 times by the sampling wave frequency.
Embodiment 3
As shown in Figure 4, the present invention also provides a kind of music frequency spectrum display device 20, and this device adopts arm processor to handle like embodiment 1 described music frequency spectrum analysis task, and this frequency spectrum display device comprises:
Audio decoder module 201 is used to obtain original audio data, and this voice data decoded generates original audio digital signals;
Waveform transformation module 202 is used for the Wave data of this audio digital signals is carried out the conversion of time-domain signal to frequency-region signal, and the ripple that forms this each frequency band is in section amplitude size distribution data sometime;
Waveform display module 203 is used for this this waveform is shown through bar chart in each frequency band amplitude size distribution data.
After decoding, 201 pairs of digital audio files of audio decoder module generate audio digital signals; The Wave data that has comprised the sound crude sampling in this audio digital signals; Said arm processor duplicates this audio digital signals, and described audio digital signals comprises left channel signals and right-channel signals, and said arm processor extracts the Wave data of one of them sound channel signal as the Wave data that will change; Change through 202 pairs of Wave datas of waveform transformation module; Said to waveform convert the conversion of time-domain signal into to frequency-region signal, adopt the fast discrete Fourier mapping algorithm to change during conversion, in arm processor and storage unit, accomplish when handling this algorithm; After from the time-domain signal to the frequency-region signal, changing; The ripple that forms this each frequency band is in section amplitude size distribution data sometime, through waveform display module 203 ripple of each frequency band is shown through bar chart in the amplitude size distribution data of section sometime, the distributed data of each time period all with continuous the showing of bar pattern; Just form a continuous spectrogram, as shown in Figure 6.
Embodiment 4
On the basis of the foregoing description 3, as shown in Figure 5, described music frequency spectrum display device also comprises:
Signal sampling module 204; Said signal sampling module 204 is sampled to the Wave data of one of them sound channel signal; Once sampling digital signal at set intervals; Obtain the Wave data of this digital signal, and this Wave data is sent to the waveform transformation resume module, the described frequency that digital signal is sampled is 3 times by the sampling wave frequency.
Embodiment 5
As shown in Figure 7, the present invention also provides a kind of music player 30, and described music player 30 comprises embodiment 4 described music frequency spectrum display devices 20, and this music player 30 also comprises voice data memory module 301, is used for stores audio data; Voice data read module 302 is used for access stored module 301, and reads the voice data of storage in the memory module 301, and these data are sent to audio decoder module 201; Audio A/D modular converter 303 is used to obtain audio digital signals, and the audio frequency simulation digital signal transition is become audio analog signals; Audio playing module 304; Be used to obtain audio analog signals, and, externally play back in the power amplifier after this audio analog signals amplification filtering; Behind the described audio decoder module 201 decoded portion voice datas; Said data after decoded are copied into two parts by arm processor 1, send to audio A/D modular converter 303 and waveform transformation module 202 respectively simultaneously, convert voice signal and frequency spectrum graphics respectively to.
Described music player also is provided with control module 305, is used to control the opening and closing of frequency spectrum display device 20.
As shown in Figure 8, the principle of work of said music player is following:
Frequency spectrum display device 20 is along with music player 30 together starts; The voice data read module 302 of music player reads audio file from voice data memory module 301, the data of this audio file are sent out to 201 decodings of data decode module, form audio digital signals; It is a that arm processor 1 duplicates this audio digital signals; Send to waveform transformation module 202 and handle, simultaneously, original portion is sent to audio A/D modular converter 303 by arm processor 1; The audio digital signals that is sent out to audio A/D modular converter 303 is converted into audio analog signals; This audio analog signals through after the simulating signal amplification filtering, externally plays back in the power amplifier in audio playing module 304, comprises a L channel and a R channel and be sent out the audio digital signals of handling to waveform transformation module 202; The Wave data that arm processor 1 extracts one of them sound channel carries out spectrum analysis; Signal sampling module 204 is sampled to the Wave data of one of them sound channel signal, and once sampling digital signal is at set intervals obtained the Wave data of this digital signal; And this Wave data sent to the waveform transformation resume module; The described frequency that digital signal is sampled is for by 3 times of sampling wave frequency, and the Wave data after waveform transformation module 202 adopts the fast discrete Fourier mapping algorithms to sampling carries out the conversion of time-domain signal to frequency-region signal, and the ripple that forms this each frequency band is in section amplitude size distribution data sometime; Through waveform display module 203 ripple of each frequency band is shown through bar chart in the amplitude size distribution data of section sometime, the distributed data of each time period all with continuous the showing of bar pattern.
Described music player 30 also is provided with control module 305; Be used to control the opening and closing of frequency spectrum display device 20; When frequency spectrum display device 20 is closed; Frequency spectrum does not show in music player 30 that spectrum analysis is not operation in arm processor 1 also, and the music playback function of music player still can use.
What should explain is; Above embodiment is only unrestricted in order to technical scheme of the present invention to be described; Although with reference to preferred embodiment the present invention is specified, those of ordinary skill in the art should be appreciated that and can make amendment or be equal to replacement technical scheme of the present invention; And not breaking away from the spirit and the scope of technical scheme of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.