CN107180636B - Audio data acquisition method based on Fourier transform of android system - Google Patents

Audio data acquisition method based on Fourier transform of android system Download PDF

Info

Publication number
CN107180636B
CN107180636B CN201710357361.5A CN201710357361A CN107180636B CN 107180636 B CN107180636 B CN 107180636B CN 201710357361 A CN201710357361 A CN 201710357361A CN 107180636 B CN107180636 B CN 107180636B
Authority
CN
China
Prior art keywords
frequency
fourier transform
audio data
squaring
data acquisition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710357361.5A
Other languages
Chinese (zh)
Other versions
CN107180636A (en
Inventor
鲁霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xinzhongxin Technology Co Ltd
Original Assignee
Shenzhen Xinzhongxin Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xinzhongxin Technology Co Ltd filed Critical Shenzhen Xinzhongxin Technology Co Ltd
Priority to CN201710357361.5A priority Critical patent/CN107180636B/en
Publication of CN107180636A publication Critical patent/CN107180636A/en
Application granted granted Critical
Publication of CN107180636B publication Critical patent/CN107180636B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/02Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis using spectral analysis, e.g. transform vocoders or subband vocoders
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L25/00Speech or voice analysis techniques not restricted to a single one of groups G10L15/00 - G10L21/00
    • G10L25/03Speech or voice analysis techniques not restricted to a single one of groups G10L15/00 - G10L21/00 characterised by the type of extracted parameters
    • G10L25/18Speech or voice analysis techniques not restricted to a single one of groups G10L15/00 - G10L21/00 characterised by the type of extracted parameters the extracted parameters being spectral information of each sub-band

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • Auxiliary Devices For Music (AREA)
  • Complex Calculations (AREA)

Abstract

The invention relates to an audio data acquisition method based on Fourier transform of an Android system, which is characterized in that Android MediaPlayer APIs are used for instantiating a Visualizer to bind a music player; initializing a Visualizer; converting the continuous signal (waveform) intensity in time domain into discrete frequency domain signal (frequency spectrum); calculating each frequency, namely squaring the real part of the FFT and the corresponding imaginary part, adding the squared parts, and then squaring, namely squaring and modulus; calculating a weighted average value for the frequency domain data of each segment; the result of the calculation is compared with the spectrum of the file. The invention has the beneficial effects that: the method solves the problem that the information of the Android audio file obtained in the prior art is less; fourier transform and the weighted average are combined, and the calculation method is accurate and reliable, so that more audio data can be acquired on the Android platform.

Description

Audio data acquisition method based on Fourier transform of android system
Technical Field
The utility model relates to an tall and erect system multimedia technology field of ann, in particular to audio data acquisition method based on tall and erect system Fourier transform of ann.
Background
At present, the android system platform is increasingly rich in functions, but the native android system multimedia framework has limited support for capturing and encoding audio in multiple formats, and has few analysis interfaces for audio files, such as: there is no interface for extracting spectral, pitch, intensity, and timbre information in the audio signal. The diversified requirements of the users cannot be met.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method for acquiring the audio data based on the Fourier transform of the android system solves the problem that the existing method for acquiring the audio file information of the android system is few in the related art, can effectively acquire parameters such as frequency spectrum, volume and the like of the audio file, is simple, has accurate results, and is a trend of wide application in industries such as acquiring the audio file of the android system at present.
In order to solve the technical problem, the invention provides an audio data acquisition method based on the Fourier transform of an android system, which is characterized in that a Visualizer is instantiated by using MediaPlayer APIs in the android system to bind a music player; converting the continuous signal intensity in the time domain into a discrete frequency domain signal; further, the continuous signal is a waveform signal; the discrete frequency domain signal is a frequency spectrum signal; further, square modulus: calculating each frequency, squaring the real part of FFT and the corresponding imaginary part, adding the squared parts, and squaring; calculating a weighted average value for the frequency domain data of each segment; comparing the calculated result with the frequency spectrum of the file;
further optimizing, the Android Fourier transform-based audio data acquisition method comprises the following working steps:
a. instantiating a Visualizer by using Android media Player APIs, and binding a music player;
b. initializing a Visualizer;
c. converting the continuous signal (waveform) intensity in time domain into discrete frequency domain signal (frequency spectrum);
d. calculating each frequency, namely squaring the real part of the FFT and the corresponding imaginary part, adding the squared parts, and then squaring, namely squaring and modulus;
e. calculating a weighted average value for the frequency domain data of each segment;
f. the result of the calculation is compared with the spectrum of the file.
Further optimized, the parameter SessionId is obtained through the object of MediaPlayer.
Further optimization, the calculated weighted average can reflect the actual frequency and volume. The error rate is adopted for evaluating the extraction of the audio data, the extracted beat number is compared with the actual beat number of the file, the time error is less than 50ms, and the error rate is not more than 5% through actual measurement of a plurality of pieces of music.
Error rate =
Figure 609117DEST_PATH_IMAGE001
*100%
Further optimized, the butterfly transform twiddle factor of the fast Fourier transform algorithm is
Figure 6600DEST_PATH_IMAGE002
The cosine term (real part) in the decomposed complex form is the same as the cosine term of the FFT algorithm, and the sign bit of the sine term (imaginary part) is just as same as the sine term of the FFT algorithmIn contrast, the algorithm implements a table of sine and cosine terms in FFT _ HANDLE.
Extracting N frequencies according to a frequency domain in a certain continuous interval to obtain N sampling points, wherein the inverse discrete Fourier transform formula of each sampling point is as follows:
Figure 548571DEST_PATH_IMAGE003
after the technical scheme is adopted, the invention has the beneficial effects that:
compared with the prior art, the method and the device solve the problem that the information of the Android audio file obtained in the prior art is less; fourier transform and the weighted average are combined, and the calculation method is accurate and reliable, so that more audio data can be acquired on the Android platform.
Drawings
FIG. 1 is a flow chart of the audio data acquisition method based on the Fourier transform of the android system
Detailed Description
The invention will now be described in detail with reference to the accompanying figure 1, which shows an embodiment of the invention, but is not intended to limit the invention thereto.
As shown in fig. 1, in an audio data acquisition method based on the fourier transform of the android system, a Visualizer is instantiated by MediaPlayer APIs in the android system, and a music player is bound; converting the continuous signal intensity in the time domain into a discrete frequency domain signal; further, the continuous signal is a waveform signal; the discrete frequency domain signal is a frequency spectrum signal; further, square modulus: calculating each frequency, squaring the real part of FFT and the corresponding imaginary part, adding the squared parts, and squaring; calculating a weighted average value for the frequency domain data of each segment; comparing the calculated result with the frequency spectrum of the file;
the Android Fourier transform-based audio data acquisition method comprises the following working steps:
a. instantiating a Visualizer by using Android media Player APIs, and binding a music player;
b. initializing a Visualizer;
c. converting the continuous signal (waveform) intensity in time domain into discrete frequency domain signal (frequency spectrum);
d. calculating each frequency, namely squaring the real part of the FFT and the corresponding imaginary part, adding the squared parts, and then squaring, namely squaring and modulus;
e. calculating a weighted average value for the frequency domain data of each segment;
f. the result of the calculation is compared with the spectrum of the file.
The implementation mode mainly comprises the following steps:
s101, instantiating a Visualizer by using Android media Player APIs to bind a music player;
in an embodiment of the invention, instantiate a Visualizer:
mVisualizer = new Visualizer(playBinder.getAudioSessionId());
the parameter SessionId can be obtained by the object of MediaPlayer.
S102, initializing a Visualizer;
in an embodiment of the invention, the length of the music content to be converted is then set, which in professional terms is a sample, which is typically an exponential multiple of 2, e.g. 64,128,256,512,1024. In analyzing signals with dense spectra, we require that the smaller the frequency resolution Δ f, the better, and that the sampling frequency fs must be kept large to contain all the frequency components that are destined for analysis. Meanwhile, the length of the sampling data can be increased without reducing the sampling rate while the resolution is improved. This means that the operation rate and analysis efficiency will be reduced. In the API interface document, it is said that array [0] is the minimum (128) and array [1] is the maximum (1024), where 128 is set by comparison:
mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[0])。
s103, converting the continuous signal (waveform) intensity in the time domain into discrete frequency domain signal (frequency spectrum);
in the embodiment of the present invention, a listener is set for the revitalizer, and there are 4 parameters in total, the first is the listener, the second unit is mhz, which indicates the acquisition frequency, the third is whether to acquire the waveform, and the fourth is whether to acquire the frequency:
mVisualizer.setDataCaptureListener(mVisualizerListener, Visualizer.getMaxCaptureRate() / 2, false, true);
the mVisualizerListener table listens to the function, and the anonymous internal class implements the interface, which needs to implement two functions.
mVisualizer.setEnabled(true)
After the above parameter setting is completed, the audio data analysis function is started.
S104, calculating each frequency, namely squaring the real part of the FFT and the corresponding imaginary part, adding the squared real part and the corresponding imaginary part, and then squaring, namely squaring and modulus;
the butterfly transform twiddle factor of the inverse fast Fourier transform algorithm is
Figure 627385DEST_PATH_IMAGE002
The cosine term (real part) in the decomposed complex form is the same as the cosine term of the FFT algorithm, and the sign bit of the sine term (imaginary part) is just opposite to the sine term of the FFT algorithm, so the algorithm implementation can still use the sine term and cosine term table in FFT _ HANDLE.
Now, assuming that N frequencies are extracted according to the frequency domain in a certain continuous interval to obtain N sampling points, the inverse discrete fourier transform formula of each sampling point is:
Figure 187680DEST_PATH_IMAGE003
in an embodiment of the invention, data related to fast fourier transform is collected:
public void onFftDataCapture(Visualizer visualizer,byte[] fft, int samplingRate)
the real part and the corresponding imaginary part are squared and then added and then squared:
byte[] model = new byte[fft.length / 2 + 1];
model[0] = (byte) Math.abs(fft[1]);
int j = 1;
for (int i = 2; i < fft.length; ) {
model[j] = (byte) Math.hypot(fft[i], fft[i + 1]);
i += 2;
j++;
}
s105, calculating a weighted average value for the frequency domain data of each section;
in the embodiment of the present invention, in order to avoid the frequency roll-off of the high frequency part, the frequency domain data needs to be pre-weighted to smooth the audio data. And finding a central frequency point in each band, uniformly taking two frequency points from the central frequency point to the left and the right respectively, and adding the central frequency point to acquire values of 19 frequency points for calculation. The calculation method is to give different weights to the 19 points, the weight of the middle point is the highest, and the weights are sequentially reduced towards two sides, and then the weighted average of the 19 points is calculated.
In the embodiment of the present invention, the weights assigned to these 19 points are: the central point 1, two points adjacent to the central point are 0.9, and so on, the distance from the central point is different by one point, the value of the weight is different by 0.1, and the two points calculated to the outermost edge are 0.1.
S106, comparing the calculated result with the frequency spectrum of the file.
The weighted average thus calculated is more reflective of the actual frequency and volume magnitudes. The extraction of the audio data is evaluated by adopting an error rate, for example, the extracted beat number is compared with the actual file beat number (the time error is less than 50 ms), and the error rate is actually measured on a plurality of pieces of music and is not more than 5%.
Error rate =
Figure 294349DEST_PATH_IMAGE001
*100%
Converting the audio signal in the time domain into the frequency domain for analysis: acquiring frequency characteristics of a dialing audio; acquiring the volume of an audio file; and performing gain or attenuation calculation on the specific frequency, and finally converting the result into a time domain, thereby realizing the modification of the tone color of the audio.
In the embodiment of the present invention, the weighted average value calculated in this way is more reflective of the actual frequency and volume level.
It will be appreciated by those skilled in the art that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The embodiments disclosed above are therefore to be considered in all respects as illustrative and not restrictive. All changes which come within the scope of or equivalence to the invention are intended to be embraced therein.

