4.35897

4.4 | 39 ratings Rate this file 220 downloads (last 30 days) File Size: 465.43 KB File ID: #6152

MP3WRITE and MP3READ

by Alfredo Fernandez

 

31 Oct 2004 (Updated 16 Feb 2006)

Code covered by BSD License  

mp3 audio encoding/decoding

Editor's Notes:

This file was a File Exchange Pick of the Week

Download Now | Watch this File

File Information
Description

Includes 2 functions to write and read MP3 files. It works like the commands WAVWRITE and WAVREAD.

1.- Just unpack in the toolbox folder under the MATLAB directory.
2.- Set the MATLAB search path to include that folder.

This version was made in MATLAB for WINDOWS only.

Acknowledgements
This submission has inspired the following:
mp3read and mp3write
MATLAB release MATLAB 7 (R14)
Other requirements WINDOWS
Zip File Content  
Other Files README.txt,
mp3_toolbox/mp3reader/mp3info.exe,
mp3_toolbox/mp3reader/mp3read.m,
mp3_toolbox/mp3reader/mpg123.exe,
mp3_toolbox/mp3write/lame.exe,
mp3_toolbox/mp3write/lame_enc.dll,
mp3_toolbox/mp3write/mp3write.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (49)
04 Nov 2004 joakim brännström  
18 Jan 2005 irfan turk  
06 Feb 2005 Mahmoud Bagheri

for me , its fantastic.

15 Mar 2005 Dave Robinson

Works for me - ACE

29 Apr 2005 Sandeep Sanga

nice!

19 May 2005 Murphy O'Brien

Does exactly what it says on the tin! A very useful complement to wavread and wavwrite.

21 May 2005 marcin marcin  
14 Jun 2005 jeeva rajan

fine
for modified code contact me
3/2 ramachandra st
off north usman road
t.nagar chennai-17

14 Jun 2005 jeeva rajan

3/2 ramachandra st
off north usman road
t nagar
chennai-17

18 Jun 2005 Ely Tejeda  
15 Jul 2005 Junjie Liu  
17 Aug 2005 Johnson Yeh  
16 Sep 2005 saifudeen ar  
23 Sep 2005 vinay dev

nice

28 Sep 2005 Matevz Leskovsek

Nice work. Very well commented!

13 Oct 2005 jaydeep dhole

very helpful

14 Oct 2005 Victor Colme

nO Entendì una mierda!!!

05 Nov 2005 tran huy dong  
17 Nov 2005 Nanno Mulder

I cannot open the .zip file, so low marks for the packaging. No comments on the contents

19 Nov 2005 Jurijs Jonass

Thanks Alfredo for nice job!

22 Nov 2005 Rubén Sánchez  
23 Nov 2005 albert crespo  
23 Nov 2005 Joao Valiati  
24 Nov 2005 Somendra Misra  
24 Nov 2005 sathish Reddy  
26 Nov 2005 laeeqsdq neelofer  
27 Nov 2005 Yohn Eduin Parra

Good aplication. I need more time to evaluation and qualify to.

07 Dec 2005 René Gonález

It's a very good rutine

09 Jan 2006 guan liang

very good

07 Feb 2006 Juan Carlos Ruchesi

very good

17 Feb 2006 shu tong  
13 Mar 2006 mauricio peña  
16 Apr 2006 huang baozhu

when i use mp3write ,it say mp3buffer is not too big enough

26 Apr 2006 Andy Clark

Great bit of code! Now I can analyse mp3's in matlab.

14 Jul 2006 Jose Uy

Why does it output 2 columns? Is one column the time index and the other is the amplitude?

18 Sep 2006 famous martin

very very good

06 Oct 2006 per g

2 columns = stero sound? Haven't tried the toolbox, just guessing!+

10 Oct 2006 Mara M

It seems the search path needs to be w/o blanks for it to work. Also there was one row in mp3write changing the path to a name which didn't work out (row 55: MP3FILE = strcat(pwd,'\',MP3FILE)).
Otherwise, great job.

30 Oct 2006 John Hughes

Suggested code mod for the reader:
Line 42:
[stat,raw_info] = dos(['"',location,'\mpg123','"', ' -w ', tmpfile, ' ', '"',FILE,'"'])

By putting double-quotes around the pathname to mpg123, I've fixed the "can't handle blanks in the path" problem. Presumably a similar fix is needed for mp3write; I'll send it when/if I get there...

31 Oct 2006 John Hughes

Fix for lines 54-70 of mp3write.m:

This allows one to use pathnames with spaces in them.

Note that the who thing fails if you give an ABSOLUTE pathname (like "C:/Matlab-stuff/mySong.mp3"), because the read/write routines expect only relative pathnames. I haven't tried to fix this part.

tmpfile = ['"', strcat(lame,'\temp.wav'), '"'];
MP3FILE = ['"', strcat(pwd,'\',MP3FILE), '"'];
ENCODING = num2str(ENCODING);
switch ENCODING
    case {'1'}
        cmd = ['"', lame,'\lame', '"', ' --quiet', ' ', tmpfile, ' ',MP3FILE];
    case {'2'}
        cmd = ['"',lame,'\lame', '"', ' --quiet', ' -b 128 ', tmpfile, ' ',MP3FILE];
    case {'3'}
        cmd = ['"',lame,'\lame', '"', ' --quiet', ' --abr 112 ', tmpfile, ' ',MP3FILE];
    case {'4'}
        cmd = ['"',lame,'\lame', '"', ' --quiet', ' -f ', tmpfile, ' ',MP3FILE];
    case {'5'}
        cmd = ['"',lame,'\lame', '"',' --quiet', ' -h ', ' -V ', tmpfile, ' ',MP3FILE];
    otherwise
        error('Encoding parameters not suported')
end

15 Dec 2006 Punit master

remove your site & code from google
your code is pathetic

26 Jan 2007 Michael McGurie

A MEX version of this program would give it a perfect score. Very useful for playing around with sound files.

21 Jun 2007 Luigi Rosa

Very good. In mp3read.m the output variable "out" is unnecessary, probably introduced for debugging.

07 Jul 2007 hung duc

I'm working in watermarking, but I don't understand clearly. So, I need some examples or Matlab code to simulate. Please help me

28 Nov 2007 palani natarajan

information

30 Nov 2007 naimat khan

i am the student of electrical engineering at uet peshawar

29 Feb 2008 sura mohamed

i want another idea on voice project
i want to make a reaserch in sound
plssssssssssss

18 Feb 2009 Eric

Can the MP3READ function be used to detect the frequency, tempo and rhythm of an mp3 file? Where are these values stored for retreval and comparison in the future?

07 Jul 2009 John Adcox

Please fix the pathname issue that John Hughes mentioned earlier. His fix works so you will just need to upload a new file

Please login to add a comment or rating.
Updates
16 Feb 2006

Code update

Tag Activity for this File
Tag Applied By Date/Time
audio processing Alfredo Fernandez 22 Oct 2008 07:34:24
video processing Alfredo Fernandez 22 Oct 2008 07:34:24
audio signal procesing Alfredo Fernandez 22 Oct 2008 07:34:24
mp3 Alfredo Fernandez 22 Oct 2008 07:34:24
signal Alfredo Fernandez 22 Oct 2008 07:34:24
decoding Alfredo Fernandez 22 Oct 2008 07:34:24
wav Alfredo Fernandez 22 Oct 2008 07:34:24
encoding Alfredo Fernandez 22 Oct 2008 07:34:24
audio processing Eric 19 Feb 2009 00:08:39
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com