How to obtain a function from a sound?
古いコメントを表示
Hi! I have to work in a project where I have to analyze a piece of a song with different tools like the Fourier Transform. I have the audio and I know how to load and plot it but how can I obtain a function from the audio?
For example, a sine function of something similar.
回答 (1 件)
Walter Roberson
2020 年 8 月 30 日
0 投票
When you read the audio in to an array, such as with audioread(), then what you get out is an array of data.
After that, the computation routines such as fft() or spectrogram() do not care how you got the data; they don't care whether you read it from a .wav, or pulled it out of the soundtrack for a movie, or recorded it out of midi sythesizer: they only care that you pass them data.
So you should be splitting your thoughts into two independent tasks: (1) reading the audio to produce an array of data; and (2) processing arrays of data.
There is, for example, no audiofft() function to process audio data: there is just fft() because the fft calculation does not care how you got the data.
5 件のコメント
Luis Zuniga
2020 年 8 月 31 日
Walter Roberson
2020 年 8 月 31 日
fft() will give me the function of the array right
If you pass in a vector to fft() then it will calculate the discrete fourier transform of the vector.
If you pass in a 2D array to fft() then it will calculae the discrete fourier transform of each column independently. This can be useful because when you read in audio, the data is arranged with one column for each channel, so fft() of such an array would process each channel independently.
Stephen23
2020 年 8 月 31 日
"...fft() will give me the function of the array right?"
What exactly do you mean by "the function of the array"?
For any finite set of data values there are infinite possible functions that will fit those values. Which of those infinite functions do you want? For example, please tell us the exact "function of the array" for this array:
V = [1,0,23e5,-5,77]
Luis Zuniga
2020 年 9 月 1 日
Walter Roberson
2020 年 9 月 1 日
https://www.mathworks.com/matlabcentral/answers/48717-create-a-piece-of-music-using-matlab
カテゴリ
ヘルプ センター および File Exchange で Audio I/O and Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!