help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Acoustics


From: Daniel Arteaga
Subject: Re: Acoustics
Date: Wed, 24 Nov 2010 12:27:34 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; ca-ES; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

Al 21/11/10 16:54, En/na Martin Maxino ha escrit:

Will anyone please direct me to examples of how to use Octave to analyze
sound (FFTs, etc.).

It would be greatly appreciated.

For instance, to analyze the spectrum of an audio file:

[audio,fs] = wavread ("audiofile.wav");
n = length(audio);              #Number of samples
t = n/fs;                       #Duration in s
N = floor(n/2);                 
temp = fft(audio,2*n+1);
dc = temp(1);                   
audio_fft = temp(2:n+1);        
freq_vector = linspace(0,fs,2*n+1)(2:n+1);
spectrum_dB = 20*log10(abs(audio_fft));
phase = arg(audio_fft);
figure;
semilogx(freq_vector,spectrum_dB);
figure;
semilogx(freq_vector,phase);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]