mp3read and mp3write 完整打包


mp3read and mp3write for matlab(for windows),MATLAB两函数mp3read和mp3write,MATLAB两函数mp3read和mp3write
欢迎下载
资源截图
代码片段和文件信息
%% MP3 reading and writing
%
% These function mp3read and mp3write aim to exactly duplicate 
% the operation of wavread and wavwrite for accessing soundfiles 
% except the soundfiles are in Mpeg-Audio layer 3 (MP3) compressed 
% format.  All the hard work is done by external binaries written 
% by others: mp3info to query the format of existing mp3 files 
% mpg123 to decode mp3 files and lame to encode audio files.
% Binaries for these files are widely available (and may be
% included in this distribution).  
%
% These functions were originally developed for access to very 
% large mp3 files (i.e. many hours long) and so avoid creating 
% the entire uncompressed audio stream if possible.  mp3read 
% allows you to specify the range of frames you want to read 
% (as a second argument) and mp3read will construct an mpg123 
% command that skips blocks to decode only the part of the file 
% that is required.  This can be much quicker (and require less 
% memory/temporary disk) than decoding the whole file.
%
% mpg123 also provides for “on the fly“ downsampling at conversion 
% to mono which are supported as extra options in mp3read.
%
% For more information including advice on handling MP4 files 
% see http://labrosa.ee.columbia.edu/matlab/mp3read.html

%% Example usage
% Here we read a wav file in then write it out as an MP3 then 
% read the resulting MP3 back in and compare it to the original 
% file.

% Read an audio waveform
[dsr] = wavread(‘piano.wav‘);
% Save to mp3 (default settings)
mp3write(dsr‘piano.mp3‘);
% Read it back again
[d2sr] = mp3read(‘piano.mp3‘);
% mp3 encoding involves some extra padding at each end; we attempt 
% to cut it off at the start but can‘t do that at the end because 
% mp3read doesn‘t know how long the original was.  But we do so..
% Chop it down to be the same length as the original
d2 = d2(1:length(d):);
% What is the SNR (distortion)?
ddiff = d - d2;
disp([‘SNR is ‘num2str(10*log10(sum(d(:).^2)/sum(ddiff(:).^2)))‘ dB‘]);
% Do they look similar?
subplot(211)
specgram(d(:1)1024sr);
subplot(212)
plot(1:5000d(10000+(1:5000)1)1:5000d2(10000+(1:5000)));
% Yes pretty close
%
% NB: lame followed by mpg123 causes a little attenuation; you 
% can get a better match by scaling up the read-back waveform:
ddiff = d - 1.052*d2;
disp([‘SNR is ‘num2str(10*log10(sum(d(:).^2)/sum(ddiff(:).^2)))‘ dB‘]);

%% External binaries
% The m files rely on three external binaries each of which is
% available for Linux Mac OS X or Windows:
%
% *mpg123* is a high-performance mp3 decoder.  Its home page is
% http://www.mpg123.de/ .  
%
% *mp3info* is a utility to read technical information on an mp3
% file. Its home page is http://www.ibiblio.org/mp3info/ .  
%
% *lame* is an open-source MP3 encoder.  Its homepage is
% http://lame.sourceforge.net/ .
%
% The various authors of these packages are gratefully acknowledged 
% for doing all the hard work to make these Matlab functions possible.

%% Installation
% The

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2007-07-30 15:37  __MACOSX
     目录           0  2007-07-30 15:37  __MACOSXmp3readwrite
     文件          82  2007-03-30 17:11  __MACOSXmp3readwrite._.DS_Store
     文件        1544  2009-05-19 15:17  license.txt
     目录           0  2007-07-30 15:36  mp3readwrite
     文件        6148  2007-03-30 17:11  mp3readwrite.DS_Store
     文件        3728  2007-02-04 23:09  mp3readwritedemo_mp3readwrite.m
     目录           0  2007-02-04 23:14  mp3readwritehtml
     文件       10834  2007-02-04 23:14  mp3readwritehtmldemo_mp3readwrite.html
     文件        6212  2007-02-04 23:14  mp3readwritehtmldemo_mp3readwrite.png
     文件       63096  2007-02-04 23:14  mp3readwritehtmldemo_mp3readwrite_01.png
     文件      195072  2002-04-16 13:35  mp3readwritelame.exe
     文件      377484  2002-01-02 22:56  mp3readwritelame.glnx86
     文件      469376  2006-12-30 17:39  mp3readwritelame.mac
     文件      490312  2007-02-04 21:32  mp3readwritelame.maci
     文件       71680  2004-10-23 16:20  mp3readwritemp3info.exe
     文件       22896  2001-07-17 05:30  mp3readwritemp3info.glnx86
     文件       60364  2004-09-08 21:09  mp3readwritemp3info.mac
     文件       35032  2007-02-04 20:37  mp3readwritemp3info.maci
     文件       10042  2007-07-30 15:36  mp3readwritemp3read.m
     文件        4870  2007-07-26 15:09  mp3readwritemp3write.m
     文件      139264  2004-10-23 16:20  mp3readwritempg123.exe
     文件      159824  2000-02-02 23:31  mp3readwritempg123.glnx86
     文件      124076  2004-01-30 02:08  mp3readwritempg123.mac
     文件      122464  2007-02-04 19:37  mp3readwritempg123.maci
     文件      829672  2007-02-04 20:16  mp3readwritepiano.wav

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)