Claims (5)

1. An audio data acquisition method based on Fourier transform of an android system is characterized in that: instantiating a Visualizer by using MediaPlayer APIs in the android system, and binding a music player; converting continuous signal intensity in a time domain into discrete frequency domain signals, setting a monitor for a visualizer, wherein the monitor has 4 parameters, the first parameter is a monitor, the second unit is millihertz and represents the acquisition frequency, the third parameter is whether to acquire a waveform, and the fourth parameter is whether to acquire the frequency; further, the continuous signal is a waveform signal; the discrete frequency domain signal is a frequency spectrum signal; further, square modulus: calculating each frequency, squaring the real part of FFT and the corresponding imaginary part, adding the squared parts, and squaring; calculating a weighted average value of the frequency domain data of each section, performing pre-weighting processing on the frequency domain data to smooth the audio data in order to avoid frequency range dropping of a high-frequency part, finding a central frequency point in each band, uniformly and respectively taking two frequency points from the central frequency point to the left and the right, adding the central frequency point to acquire values of 19 frequency points for calculation, wherein the calculation method is that the 19 points are endowed with different weights, the weight of the middle point is the highest, the weights are sequentially reduced towards the two sides, and then calculating the weighted average value of the 19 points; the result of the calculation is compared with the spectrum of the file.
2. The android system Fourier transform-based audio data acquisition method of claim 1, wherein: the Android Fourier transform-based audio data acquisition method comprises the following working steps:
a. instantiating a Visualizer by using Android media Player APIs, and binding a music player;
b. initializing a Visualizer;
c. converting the continuous signal (waveform) intensity in time domain into discrete frequency domain signal (frequency spectrum);
d. calculating each frequency, namely squaring the real part of the FFT and the corresponding imaginary part, adding the squared parts, and then squaring, namely squaring and modulus;
e. calculating a weighted average value for the frequency domain data of each segment;
f. the result of the calculation is compared with the spectrum of the file.
3. Audio data acquisition method based on android system Fourier transform is characterized in that: the parameter SessionId is obtained by the object of MediaPlayer.
4. The android system Fourier transform-based audio data acquisition method according to claim 2, wherein: the calculated weighted average value can reflect the actual frequency and volume; the error rate is adopted for evaluating the extraction of the audio data, the extracted beat number is compared with the actual beat number of the file, the time error is less than 50ms, and the error rate is not more than 5% by actually measuring a plurality of pieces of music;
Figure FFW0000021628390000021
5. the android system Fourier transform-based audio data acquisition method according to claim 2, wherein: the butterfly transform twiddle factor of the inverse fast Fourier transform algorithm is
Figure FFW0000021628390000022
The cosine term (real part) in the decomposed complex form is the same as the cosine term of the FFT algorithm, and the sign of the sine term (imaginary part)The bit is just opposite to the sine item of the FFT algorithm, and the algorithm is realized by using a sine item and cosine item table in FFT _ HANDLE;
extracting N frequencies according to a frequency domain in a certain continuous interval to obtain N sampling points, wherein the inverse discrete Fourier transform formula of each sampling point is as follows:
Figure FFW0000021628390000023
CN201710357361.5A 2017-05-19 2017-05-19 Audio data acquisition method based on Fourier transform of android system Active CN107180636B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710357361.5A CN107180636B (en) 2017-05-19 2017-05-19 Audio data acquisition method based on Fourier transform of android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710357361.5A CN107180636B (en) 2017-05-19 2017-05-19 Audio data acquisition method based on Fourier transform of android system

