Sending two tones (Right and Left)

1 view (last 30 days)
Mustafa Jameel
Mustafa Jameel on 30 Jan 2019
Commented: Rena Berman on 5 Mar 2019
How can create a tone that works on the left or right only?. As you can see below, I have already created two sine waves with different frequences, so I'm trying to send one to the right and the other one to the left. Thanks in advance
fs= 8000; %frequency sample rate
i=1/fs;
t=0:i:10; %time axis
a=10; % amplitude
%Left Signal with F=440hz
f1 = 440;
x = a*sin(2*pi*f1*t);
%Right signal with F=660hz
f2 = 660;
y = a*sin(2*pi*f2*t);
plot(t,x,t,y);
  3 Comments
madhan ravi
madhan ravi on 31 Jan 2019
Edited: madhan ravi on 31 Jan 2019
This behaviour is not tolerated in this forum!
Rena Berman
Rena Berman on 5 Mar 2019
(Answers Dev) Restored edit

Sign in to comment.

Answers (1)

Rik
Rik on 30 Jan 2019
fs= 8000; %frequency sample rate
i=1/fs;
t=0:i:10; %time axis
a=10; % amplitude
%Left Signal with F=440hz
f1 = 440;
x = a*sin(2*pi*f1*t);
%Right signal with F=660hz
f2 = 660;
y = a*sin(2*pi*f2*t);
%merge into left and right
sound([x' y'],fs)
  1 Comment
Rik
Rik on 30 Jan 2019
You can just add a 0 sound to the side you want to be silent:
fs= 8000; %frequency sample rate
i=1/fs;
t=0:i:10; %time axis
a=10; % amplitude
%Left Signal with F=440hz
f1 = 440;
x = a*sin(2*pi*f1*t);
%Right signal with F=660hz
f2 = 660;
y = a*sin(2*pi*f2*t);
% %merge into left and right
% sound([x' y'],fs)
sumsound=[x' zeros(size(x'));zeros(size(y')) y'];
sound(sumsound,fs)

Sign in to comment.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!