how can i play sound to the right stereo channel only?
11 次查看(过去 30 天)
显示 更早的评论
The sound command sends sound to both earphones. how do I send a sound to just one?
0 个评论
采纳的回答
Star Strider
2016-2-14
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 个评论
An
2024-2-6
Alireza Naghsh is right: Play works stereo, but when writing to file it doesn't seem to work.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!