DSPRelated.com
Code

WAV Butterworth Subsample

Ron April 1, 2011 Coded in Matlab

A script that filters and subsamples a low frequency signal to compress it without losing intelligibility. Current parameters reduce the bandwidth by a factor of 8.

[X, fs, nbits] = wavread('file.wav');
[N, Wn] = buttord(0.12, 0.125, 3, 60);
[B,A] = butter(N,Wn,'low');
Y = filter(B,A,X);
Z = downsample(Y,8);
wavwrite (Z, fs/8, nbits, 'file-sampled.wav');