alex-parisi / dibiff

Directed Audio Graphs
MIT License
1 stars 0 forks source link

Add control signals #1

Open alex-parisi opened 1 month ago

alex-parisi commented 1 month ago

Right now the audio graph supports two types of input/output connections: MIDI and audio data.

MIDI connections are implemented in the dibiff::graph::MidiInput and dibiff::graph::MidOutput classes.

Audio data connections are implemented in the dibiff::graph::AudioInput and dibiff::graph::AudioOutput classes.


The need has arisen for a third type of data connection type: control. For example, in the case of Baby's First Synth, the mixer mixes all of the voices together equally, when it should ideally only be mixing together the active voices. This would prevent notes with one voice from being significantly less loud that notes with all voices. If the Envelope objects could report their EnvelopeStage's to the mixer, the mixer would be able to apply the correct amount of attenuation.

alex-parisi commented 1 month ago

This was a bad example - in the case of Baby's First Synth, the gain should be a ratio of the number of voices. The mixer should not be related to this.

However, a different use case would be to sync up the Generator with the Envelope elements. When the frequency is changed, the phase is correctly changed between frequencies with the generator - this results in a slight delay (a few samples) until the new frequency starts "playing". But the 'Envelope' element will react immediately, and begin opening before the frequency has smoothly changed.

Even though there is attack applied to the Envelope element, there is still the potential of opening it up too early. A control signal could tell the Envelope how many samples to wait before acting.