dzlonline / the_synth

A simple to use 4 polyphonic wavetable synthesizer library for Arduino.
328 stars 68 forks source link

How to stop a voice? #7

Open arpruss opened 6 years ago

arpruss commented 6 years ago

I have a really stupid question: I can set the note for a voice with mTrigger(), but I don't see an API to stop one particular voice. Am I missing something, or is the API missing?

dzlonline commented 6 years ago

Heh, that's right didn't implement that, I guess I never had use for it... I would briefly set the length of the voice to 0 which would cause instant decay. I guess you could implement a note-off this way...

If you need to mute/unmute the synth use .suspend() and .resume()

I will consider a voice.off() in the future lib.

Regards Dzl.

On Wed, Jul 12, 2017 at 12:32 AM, arpruss notifications@github.com wrote:

I have a really stupid question: I can set the note for a voice with mTrigger(), but I don't see an API to stop one particular voice. Am I missing something, or is the API missing?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dzlonline/the_synth/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9xSLnV-SOlmLCBPRIX7AuJCzN90vtUks5sM_gLgaJpZM4OU5nu .

arpruss commented 6 years ago

setLength(voice,0) does the job. By the way, what units is the length in?

perremba commented 4 years ago

You might use suspend in order to stop the interrupt, and then reconfigure the pin as input (to cut the remaining noise)