Unable to play the "audiowrite" file from the folder
9 views (last 30 days)
Show older comments
I have written a downsampled wav file via audiowrite to a folder. I am able to play the sound signal in matlab using "sound(file)". However, I am unable to play it from the folder.
% Code:
Fs = 16000;
Fd=1600;
old = audioread(file);
new = resample(old, Fd, Fs);
sound(new,Fd);
audiowrite(file1, new, Fd);
2 Comments
Jan
on 29 Nov 2017
Please explain what "playing from a folder" means. Maybe it matters that you use "file" and "file1"? Perhaps you forgot to specify the folder for saving? "sound(file)" does not occur in the posted code, so are you sure that this works?
Answers (1)
Jan
on 29 Nov 2017
Edited: Jan
on 29 Nov 2017
It does not matter where the data are coming from. So let's narrow down the problem:
Fd = 1600;
new = 1 - 2 * rand(1, 3200);
sound(new, Fd);
audiowrite(file1, new, Fd);
If now Matlab does play the sound, but VLC does not, it is a problem of VLC. Try it:
new2 = audioread(file1);
sound(new2, Fd);
Does it work in Matlab? Then try a different external tool to play the sound. Maybe you have reduced the volume in VLC or "file1" is in a different folder than you expect it to be and you feed VLC with an old (silent) file?
0 Comments
See Also
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!