[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 invention provides a kind of music frequency spectrum analytical approach, 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.
Described 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 fast fourier transform, the frequency domain sequence of time domain sequences and output is all arranged according to natural order.
Comprise further after the described 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 to be sampled 2 ~ 4 times of wave frequency, is preferably 3 times.
The present invention also provides a kind of music frequency spectrum display device, this device adopt arm processor handle as claim 1-5 arbitrary as described in the music frequency spectrum analysis task, 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 by 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 to be sampled 2 ~ 4 times of 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 to visit memory 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, be 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 by add frequency spectrum display device in music player, gives the user direct feel with the music innervation.
By frequency spectrum analysis method reasonable in design, reduced the computational load of processor.
[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.The present invention is further elaborated and explanation below in conjunction with embodiment:
Embodiment 1
As Fig. 1, a kind of Wave data the music crude sampling is converted to 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, 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, the Wave data that has comprised the sound crude sampling in this audio digital signals, duplicate 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, described Wave data, as shown in Figure 2
102, this Wave data is carried out the conversion of time-domain signal to frequency-region signal.Described 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, described frequency-region signal is for being the x axle with the frequency, with the amplitude is the frequency spectrum data in a certain moment of y axle, 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 fast fourier transform, 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 reduction operand, further comprise as after the Wave data step that will change at the Wave data that extracts one of them sound channel signal, 1014: once sampling digital signal at set intervals, obtain the Wave data of this digital signal, the described frequency that digital signal is sampled is to be sampled 3 times of 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 as 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 by 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, described arm processor duplicates this audio digital signals, described audio digital signals comprises left channel signals and right-channel signals, described arm processor extracts the Wave data of one of them sound channel signal as the Wave data that will change, change by 202 pairs of Wave datas of waveform transformation module, described waveform is converted to the conversion of time-domain signal to frequency-region signal, adopt the fast discrete Fourier mapping algorithm to change during conversion, in arm processor and storage unit, finish 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, by waveform display module 203 ripple of each frequency band is shown by 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, described 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 sent to the waveform transformation resume module, the described frequency that digital signal is sampled is to be sampled 3 times of 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 to visit memory 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 with after this audio analog signals amplification filtering, externally play back in the power amplifier, behind the described audio decoder module 201 decoded portion voice datas, described 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 described music player is as follows:
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 to 201 decodings of data decode module, form audio digital signals, arm processor 1 duplicates this audio digital signals portion, sending to waveform transformation module 202 handles, simultaneously, original portion is sent to audio A/D modular converter 303 by arm processor 1, the audio digital signals that is sent to audio A/D modular converter 303 is converted into audio analog signals, this audio analog signals passes through the simulating signal amplification filtering in audio playing module 304 after, externally play back in the power amplifier, and the audio digital signals that is sent to 202 processing of waveform transformation module comprises a L channel and a R channel, 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, once sampling digital signal at set intervals, obtain 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 to be sampled 3 times of wave frequency, Wave data after waveform transformation module 202 adopts the fast discrete Fourier mapping algorithm to sampling carries out the conversion of time-domain signal to frequency-region signal, the ripple that forms this each frequency band is in section amplitude size distribution data sometime, by waveform display module 203 ripple of each frequency band is shown by 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, spectrum analysis is not operation in arm processor 1 also, and the music playback function of music player still can use.
It should be noted that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not breaking away from the spirit and scope of technical solution of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.