How to find a music signal Fourier transform

Source: Internet
Author: User

% ask for a music signal spectrum

[Y,fs]=audioread (' gem.wav '); % read in a music signal

Plot (Y); % display of music original music waveform

Sound (Y,FS)% play music (at the original frequency) change FS can change the playback frequency

Y1=y (:, 1); % dual channel becomes single lane

Size (Y1)

Figure

Subplot (2,1,1);

Plot (Y); % Display Original signal waveform

N=length (Y1);

F1=fft (Y1); % Fourier transform

W=2/N*[0:N/2-1];

Subplot (2,1,2);

Plot (W,abs (F1 (1:N/2))); % Display waveform



Clear

[X,fs]=audioread (' gem.wav '); % FS Sample Frequency

% T = 1/fs; % Sample Time

L = length (x); % signal length

% T = (0:l-1) *t; % Time Vector

Nfft = 2^nextpow2 (L); % calculated Nextpow2 (l) =18 2^18=262144 slightly greater than L

X = FFT (X,NFFT)/L;

f = fs/2*linspace (0,1,NFFT/2); %linspace (0,1,m) means dividing between 0 and 1 evenly into m parts.

Plot (F,2*abs (X (1:NFFT/2)))

Title (' Y (t) single-sided amplitude spectrum ')

Xlabel (' Frequency (Hz) ')

Ylabel (' | Y (f) | ')


Technical White, write a program about MATLAB about the Fourier transform, to show a novice like me to learn a year of signal and system or do not know what is the use of Fourier transform, what is the point? I hope this program is helpful to others.

This article is from the "9188727" blog, please be sure to keep this source http://9198727.blog.51cto.com/9188727/1588103

How to find a music signal Fourier transform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.