MDCT, Giraffes & MATLAB

page overview:

Let's see how we can implement various MDCT algorithms in Matlab and at the same time let the Giraffe help this page be easily searchable in Google. For now I am only including the m-files without proofs. However, one can easily understand the code since it's well commented. If you're curious about the various Matlab tricks I use take a look at my Matlab tips and tricks page.

sanity check:

Here is a simple example to test the MDCT functionality. Here I am using the mdct4(), imdct4() pair but you can use any version and notice the speed difference.

randn('state',0); % seed the generator to get the same results
x  = randn(10000,1); % our test signal
[fx,fpad] = linframe(x,128,256,'sym'); % hop=128 and win=256, thus 50% overlap
fx = winit(fx,'kbdwin'); % kbd win is TDAC
FX = mdct4(fx);
fy = imdct4(FX);
fy = winit(fy,'kbdwin'); % rewindow
y  = linunframe(fy,128,fpad); % OLA
e  = mean((x-y).^2) % so our error for mdct4
e =

MDCT m-files:

Note that all the functions follow Matlab's fft() interface. This means that if a 2D matrix is passed as an argument to any of the mdctX() functions, then the mdct of each column is performed and returned in a 2D matrix. This way one can speed up per frame processing, since it's possible to avoid loops completely.

TDAC Window m-files:

misc m-files:


performance: (To be added)

references: (To be added)