Hi all,
This is my first time using the Audio library, and I have a couple of questions with respect to my code.
As a brief overview, I do this:
1. I generate a sine wave, and initialize an IntervalTimer object that calls a function (called "capture") every 50 ms
2. During each function call, I occasionally modulate the sine wave amplitude for exactly 700 ms. (line 143 and line 149)
3. During this function call, I also adjust a few other experimental parameters, though these are to my knowledge, irrelevant.
My questions, I hope, are pretty simple!
0. The length of each audio block synthesized using a "sine" should be 128 samples / 44.1 kHz = 2.9 ms, correct?
1. Would I ever expect the sine wave to terminate during "capture", because the IntervalTimer function runs at a higher priority? Like, can the sine wave simply run out of data? My supposition would be that, by setting the AudioMemory to 128, it would store 128 blocks of audio data at a time, and if each block lasts ~2.9 ms, there would basically never be a case in which the audio signal would get interrupted (the maximum length of each "capture" interrupt should hover around 1.1 ms). So, my understanding is that, between calls to "capture", the audio would add more audio blocks, which should be sufficient to .
2. I noticed looking at the audio signal that each period of high amplitude lasts either approximately ~699 ms, or ~702 ms, but nothing in between. Is this because the "amplitude" change only effects the sine wave output in increments corresponding to individual "blocks"? Also, does the amplitude change should occur relatively immediately, correct? As in, the amplitude should effect the next block, which would occur within 2.3 ms.
Let me know if I need to provide more clarification! And thank you for any help!
Kind regards,
Mike
This is my first time using the Audio library, and I have a couple of questions with respect to my code.
As a brief overview, I do this:
1. I generate a sine wave, and initialize an IntervalTimer object that calls a function (called "capture") every 50 ms
2. During each function call, I occasionally modulate the sine wave amplitude for exactly 700 ms. (line 143 and line 149)
3. During this function call, I also adjust a few other experimental parameters, though these are to my knowledge, irrelevant.
My questions, I hope, are pretty simple!
0. The length of each audio block synthesized using a "sine" should be 128 samples / 44.1 kHz = 2.9 ms, correct?
1. Would I ever expect the sine wave to terminate during "capture", because the IntervalTimer function runs at a higher priority? Like, can the sine wave simply run out of data? My supposition would be that, by setting the AudioMemory to 128, it would store 128 blocks of audio data at a time, and if each block lasts ~2.9 ms, there would basically never be a case in which the audio signal would get interrupted (the maximum length of each "capture" interrupt should hover around 1.1 ms). So, my understanding is that, between calls to "capture", the audio would add more audio blocks, which should be sufficient to .
2. I noticed looking at the audio signal that each period of high amplitude lasts either approximately ~699 ms, or ~702 ms, but nothing in between. Is this because the "amplitude" change only effects the sine wave output in increments corresponding to individual "blocks"? Also, does the amplitude change should occur relatively immediately, correct? As in, the amplitude should effect the next block, which would occur within 2.3 ms.
Let me know if I need to provide more clarification! And thank you for any help!
Kind regards,
Mike