Unable to play the "audiowrite" file from the folder

9 Ansichten (letzte 30 Tage)
Prithvi Pani
Prithvi Pani am 29 Nov. 2017
Bearbeitet: Jan am 29 Nov. 2017
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 Kommentare
Jan
Jan am 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?
Prithvi Pani
Prithvi Pani am 29 Nov. 2017
Bearbeitet: Prithvi Pani am 29 Nov. 2017
file (and file1) is already specified to be a wav file (whose path I have not mentioned as it is irrelevant here). Playing from folder means that I am going manually to that path and trying to play it using VLC player (which shows a duration of 2 seconds but plays no sound out) I meant to say "sound(new, Fd)"

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 29 Nov. 2017
Bearbeitet: Jan am 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?

Community Treasure Hunt

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

Start Hunting!

Translated by