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

Allow patches to be added at runtime #112

Merged
merged 1 commit into from
Mar 29, 2024
Merged

Allow patches to be added at runtime #112

merged 1 commit into from
Mar 29, 2024

Conversation

bwhitman
Copy link
Collaborator

@bwhitman bwhitman commented Mar 29, 2024

We had an offline imessage design session about this, but basically, this allows anyone using AMY to add patches at runtime by giving u1024,AMY_PATCH_STRING where 1024 is a patch number from 1024-1055. This message must be the only thing in the string sent over. amy.py will parse it and send it right away, and amy.c will treat the rest of the message as a patch, not further messages.

So you can do:

>>> import amy; amy.live()
>>> amy.send(store_patch="1024,v0S0Zv0S1Zv1w0f0.25P0.5a0.5Zv0w0f261.63,1,0,0,0,1A0,1,500,0,0,0L1Z")
>>> amy.send(voices="0",load_patch=1024)
>>> amy.send(voices='0',vel=2,note=50)

We divine the number of oscs used for the patch at store_patch time. If you store a new patch over an old one, that old memory is freed and re-allocated. We rely on malloc for all of this.

Also recall you can "record" patches in amy.py, so the whole loop is:

>>> amy.log_patch()
>>> amy.preset(5)
>>> bass_drum = amy.retrieve_patch()
>>> bass_drum
'v0S0Zv0S1Zv1w0f0.25P0.5a0.5Zv0w0f261.63,1,0,0,0,1A0,1,500,0,0,0L1Z'
>>> amy.send(store_patch="1024,"+bass_drum)

@bwhitman bwhitman merged commit 904eab5 into main Mar 29, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant