Mp3read and mp3write for Matlab

Source: Internet
Author: User

Read and Write MP3 files in MATLAB, and use the ready-made mp3read and mp3write.

  1. Download the mp3read.m, mp3write. M, mpg123.exe, mp3info.exe, and lame.exe files at http://labrosa.ee.columbia.edu/matlab /mp3read.htmland put them in a folder named MP3.
  2. Put the MP3 folder in the installation directory of MATLAB ../MATLAB 71/toolbox/Matlab.
  3. In Matlab, add a path and choose File> set path.... In the displayed set path dialog box, select Add folder..., select the MP3 folder, save, and close.
  4. Modify the content of the mp3read and mp3write files:

    To make them work, you also need to make small changes to the mp3read. m and mp3write. M scripts. first, you must change the location that the script looks for binaries e.g. change the lines:

        %%%%%% Location of the binaries    mpg123 = '/usr/bin/mpg123';             % for mp3read    mp3info = '/usr/bin/mp3info';           % for mp3read    lame = '/usr/bin/lame';                 % for mp3write

    To point to the directory where you put the binaries above, e.g.

        mpg123 = 'C:/Matlab6p5/work/project/mpg123.exe';    mp3info = 'C:/Matlab6p5/work/project/mp3info.exe';    lame = 'C:/Matlab6p5/work/project/lame.exe';

    Secondly, you must also change the directory where temporary files are written, and the command used to delete them, e.g .:

        %%%%%% Directory for temporary file (if needed)    tmpdir = '/tmp/';    %%%%%% Command to delete temporary file (if needed)    rmcmd = 'rm';

    .. To be a suitable directory for temporary files on your system and the appropriate command to delete them, e.g.

        tmpdir = 'C:/Matlab6p5/work/project/tmp/';  % don't forget trailing slash    rmcmd = 'del';

  5. Done! You can run the help mp3read command in MATLAB to test whether mp3read. m can be found.

Now we can use mp3read and mp3write just like using wavread and wavwrite.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.