% script to play sound in Matlab clear all % name of wavfile wavfilename = ['./handel.wav']; % load/read wavfile y = wavread(wavfilename); % specify sampling rate of wavfile Fs = 44100; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % if unsure about sampling rate and bits: % [y, Fs, nbits, opts] = wavread(wafvilename) % play sound sound (y, Fs) % write to disk wavwrite(y,Fs,'messiah.wav') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % if you need to resample wavfile: % [p, q] = rat(Fs_desired/Fs,0.0001); % 0.0001 is tolerance % y2 = resample(y,p,q);