How to deliver a sound tone to only one ear?

6 次查看(过去 30 天)
Hi everyone;
I am trying to set an experiment on MATLAB where I am going to be producing a tone and sending it to the user via ear plugs. However, the tone coming to the right ear has to be 180degrees out of phase to the tone coming to the left ear.
So for instance, if the frequency is 1000Hz, I will send the 1000Hz signal to the right ear now then wait 0.5ms to send the same tone to the left ear. Hence the two sounds are going to be out of phase with each other.
So my question is: how to tell MatLab to send a tone to only the right ear then send another tone to the other ear. Or how to disable either the left or right earplug.
Thank you for your help. Ali

采纳的回答

Jan
Jan 2013-7-8
编辑:Jan 2013-7-8
You can simply add zeros in the silent channel:
t = linspace(0, 5, 22500*5);
y = sin(t * 1000 * 2 * pi);
silence = zeros(1, floor(0.5e-3 * 22500)); % 0.5 ms
signal = [y, silence; silence, y(:)].';
wavplay(signal, 22050);
% Draw the signal to check the phase shift:
plot(signal(1:100, :))
  1 个评论
mohadeseh zamani
mohadeseh zamani 2021-8-12
Hello Jan, I am trying to generate a toneburst in either left and right ear for example if f=250 Hz and duration of time that sound is produced in the ear is 1 seconds and the distance between the two sounds is 4 second ( first sound in the left ear and the right sound in the right ear) my problem is that generating sound in left and right ear if you know it please help me I really neeed this part.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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!

Translated by