How do I play stereo audio using PortAudio?
Here, I have two tones s1
and s2
. I want to play one on the right speaker, on on the left. This plays only s1
in both speakers.
using PortAudio
s1 = 2 * pi * (1 : 2 * 12_000) / 12_000 |> o-> cos.(o * 440)
s2 = 2 * pi * (1 : 2 * 12_000) / 12_000 |> o-> cos.(o * 660)
PortAudioStream(0, 2; samplerate=12_000) do stream
write(stream, s1)
end