General newbie Daisyduino question

I’ve watched the videos and am starting writing Daisyduino code for a standalone synth I built. This device has generic knobs and switches with functionality TBD. It has a linear membrane pot to select a root note and a small keyboard that can build various intervals from the root to make chords. The promised videos from Takumi detailing the function and purpose of the various DSP routines never materialized so I’m looking for a little direction.

I need to check the values of the pots and the states of switches and keys without producing undesirable artifacts in the output. Should I put anything in the void loop? What can be put in the for structure in the MyCallback function vs what should be put in the MyCallback function outside of the for structure? My test code will produce sound but there’s a periodic “phffft phffft phffft” artifact that can be heard coming from the amp at loud volume. In one of the videos, Takumi talks about moving button code to inside the for structure to minimize artifacts. I’d just like to know what sorts of code (i.e reading analog/digital input etc) can I put in the void loop (if any), what should be put in the MyCallback function outside of the for structure and what has to be put inside the for structure inside the MyCallback function.

Sorry for the length of this.

Hello!
Are you getting a noise whenever you’re printing? Or whenever you’re changing synth parameter with a potentiometer?

Please feel free to share a shortened version of the code that’s outputting noise :slight_smile:

It’s always there regardless of the code, even for a test code making a simple tone. It doesn’t appear to be originating in the power supply (I’ve used several different ones and it’s there for all of them.) It isn’t coming from the onboard amp because I’ve run a signal through it from a function generator and it comes through clean. It’s definitely coming from the Daisy board. I’ve made it much less noticeable by cutting the output down with a voltage divider before sending it into the amp through a follower. It sounds sort of like a phfttt phfttt phfttt sound at around 10 to 20 hz.

On the other question, is it viable to put code that checks input in the void loop or do I need to put that somewhere in the MyCallback routine?

Typically USB power causes noise but nothing on the low end like that. Below 20 hz are pretty much in the inaudible range, so you could apply a highpass for now.
What does your circuit and code look like?

So you should have analogRead() in the MyCallback so that it’s read at audio rate. Please ignore if I shared a code in the past where I had it inside the void loop() even if it sounded fine for that example.
Basically when you read the knobs at control rate in the void loop(), you get a stairstep shaped curve when you twist them. Unless it’s smoothed out, there will be an audible “zipper sound”.
In terms of serial printing out sensor values, you should do it in the void loop().