how can i play sound to the right stereo channel only?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Noam
el 14 de Feb. de 2016
Comentada: An
el 6 de Feb. de 2024
The sound command sends sound to both earphones. how do I send a sound to just one?
0 comentarios
Respuesta aceptada
Star Strider
el 14 de Feb. de 2016
The sound files are (usually) a (2xN) or (Nx2) matrix, one row or column for each channel. To have it play in only the right channel, set the other to a vector of zeros:
Fs = 44100;
t = linspace(0, Fs*2, Fs*2);
s = sin(2*pi*t*1000);
Out = [zeros(size(t)); s]';
sound(Out, Fs)
There is a problem with the sound on my laptop, so it’s not rendering this correctly. It should work on your computer.
3 comentarios
An
el 6 de Feb. de 2024
Alireza Naghsh is right: Play works stereo, but when writing to file it doesn't seem to work.
Ver también
Categorías
Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!