The example for outputing audio through only one channle doesn't work for me.. (audioDeviceWriter & audioOscillator)
1 view (last 30 days)
Show older comments
I can't get this example to work at all - it's supposed to play a sine wave in one channle, and a static through the other, but I still get sound from both channles.
I've tried substituting zeros for randn to totally mute the other channel, but it had no effect either.
dev_writer = audioDeviceWriter;
sineGenerator = audioOscillator;
sineGenerator.Frequency = note2Freq(79);
count = 0;
sine = sineGenerator();
static = zeros(length(sine),1);
while count < 1000
dev_writer([sine,static]);
count = count + 1;
end
5 Comments
Walter Roberson
on 28 Sep 2022
If the samples per frame is not an integer multiple of samples per cycle then the calls to the generator will not return the same result.
For example if you ask for 10000 samples per frame and a sample frequency of 22100 Hz then one frame would be 2.21 cycles, and the second call to the generator would start 0.21 cycles in, not at the beginning of a cycle
Answers (0)
See Also
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!