Publications (2)

Publication Number Publication Date
CN107180636A CN107180636A (en) 2017-09-19
CN107180636B true CN107180636B (en) 2020-12-18

Family

ID=59832297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710357361.5A Active CN107180636B (en) 2017-05-19 2017-05-19 Audio data acquisition method based on Fourier transform of android system

Country Status (1)

Country Link
CN (1) CN107180636B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110807169B (en) * 2020-01-08 2020-04-03 易兆微电子(杭州)有限公司 Fast processing method for audio signal

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635160A (en) * 2009-06-17 2010-01-27 深圳市美赛达科技有限公司 Music frequency spectrum analyzing method, music frequency spectrum display device and music playing device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8903802B2 (en) * 2008-03-06 2014-12-02 Cisco Technology, Inc. Systems and methods for managing queries

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635160A (en) * 2009-06-17 2010-01-27 深圳市美赛达科技有限公司 Music frequency spectrum analyzing method, music frequency spectrum display device and music playing device

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
基于Android平台音频播放系统设计与实现;赵金龙;《中国优秀硕士学位论文全文数据库》;20130331;全文 *
基于FPGA的FFT/IFFT处理器的实现;孙阳,余锋;《中国学术期刊网络出版总库》;20021231;第2节公式2 *
简易简谱的实时显示研究与设计;郭之亨;《中国优秀硕士学位论文全文数据库》;20170331;36-37页 *
郭之亨.简易简谱的实时显示研究与设计.《中国优秀硕士学位论文全文数据库》.2017, *

