how to convert a .mp3 to .wav file in matlab?

21 Ansichten (letzte 30 Tage)
Rini Indrayani
Rini Indrayani am 24 Mai 2017
Kommentiert: JIkrul Sayeed am 14 Feb. 2020
i need to know about how to convert a single .mp3 audio file to a single .wav file in matlab? what code i have to use?
i had using this code:
filename=audioread('C:\Users\Rini Indrayani\Documents\MATLAB\Matlab\asli4.mp3');
audiowrite(filename,'C:\Users\Rini Indrayani\Documents\MATLAB\Matlab\hasilwav4.wav');
but the matlab shows error:
Error using audiowrite (line 100)
Not enough input arguments.
what should i do? i am a newbie in matlab. need a help. thanks
  1 Kommentar
JIkrul Sayeed
JIkrul Sayeed am 14 Feb. 2020
mp3filename = 'C:\Users\samuraiX\Desktop\Work\mp3towav\Music.mp3';
wavFileName = 'C:\Users\samuraiX\Desktop\Work\mp3towav\aMusic.wav';
signal = audioread(mp3filename);
info = audioinfo(mp3filename);
Fs = info.SampleRate;
audiowrite(wavFileName, signal, Fs);

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Jan
Jan am 24 Mai 2017
Bearbeitet: Jan am 24 Mai 2017
Use meaningful names for variables. audioread does not reply a file name.
filename = 'C:\Users\Rini Indrayani\Documents\MATLAB\Matlab\asli4.mp3';
signal = audioread(filename);
When you get an error concerning a command, the first thing you should do is reading the documentation:
doc audiowrite
There you find that this is the minimal calling sequence:
audiowrite(filename,y,Fs)
So you need:
wavFileName = 'C:\Users\Rini Indrayani\Documents\MATLAB\Matlab\hasilwav4.wav';
audiowrite(wavFileName, signal, 44100);
if this is the right frequency. You can find this by audioinfo:
info = audioinfo(filename);
info.SampleRate
Summary: Do not guess how the commands work, but read the instructions in the help or doc text.

KSSV
KSSV am 24 Mai 2017
Use mp3read from https://in.mathworks.com/matlabcentral/fileexchange/6152-mp3write-and-mp3read...and then you have data in hand..try converting it to .wav.

Dheeraj M Pai
Dheeraj M Pai am 9 Sep. 2017
For linux there is no good package
Thanks
  1 Kommentar
Walter Roberson
Walter Roberson am 9 Sep. 2017
? audioread() and audiowrite() should work in Linux. However, with some releases of MATLAB and some versions of Linux, you might have conflicts with gstreamer versions and so might need to install a different version of gstreamer.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by