www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/ResampleAndPlayAnAudioSignalExample.m
%% Resample and Play an Audio Signal % This example shows how to resample and play an audio signal from 48 kHz % to 32 kHz on a Windows(R) platform. hmfr = dsp.AudioFileReader('audio48kHz.wav', ... 'OutputDataType', 'single', ... 'SamplesPerFrame', 300); hap = audioDeviceWriter(32000); %% % Create an FIRRateConverter System object with interpolation % factor = 2, decimation factor = 3. Default FIR filter % coefficients define a lowpass filter with normalized % cutoff frequency of 1/3. hfirrc = dsp.FIRRateConverter(2,3); while ~isDone(hmfr) audio1 = step(hmfr); audio2 = step(hfirrc, audio1); step(hap, audio2); end release(hmfr); release(hap);