# Compute the fft of the record of my voice

16 visualizzazioni (ultimi 30 giorni)
Riccardo Barbero il 15 Mar 2016
Risposto: richard onipede il 10 Dic 2019
This is my starting code:
a=audiorecorder(8000,8,1);
record(a)
% recording for some seconds, don't remember how many...
stop(a)
data=getaudiodata(a);
plot(data)
I obtained this.
How can I know the duration of the recording (because on the x-axis there are not the seconds...)?
Onother question: how can I compute the fft and find the frequency spectrum of this signal?
Thank you!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Rick Rosson il 15 Mar 2016
N = length(data);
Fs = 8000;
dt = 1/Fs;
t = dt*(0:N-1)';
figure;
plot(t,data);
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Riccardo Barbero il 15 Mar 2016
Perfect! Thank you Rick!
So, the following is the correct signal in time-domain:
(I called the signal "Emi" because is the name of my girlfriend and this is her voice ;))
However, for the fft, i did as follow:
datafft=fft(data);
datafft_abs=abs(datafft/N);
datafft_abs=datafft_abs(1:N/2+1);
f=Fs*(0:N/2)/N;
figure;
plot(f,datafft_abs)
Doing this, I obtained the follow spectrum:
Is it correct? I have doubts about the y scale representing the amplitude of spectrum...

Accedi per commentare.

richard onipede il 10 Dic 2019
a=audiorecorder(8000,8,1);
record(a)
% recording for some seconds, don't remember how many...
stop(a)
data=getaudiodata(a);
plot(data)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Discrete Fourier and Cosine Transforms in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by