Esteu aquí: Inici Assignatures Processament Digital del Senyal Recursos play_so.m

play_so.m

play_so.m — Objective-C source code, 472 bytes

Continguts del fitxer

% function to use with octave instead of sound.m of MATLAB
% play_so(x,Fs), x is a sampling vector and Fs is the sampling frequency
function play_so(x,Fs)
    if nargin==1, Fs=48e3, elseif (nargin !=2), print_usage (), end
    file=[tmpnam(),'.wav'];% creates a temporal file 
    wavwrite(x,Fs,file);% creates a .wav file from x and Fs
    system(['play ',file]);% it orders the system to reproduce the .wav file
    system(['rm ',file]); % removes the temporal file
end