% % WAV2TXT.M Simple example to extract and plot data from *.wav files and % store as ascii data in *.txt files % % Input wav file is indicated by user % Output txt/mat files saves only two variables in txt/mat file format % y = single vector with sound information by sample interval % Fs = sample rate (samples per second) % % File prepared by J. R. White, UMass-Lowell (original Sept. 1997) % --> minor update June 1999 % % Adapté par B. Decoux le 14/10/03 pour les TP DSP EFREI % Identify file to be processed name = input('Entrez le nom du fichier .wav à convertir : ','s'); fname1 = [name '.wav']; % % Extract info [y Fs] = wavread(fname1); sound(y,Fs) % Play sound on sound card (just once) % % sauvegarde dans un fichier texte % name = input('Entrez le nom du fichier texte à générer (pas d''extension): ','s'); fname2 = [name '.txt']; fid=fopen(fname2, 'wt'); fprintf(fid, '%.7f\n', y); fclose(fid); % % end of function %