Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting voice params in faust2api DSP engine works counter intuitive #695

Closed
goofy2k opened this issue Jan 14, 2022 · 3 comments
Closed

Comments

@goofy2k
Copy link

goofy2k commented Jan 14, 2022

(excuse me for the lengthy description, I took this from a discussion thread, with minimal effort to re-phrase)

I use the Wavesynth FX generated with faust2api for ESP32 in polyphonic mode.

First some background on the API.

It contains several ways to start a sound/note:

  1. One can feed Midi data into the propagateMidi command. For playing a note this has to be called 2 times. First with a noteon status (9n), then with a noteoff (8n).
  2. By feeding a pitch and velocity to a keyOn command, followed by feeding the same pitch to keyOff
  3. By creating a voice with newVoice, setting the frequency (and other parameters) for this voice with setVoiceParamValue commands, using the voice address returned by newVoice. The last parameter set in this sequence is gate -> 1 to start the sound. Switching the sound off is done by setting gate to 0. If I am correct, the voice instance must be deleted with deleteVoice.

I use methods 1 and 2 in the same app.

The issue relates to setting sound parameters with setParamValue or setVoiceParamValue.
When I do this with setParamValue and propagateMidi notes respond accordingly. When I do this for a specific voice created with keyOn, I use setVoiceParamValue with the acquired voice address and this notes plays with the selected parameters for that voice. All allready playing notes do not change their characteristics, which is fine. However, when I start a note with propagateMidi after that this also plays with the last characteristics set for the specific voice. Is this intended behavior by design? I would think it would be useful to let voices where characteristics are not set with setVoiceParamValue always play with those set with setParamValue ?

So current behaviour of setParamValue and setVoiceParamValue is:

  • setParamValue: sets sound parameters for ALL voices including already playing ones and future ones
  • setVoiceParamValue: sets sound parameters for ALL future voices including the one that has just been started (and who'se address is used for this call)

A more "intuitive" way of operation would be:

  • setParamValue: sets sound parameters for ALL FUTURE voices where a setVoiceParamValue is not used.
  • setVoiceParamValue: sets sound parameters for this specific voice and NOT for any other future voice.

Just another way to describe the current counter-intuitive way of operation:

ALL future notes respond to the last setting made by either setParamValue OR setVoiceParamValue. With setParamValue also still playing PAST notes are affected.

@sletz
Copy link
Member

sletz commented Jan 17, 2022

  • be sure to use the latest master-dev branch
  • using propagateMidi to handle voices in not the recommended way. Better use keyOn/keyOff ornewVoice/deleteVoiceAPI
  • keyOn actually set values for the "freq/gate/gate" controllers
  • setParamValue access all voices (running ones and free ones).
  • setVoiceParamValue change the state of the voice given as parameter, obtained by keyOn of newVoice
  • deleteVoice now reset the voice

@goofy2k
Copy link
Author

goofy2k commented Jan 17, 2022

OK. I will check this again with keeping in mind your recommendations.
It will take me some time !

@goofy2k
Copy link
Author

goofy2k commented Jan 19, 2022

I have a solution for what I wanted to achieve: using channel-specific DSP parameters for notes. I now use only keyOn/keyOff and setVoiceParamValue. I described my method in a discussion that quite accidentally was started today: #696

@goofy2k goofy2k closed this as completed Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants