help using the adsrgain #274
-
So, i've looked at examples and I have a sketch that does mostly what I want. I can trigger a note, set the frequency but there is not noticable envelope now matter which settings I use. I've got an AudioEffects stream. I set the frequency accordingly for the sineWave. I have tried many setting parameters and I can't get a slow attack or decay or release - its always just the same as without ADSR. I have built quite a few arduino synth engine projects so I know what dynamics would typically sound like.
In the setup i set it's ADSR parameters even though they are set on creation of the effect
Further on in the code I stop and start the note playing
From this definition I figure I need to read and write from the effect because it doesn't seem to be happening automatically.
The closest thing I found in the documentation so far is something that seems like it. I've looked at many examples and I can't find anything calling process.
Yes the copier function is explained to do this stream in to out writing but simplifies things by making sure unwritten bytes are written. I'm going to come back and document how I go in case it's useful. I tried to RTFM so far and got far but this one has me a bit uncertain what to do. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
Did you already read the related documentation?
in https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-audiokit |
Beta Was this translation helpful? Give feedback.
-
I am using the AudioKit for many examples because it is just too much work to wire up I2S every time I do a new sketch. The important thing you can get from all examples is how things are supposed to work together. If you don't have an AudioKit you can replace the AudioKitStream in any example with any supported output class: in your case I2SStream and it should work as well. Please note that the audio in the examples gets triggered by the keys on the AudioKit. I don't know how you planned to implement the triggering of the sound. As you should be able to see from the example, there is no need to mess with the process function but you should use keyOn and keyOff which could easily be triggered from midi events. Please note that timing is important here: if you want the sound to be for 1 second you need to wait 1 second after calling keyOn before calling keyOff. You can copy the audio data yourself as you did in the loop, or better just call copier.copy(), since you already defined the StreamCopy copier in your sketch. |
Beta Was this translation helpful? Give feedback.
-
Did you try with the ADSRGain default values which are If you check the ADSRGain class the update is delegated for each tick (=sample) to the ADSR class. |
Beta Was this translation helpful? Give feedback.
-
The dynamics is implemented in the ADSR class and executed via adsr->tick() I was just double checking the synthbasic2 example and I can hear the ramp up, so I am not sure what your issue could be: Maybe you can also add a Serial.println(" on"); to double check that the on function is called only once... |
Beta Was this translation helpful? Give feedback.
-
I created a simple streams-adsr-i2s.ino example. |
Beta Was this translation helpful? Give feedback.
I created a simple streams-adsr-i2s.ino example.
Can you check if this is working for you with I2S ?
I only tested this on the AudioKit....