How to convert data file to audio file
Show older comments
Hello. everyone, any one know how to convert data file to audio file (.mp3 or .wav).? I know that matlab can convert audio file to data file. Thank you.
Answers (1)
Jan
on 3 Aug 2017
It depends on what a "data file" is. If you mean e.g. a MAT file, which contains a signal as a vector:
Data = load('File.mat');
FS = 8000; % Frequency
audiowrite('Sound.wav', Data.Y, FS);
Or maybe you mean a text file containing numbers? Then the actual question is how to import a text file.
5 Comments
xingzhe zhang
on 3 Aug 2017
xingzhe zhang
on 3 Aug 2017
Jan
on 3 Aug 2017
You have to use the name as existing in the MAT file. I cannot guess the contents of your file. So either adjust the code to your data, or post the file here.
xingzhe zhang
on 7 Aug 2017
xingzhe zhang
on 7 Aug 2017
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!