Also Published As

Publication number Publication date
CN107180636A (en) 2017-09-19

Similar Documents

Publication Publication Date Title
CN103971689B (en) A kind of audio identification methods and device
CN102857852B (en) Method for processing playback array control signal of loudspeaker of sound-field quantitative regeneration control system
CN106919662A (en) A kind of music recognition methods and system
Chen et al. Wavelet‐domain audio watermarking using optimal modification on low‐frequency amplitude
CN103854646A (en) Method for classifying digital audio automatically
CN112017693B (en) Audio quality assessment method and device
CN110191071A (en) Measurement method and device based on channel estimation in a kind of narrowband Internet of things system
CN111640411B (en) Audio synthesis method, device and computer readable storage medium
CN109920446A (en) A kind of audio data processing method, device and computer storage medium
CN108021635A (en) The definite method, apparatus and storage medium of a kind of audio similarity
CN110085259A (en) Audio comparison method, device and equipment
CN107180636B (en) Audio data acquisition method based on Fourier transform of android system
CN110350993A (en) A kind of black broadcast automatic discovering method based on networking monitoring under big data scene
CN109034043A (en) Based on the synchronous nonstationary random response method for extracting transformation of high-order
CA2743613C (en) Precision measurement of waveforms
CN109271501A (en) A kind of management method and system of audio database
CN117037840A (en) Abnormal sound source identification method, device, equipment and readable storage medium
CN101609675B (en) Fragile audio frequency watermark method based on mass center
WO2019229738A1 (en) System for decomposition of digital sound samples into sound objects
CN110415722A (en) Audio signal processing method, storage medium, computer program and electronic equipment
WO2022078164A1 (en) Sound quality evaluation method and apparatus, and device
CN115435895A (en) Background noise measuring method based on probability distribution function
CN114580470A (en) OFDM and UFDM multi-carrier signal identification method based on non-uniform quantization graph characteristics
CN115410602A (en) Voice emotion recognition method and device and electronic equipment
CN101676992A (en) Method for analyzing echo steganography

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant