I’m about to merge a fairly large PR that reworks a lot of the internal guts of the Audio in libDaisy.
The PR covers the following:
- SAI and Audio are now written in C++
- Easier configuration of SAI with
- The ability to run the SAI without the Audio engine (if you want direct to hardware support with non-floating point values).
- Ability to run Audio at various common samplerates (8kHz, 16kHz, 32kHz, 48kHz, and 96kHz)
- A common API for audio across all breakout boards including the Daisy Seed.
If you’ve been using the
DaisySeed, or other Daisy”Board” classes then very little, if anything, will have changed for you (The
DaisyField had different names for some functions, like
However, if you were using the hid/audio.h functions directly, they have all been changed, and the
DSY_AUDIO_SAMPLE_RATE macro has been removed. This will potentially break some earlier projects.
DaisySeed, and other board classes will now have the following functions:
Since this is a pretty substantial update, I wanted to give everyone a heads up, and let them know. If anyone has any questions feel free to let me know!
I am using a test program to attempt to fix the massive 1kHz noise I am seeing. The program passes audio fine (just using out[i] = in[i]) when I use 48kHz, but no audio is passed when I change the samplerate to 96kHz. The only line I am changing is:
When I change the samplerate to 32kHz & 16kHz audio passes.
I know the samplerate is changing because the 1kHz noise line moves around as it should (samplerate/blocksize) when I go to 96kHz…just no audio seems to pass. I am not sure what I could be doing incorrectly since the other samplerates seem to pass audio just fine.
Same issue here. Well, I am getting audio with the effect engaged but its very… troubled sounding. Like my reverb is super detuned warbly reverb which is cool in its own way, but also not.
Hmm, two things could be happening here:
@sonicexplorer there is a known issue (that I will hopefully have fixed up soon) where the input channels can get swapped depending on the timing of the DMA Start. This is easily remedied by just checking if they’re flipped or not and swapping them manually (obviously not ideal, but if you’re not flipping samplerates while running it should always be consistent).
@bretvh it sounds like the channel flipping is also happening on yours (guessing you’re using a stereo effect), as for the “troubled” sound if its more distorted than just quiet/effected it could be that your Audio callback is too busy to run at 96kHz and is resulting in underruns.
I am processing both channels, but ultimately it’s a mono effect. I assumed they were being summed at output. Perhaps I should cut mine down to just deal with one input and output and see if that helps.
Oh, and it was actually changing the pitch of the signal, like super slow/syrupy reverb and warbly at the same time. I suspect it was because I just changed the sample rate and block size, but had not made any other adjustments in the code to compensate?
Just want to report back here that I had some success with the noise on my Terrarium build today. POT 1 was damaged when I first installed it (due to an airhead move on my part) and I had been limping by with it. I think it finally started to short out, which is why I saw an audible increase in the 1kHz whine. I replaced that pot today and reflowed a couple ground connections on the jacks and it’s MUCH quieter now. I currently have it set to a block size of 4, and if I crank the amp, I can hear some “ocean” sounds faintly. I have yet to swap back to a block size of 48 and test for the 1kHz whine, but I will report back once I have been able to check that out. So… the moral of the story here is check your grounds!
EDIT: Ok. Bumped back up to a block size of 48 and while the 1kHz whine was less audible, it’s still very prevalent if I crank up the amp. This is a Princeton Reverb reissue, so it’s a very clean amp. I don’t really notice enough latency or performance degradation with the block size of 4, so I am going to stick with that until a better solution comes along. YMMV