20-5 ��������������?

ڭ̤]iHg MATLAB NTƪxsTɮסAHK᪽bqAӤݨCg MATLAB CgJTɮתOO audiowriteAΪkpUG

audiowrite(audioFile, y, fs)

䤤 audioFile hOgJƪɮצW١Ay OTܼơAfs OWvCҦpAYnNwq@sJ handel.wavAiΤUC{XG

Example 1: 20-TŪgBsP/audioWrite01.mload handel.mat audioFile='handel.wav'; % xs wav ɮ fprintf('Saving to %s...\n', audioFile); audiowrite(audioFile, y, round(1.5*Fs)); %fprintf('N}l %s...\n', audioFile); pause system(audioFile); % }һP wav ɮ׹ε{Saving to handel.wav...

bWҤAڭ̱NTxs handel.wavAåιqε{Ӽ wav ɮסC

ثebMATLAB 8 Aaudiowrite OҤ䴩XTɮץ]t WAVE (.wav)BOGG (.ogg)BFLAC (.flac)BMPEG-4 AAC (.m4a & .mp4)C

Hint
pGAu MATLAB i歵TsPANiHϥ save ONTܼxs mat ɮסAA load OJA]NΤFAoɭԴNΨ wavwriteBauwrite OFC

HUdҾXBBsɩP@{XG

Example 2: 20-TŪgBsP/audioWrite02.mfs=16000; % Wv nBits=16; % IѪRסAO 8 16 24 nChannel=1; % nDӼơAO 1]nD^ 2]nDΥ魵^ duration=3; % ɶ]^ recObj=audiorecorder(fs, nBits, nChannel); fprintf('N}l %g G', duration); pause fprintf('...'); recordblocking(recObj, duration); fprintf('\n'); fprintf('N}lG\n'); pause y = getaudiodata(recObj, 'double'); % get data as a double array plot((1:length(data))/fs, y); xlabel('Time (sec)'); ylabel('Amplitude'); sound(y, fs); audioFile='myRecording.wav'; % xs wav ɮ fprintf('Saving to %s...\n', audioFile); audiowrite(audioFile, y, fs); system(audioFile); % }һP wav ɮ׹ε{N}l 3 G... N}lG Saving to myRecording.wav...


MATLAB{]pGJg