echo47
Joined: 07 Apr 2002 Posts: 4212 Helped: 564
|
28 May 2008 16:27 voice record by matlab |
|
|
|
I'm not sure what you mean by real time, or where you want to record it, but maybe you can get some ideas from this little audio spectrum analyzer:
| Code: |
% Audio spectrum display. To exit, close the figure.
%
fs = 22050; % sample rate, hertz
N = 1024; % duration, samples
window = blackman(N); % weighting
window = window / mean(window); % normalize it
gca; % open the figure
while get(0,'CurrentFigure') % while figure still open
y = wavrecord(N, fs); % acquire some signal
h = fft(y .* window); % transform
plot(fs*(0:N/2)/N, 20*log10(max(2/N*abs(h(1:N/2+1)), 1e-10)));
ylim([-160 20]); xlabel('Hertz'); ylabel('dB');
drawnow; % allow figure to update
end |
|
|