Hi all,
I am trying to feed arbitrary waveforms via USB audio to a Mac.
The USB interface and everything works. I am attempting to use the AudioSynthWaveformDc module to set the amplitude of a computed arbitrary waveform.
This also works, but the amplitude only updates every 3ms when setting it via dc1.amplitude().
Here's the code I am using:
As expected I get a sawtooth at roughly 4 Hz (1000/256). But when I zoom in I see, that the amplitude of the signal only changes every 3ms.
Not every 1ms as I would expect from the code (due to the delay(1).
It appears, that values set using dc1.amplitude() only update once every 3ms.
Is this the intended behavior?
Is there a better way to achieve what I am trying to do? (I am not actually trying to generate a sawtooth. I want to need able to manually set the output level to arbitrary values.)
Thanks in advance.
Mike
I am trying to feed arbitrary waveforms via USB audio to a Mac.
The USB interface and everything works. I am attempting to use the AudioSynthWaveformDc module to set the amplitude of a computed arbitrary waveform.
This also works, but the amplitude only updates every 3ms when setting it via dc1.amplitude().
Here's the code I am using:
Code:
#include <Audio.h>
// GUItool: begin automatically generated code
AudioOutputI2S i2s1; // IMPORTANT! If this is removed then no audio will be output via USB. No idea why?!
AudioSynthWaveformDc dc1; //xy=196,184
AudioOutputUSB usb1; //xy=371,185
AudioConnection patchCord1(dc1, 0, usb1, 0);
AudioConnection patchCord2(dc1, 0, usb1, 1);
// GUItool: end automatically generated code
void setup() {
AudioMemory(12);
}
uint8_t count = 0;
void loop() {
dc1.amplitude(float(count)/256);
count++;
delay(1);
}
As expected I get a sawtooth at roughly 4 Hz (1000/256). But when I zoom in I see, that the amplitude of the signal only changes every 3ms.
Not every 1ms as I would expect from the code (due to the delay(1).
It appears, that values set using dc1.amplitude() only update once every 3ms.
Is this the intended behavior?
Is there a better way to achieve what I am trying to do? (I am not actually trying to generate a sawtooth. I want to need able to manually set the output level to arbitrary values.)
Thanks in advance.
Mike