Repository navigation
audiolive: play audioinstruments' instruments and keep their turns going - #8
Merged
Merged
Conversation
… their fill() turns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
audiolive's default instrument, karplus, is gone from the audioinstruments package that the MIP index now serves, so a fresh install broke. The default is now poly106 (see audioinstruments.ALL for the names).
The new instruments only sound while fill() is called every 10 to 20 ms: notes, knobs and voices parking reach the sound there. LiveAudio now runs a periodic machine.Timer (TURN_MS, 10 ms) that gives each playing instrument its turn, guarded against re-entry because a Timer tick runs between the app's own bytecodes. It stops on stop() and recover(). Where there is no Timer, or an app owns the time, call live.service() from your own loop; set TURN_MS to None to start no timer.
Checked: on the unix build a poly106 note is silent without turns (peak 0) and sounds with service() (peak 11214). On an ESP32-P4 with the audio pump, a held poly106 note read peak 0 with the Timer stopped and about 3000 to 4300 with it running, no turn errors. On that board poly106 through the pump ran at 127 percent of a block with no effects, so it starved; that is the instrument's cost at 48 kHz, not the turns.