how implement FFT to ringtone/music

2 次查看(过去 30 天)
I have generated a ringtone is "twinkle twinkle little start", but I need to determine its frequency doamin. Can someone help me how to generate a FFT from these tone.
clear; clc;
Fs=1800;
Ts=1/Fs;
Ns=Fs;
t=[0:Ts:0.5];
k=2;
C4 = sin(2*pi*261.6*t);
D4 = sin(2*pi*293.7*t);
E4 = sin(2*pi*329.2*t);
F4 = sin(2*pi*349.2*t);
G4 = sin(2*pi*392.0*t);
A4 = sin(2*pi*440.0*t);
C4_H = sin(2*pi*k*261.6*t);
D4_H = sin(2*pi*k*293.7*t);
E4_H= sin(2*pi*k*329.2*t);
F4_H= sin(2*pi*k*349.2*t);
G4_H= sin(2*pi*k*392.0*t);
A4_H= sin(2*pi*k*440.0*t);
Line1 = [C4 C4 G4 G4 A4 A4 G4];
Line2 = [F4 F4 E4 E4 D4 D4 C4];
Line1_H = [C4_H C4_H G4_H G4_H A4_H A4_H G4_H];
Line2_H = [F4_H F4_H E4_H E4_H D4_H D4_H C4_H];
x1=[Line1 Line2];
x2=[Line1_H Line2_H];

回答(1 个)

Kaashyap Pappu
Kaashyap Pappu 2019-11-26
As Walter mentioned, you can use the fft function to carry out the Fast Fourier Transform operation using one the of the examples provided within the documentation. If you are interested in a 2-sided spectrum, you can use fftshift function to make the zero frequency point to be the center value of the array.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by