Follow us on Facebook
Follow us on Twitter
Signalogic on LinkedIn

MP3 in MATLAB

  

Click here for full-size picture

Frequency domain (2-D spectrograph) and time domain
(waveform display/edit) graphs of pre-MP3 speech data (trace 1),
and MP3-processed speech data (trace 2). Click here to listen to the

raw waveform sample and
MP3-processed waveform sample

Click here for full-size picture

Frequency domain (2-D spectrograph) and time domain
(waveform display/edit) graphs of pre-MP3 speech data (trace 1),
and MP3-processed speech data (trace 2). Click here to listen to the

raw waveform sample and MP3-processed waveform sample

Overview

For research, simulation, and algorithm development purposes, Signalogic is developing MP3 encoder and decoder programs in MATLAB. There are several reasons for this, including:

  • allow comparison with C/C++ versions for debug purposes

  • simplicity and brevity of MATLAB code allows better insight into algorithm performance, and areas where the MP3 algorithm can be a) optimized and b) improved

  • provides a well-documented and well-supported learning environment for graduate research students working on the MP3 project at Signalogic

In late 1999, Signalogic requested and received MATLAB MP3 decoder source code from Frank Schaefer, a graduate research student at Technische Universität Dresden (see More Information below). This code had a number of problems, mainly that it only ran without crashing for one (1) .mp3 file: the "funky.mp3" file posted on the Fraunhofer website. In addition, even then the code still did not produce correct results; displaying the output data in .wav displays in Hypersignal-Acoustic software showed gaps and other inconsistencies. Zaheer Hussain Syed, a Univ. of Texas MSEE student working on the MP3 project at Signalogic (see Signalogic MP3 team) has since made the following bug-fixes and improvements:

  1. Handling variable file length was included. Previously, the MATLAB decoder could only handle one file of one length.

  2. The feature of passing the file name from the command window was included.

  3. Added frame-discard when not enough main data is present by introducing two flags, namely 'bytes_to_discard' and 'sig'. Moreover a variable called main_data_end1 was included to keep track of the end of maindata.

  4. Included the variables subblock gain and mixed_block_flag in the Side information block, which applies when the window switching flag is zero. This avoids a program crash when this condition is fulfilled.

  5. After determination of side information: shifted the calculation of start(2) and start(1) above the calculation of main_data_start. Added a variable 'new' to substitute the function of start(1). Then substituted start(1) instead of start(2). This takes care of files when the main_data_begin of Frame 1 is not zero.

  6. Corrected a copying mistake in the linbit elements to handle mono files.

  7. Fixed the calculation of region1Start and region2Start for handling mono files. Moreover it takes care of files with sampling frequency other than 44.1 kHz.

  8. Added wav file write to code to store output.

  9. Included initialization of table_select, region0_count, region1_count and scale_l to avoid any miscalculation in handling mono files.

  10. Included region1_count calculation in the block when the window switching flag is positive.

The MATLAB decoder has now been tested with several mono and stereo .mp3 files, both MPEG 1 and MPEG 2, and results compared with the C/C++ version running on Win9x/WinXP/Win2k PCs.

The MATLAB encoder is not yet complete.

The MATLAB decoder source code is available for evaluation, research, and academic purposes. To obtain the source code, send e-mail to dspinfo and describe your purpose and the nature of your research. Due to the pressure applied by Fraunhofer (FhG) and the fact that recent legal cases involving Internet website disclaimers have shown that merely clicking on a button that says you "agree" is insufficient, you may be required to fill out and sign a form and fax to Signalogic indicating that you will use the Signalogic MP3 MATLAB source code only for evaluation, academic, and research purposes.

More Information

For more information about the MP3 MATLAB source code, send e-mail to:

    Frank Schaefer
    Technische Universität Dresden
    Mannesman Mobilfunk Stiftungslehrstuhl Mobile Nachrichtensystems
    D-01062 Dresden
    Germany
    49 351 463 4176

    dspinfo
    Signalogic
    9617 Wendell @ Skillman
    Dallas, Texas 75243
    USA
    (214) 349-5551