How to convert data file to audio file

17 views (last 30 days)
xingzhe zhang
xingzhe zhang on 3 Aug 2017
Commented: xingzhe zhang on 7 Aug 2017
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
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
xingzhe zhang on 7 Aug 2017
'1' is txt file. '12' is .mat file that I convert '1' to '12'
Thank you
xingzhe zhang
xingzhe zhang on 7 Aug 2017
Than you for your responds, I just upload the files

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!