Audio Matlab

Páginas: 2 (328 palabras) Publicado: 7 de septiembre de 2011
b 1down votefavorite | i am trying to make a spectrogram in matlab, here is my code:% Record your voice for 100 seconds.recObj = audiorecorder;disp('Start speaking.')recordblocking(recObj, 100);%Store data in double-precision array.my= getaudiodata(recObj);figure;specgram(my,512);problem is that while i am speaking i want the spectrogram to be shown, so it should be updating as i speak. Howcan i plot the spectrogram while the audio is coming from microphone? so i should be able to see spectrogram in real timeI also tried this% Record your voice for 100 seconds.recObj =audiorecorder;disp('Start speaking.')a=0;figure;while a<60    recordblocking(recObj, 100);    % Store data in double-precision array.    my= getaudiodata(recObj);    specgram(my,512);    a=a+1;endbut it will onlydisplay the spectrogram when the while loop fishes (so after running 60 times) |

Fs = 8000;                    %# sampling frequency in Hz
T = 1;                        %# length of one intervalsignal in sec
t = 0:1/Fs:T-1/Fs;            %# time vector
nfft = 2^nextpow2(Fs);        %# n-point DFT
numUniq = ceil((nfft+1)/2);   %# half point
f = (0:numUniq-1)'*Fs/nfft;   %'# frequencyvector (one sided)

%# prepare plots
figure
hAx(1) = subplot(211);
hLine(1) = line('XData',t, 'YData',nan(size(t)), 'Color','b', 'Parent',hAx(1));
xlabel('Time (s)'), ylabel('Amplitude')
hAx(2) =subplot(212);
hLine(2) = line('XData',f, 'YData',nan(size(f)), 'Color','b', 'Parent',hAx(2));
xlabel('Frequency (Hz)'), ylabel('Magnitude (dB)')
set(hAx, 'Box','on', 'XGrid','on', 'YGrid','on')%#specgram(sig, nfft, Fs);

%# prepare audio recording
recObj = audiorecorder(Fs,8,1);

%# Record for 10 intervals of 1sec each
disp('Start speaking...')
for i=1:10
    recordblocking(recObj,T);

    %# get data and compute FFT
    sig = getaudiodata(recObj);
    fftMag = 20*log10( abs(fft(sig,nfft)) );

    %# update plots
    set(hLine(1), 'YData',sig)
    set(hLine(2),...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Estudio y gráfico de una señal de audio en matlab
  • Grabar audio matlab
  • Codificar y decodificar en audio (matlab)
  • Aechivos De Audio En Matlab
  • Comandos basicos de audio en MatLab
  • Procesamiento de señales de audio por medio de matlab
  • Procesamiento de señales de audio por medio de matlab
  • Vocoder lpc procesado de audio en matlab

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS