chaosprint / glicol

Graph-oriented live coding language and music/audio DSP library written in Rust
https://glicol.org
MIT License
2.25k stars 74 forks source link

updating may cause clicks #8

Closed chaosprint closed 2 years ago

chaosprint commented 3 years ago

maybe do some fading

chaosprint commented 3 years ago

lcs algorithm is used to solve this issue, but further testing is needed

chaosprint commented 3 years ago

partially solved by pre-process mul node; need further test

jarmitage commented 3 years ago

Are you planning to try to save and load node state when updating the graph? (e.g. oscillator phase)

chaosprint commented 3 years ago

Are you planning to try to save and load node state when updating the graph? (e.g. oscillator phase)

Yes. Actually, I think this has been achieved. First, I use dynamic programming to find the longest common subsequence between the previous graph and the updated graph. Thus, most of the nodes remain untouched, which is important for nodes such as plate reverb.

On top of this mechanism, I use a preprocessor for some nodes. For example, out: sin 440 is preprocessed to be out: const 440 >> sin 1. Then, if it is updated as out: sin 220, what the parser will receive is out: const 220>> sin 1. In this way, the previous phase information of the sin node itself will remain.

So far, what still needs to be optimised is that all these tasks (parsing the updated code and making the new nodes) are scheduled to the beginning of a new bar, which makes the processing pressure on that audio block quite heavy.