Scheduling - passivist/GRNLR GitHub Wiki
Scheduling
This is an instrument that sees the grain as an entity that can be created and destroyed. The grain has a certain lifetime and it doesn't exist outside of this lifetime. This approach allows great freedom in the temporal position of grains opposed to approaches where the synthesis is implemented by overlaying two windowed audio loops. Because I chose this approach we have to devise a way for the grain to start and to end.
For this we must implement three things:
- The
Grainclass will be extended by aonsetand alengthmember. The onset member will define the time at which the grain becomes 'active' and will be processed. Thelengthmember will define the length the grain will be playing and, if the position surpasses the length value, deleted. - The grains will be organized in a collection.
- We will define a scheduling function which will run on a background thread of the
AudioProcessorobject. This function will createGrainobjects in timed intervals which we should be able to control. TheGrainobjects should be created with all the necessary values. The function will also delete all the grains that are no longer being played.
Let's start by extending the grain class.