how implement FFT to ringtone/music

1 view (last 30 days)
Tham Wei Jian on 23 Nov 2019
Answered: Kaashyap Pappu on 26 Nov 2019
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];
Walter Roberson on 23 Nov 2019
See the first example in the fft() documentation.

Kaashyap Pappu on 26 Nov 2019
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!