A Python API for SuperCollider
Project description
Supriya
Supriya is a Python API for SuperCollider.
Supriya lets you:
-
Boot and communicate with SuperCollider's synthesis engine in realtime.
-
Explore nonrealtime composition with scores.
-
Compile SuperCollider SynthDefs natively in Python code
-
Build time-agnostic asyncio-aware applications with the context interface.
-
Schedule patterns and callbacks with tempo- and meter-aware clocks
Quickstart
1. Get Supriya
Install from PyPI:
pip install supriya
Or from source:
git clone https://github.com/supriya-project/supriya.git
cd supriya
pip install -e .
2. Get SuperCollider
Get SuperCollider from http://supercollider.github.io/.
3. Boot the server
Start your Python interpreter and import Supriya:
>>> import supriya
Boot the SuperCollider server:
>>> server = supriya.Server().boot()
4. Build a SynthDef
Import some classes:
>>> from supriya import Envelope, synthdef
>>> from supriya.ugens import EnvGen, Out, SinOsc
Make a synthesizer definition:
>>> @synthdef()
... def simple_sine(frequency=440, amplitude=0.1, gate=1):
... sine = SinOsc.ar(frequency=frequency) * amplitude
... envelope = EnvGen.kr(envelope=Envelope.adsr(), gate=gate, done_action=2)
... Out.ar(bus=0, source=[sine * envelope] * 2)
...
Visualize the SynthDef (requires Graphviz):
>>> supriya.graph(simple_sine)
Allocate it on the server:
>>> _ = server.add_synthdefs(simple_sine)
... and then sync the server before proceeding to ensure the SynthDef has been fully parsed by scsynth:
>>> _ = server.sync()
5. Create some nodes
Create and allocate a group:
>>> group = server.add_group()
Create some synthesizers with the previously defined synthesizer definition, and allocate them on the server as a child of the previously created group:
>>> for i in range(3):
... _ = group.add_synth(simple_sine, frequency=111 * (i + 1))
...
Query the server's node tree:
>>> print(server.query_tree())
NODE TREE 0 group
1 group
1000 group
1003 simple_sine
amplitude: 0.1, frequency: 333.0, gate: 1.0
1002 simple_sine
amplitude: 0.1, frequency: 222.0, gate: 1.0
1001 simple_sine
amplitude: 0.1, frequency: 111.0, gate: 1.0
6. Release and quit
Release the synths:
>>> for synth in group.children[:]:
... synth.free()
...
Quit the server:
>>> server.quit()
License
This library is made available under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for supriya-24.9b0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62906d3272ab3646ed680de8a22e01522262b940cc0559290a71ff47eeea3279 |
|
MD5 | bb400c66d10be8375ef2f641dc538729 |
|
BLAKE2b-256 | a64cbd2b2ea0cab89f0fd8a97ac3ad09fe8dfea22964738284f4bd3dfc93c35f |
Hashes for supriya-24.9b0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b584abe5749a40abf6cba22f5aa8925d113cf104f38e095134be28688401e8e3 |
|
MD5 | 71f6da169483533416dee8ddca0b0b99 |
|
BLAKE2b-256 | 53df9ce445a07c4cc5c2c806d6d78c3a79115bfbfb538afc6568c415ecf83ee7 |
Hashes for supriya-24.9b0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c225291dc6e4cade30447a673597ccbbb09bb816cf473bd4c882eab0e76a2936 |
|
MD5 | bab4f37e4104508f09430ef13c64c189 |
|
BLAKE2b-256 | fa055f1e83007ef3b81138b6e6982733c136c75c2098aa6b383240990f4f739c |
Hashes for supriya-24.9b0-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761c12ac53e04d4682cf9afc62e1af7876f26fa5a2247b54991d3bc9d648b67c |
|
MD5 | 33450b288bf36b86d4ec4cf1788bbb86 |
|
BLAKE2b-256 | f4350d6991e0cd6903840e5d9768f872705fc4d0c2806c4bd963e98cf72e5a2d |
Hashes for supriya-24.9b0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5e75af56f74242f99a480628b0b0fd1b397667d9810254c948a929a2b19f73f |
|
MD5 | 9dd4d35ab4e2c2c59478f2a657f27790 |
|
BLAKE2b-256 | 31f06037a203367b8f62bcb59a17c1bc08b3a9295d7ab0f08eaed49050c4cbe7 |
Hashes for supriya-24.9b0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fa1e89a08be809a1b5d099c649da0334ecd446d18e439711f8f8ca1d3493f9d |
|
MD5 | 79d87a855a85166fd6eba2aad129d30c |
|
BLAKE2b-256 | d2dd290945683641b3c970c6378e02d574388a7fdca025e85a23c18e60dbbcb9 |
Hashes for supriya-24.9b0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 987014fdbeeedd8e018dc189bc39759d762ab4283376dacd43b15d22e409ae5b |
|
MD5 | e1f901bf2d0769e86d02331bb237ddbb |
|
BLAKE2b-256 | 4a4f9f10d86e66bd398f2a39a84b699f8fee5eb6a7dd1b4096e202f701f55a4f |
Hashes for supriya-24.9b0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55200ec6805dfc1a5a61e539947188473f44f911691b036cd7a2be74afb9d670 |
|
MD5 | ab6297044ed41feede6276f2dcaa58e7 |
|
BLAKE2b-256 | 93fb524603ae36909374ebcbc871b894347ae6a1f8a1ac6a191301c2965600b9 |
Hashes for supriya-24.9b0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26818a310b4092ed2828c2ef37f62fd922d3020369bb96ce94d41aee0e2149a5 |
|
MD5 | 61a8811cb60eced34e9d184b4b732f5c |
|
BLAKE2b-256 | b5ecc9990b873246782441481867cacb6b0c1811c5fe99ae795fd2bd0d9319d8 |
Hashes for supriya-24.9b0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dd191d7a437404d376b6fb3155ce0c07d3165125c4d705eb7d9e1ace4866b72 |
|
MD5 | a252545190271a6488412c73b8c75cbc |
|
BLAKE2b-256 | 0b96f634692424320a7090e2fb957ab33e9ba45a8f4b068475866d1e9285126d |
Hashes for supriya-24.9b0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c69620eeb2cf18d2a9b8c6026813635c0c0fe1ad9528cc4582789b43580419 |
|
MD5 | 3b113d5f25d963601964610e6b0ad2e7 |
|
BLAKE2b-256 | 6cb6a0e9061bc246b62e695aa001304801b1a9abc124551929e5fc3e33491d12 |
Hashes for supriya-24.9b0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c578df7748bf90a44c0f5ad19a9ece49fdf4c747e720f82795370fdf0146fb6 |
|
MD5 | e05709ec5f28973f7a48733ee6eed39b |
|
BLAKE2b-256 | ab5daf05585bff45b3044b5fd4f36a04a4b543055d9d67e31b80723be6e55a3d |
Hashes for supriya-24.9b0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42c27e24b100bec2fd68294bfcee5c98fee77f87e93c28cda99fb732e19a65b |
|
MD5 | 4cc2df726aa6dd6a99a4d8d03c1870c0 |
|
BLAKE2b-256 | 74f0877bd88c60f3baff7269795f81b1c3a3d36a5a7b5057ae49877710c38f75 |
Hashes for supriya-24.9b0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37d83331204d5de4b42f4ebda079264a422c44c9bb4ecf94568da9d9e9b782b5 |
|
MD5 | b18641327bc23095ff8935b904560f6d |
|
BLAKE2b-256 | e8c07a1931f0f43d7c3989d9c2bc63a90d986af26a18899f536126a92f4ca821 |
Hashes for supriya-24.9b0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e3da833d6f8579b327e3cb9dac22bfdd7b855c5319915120423d7b24eba53e2 |
|
MD5 | 4b54a2d1fa76b60571aee3df01b54450 |
|
BLAKE2b-256 | e04120cd42f60a0222e768733ec22a9ffa16ebf761ae0be3dec6a0654f3e7385 |
Hashes for supriya-24.9b0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64d45dc3ae9d529f0e88b1839de0f255dcd65ef306ab27ca6392539e117f2af0 |
|
MD5 | 496e7a09d38b4e09954a74eb794a208c |
|
BLAKE2b-256 | 5b032a311638c024d41278ca997a5c89fef12bfe45505e3296b3a8d906475801 |
Hashes for supriya-24.9b0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21fa297d0ad65c051d9781dbe3e80106caede2a573be24b18fec599a0bb22f70 |
|
MD5 | 7fbd0c57c16057eee53cea0b5361a72c |
|
BLAKE2b-256 | dd6e2ba3303397601975e4ac43344f870a271412ba360ce92ec278eb61df9ef7 |
Hashes for supriya-24.9b0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d037c646b10b2970191e5ab3518ca64a03b8def660f8c072b287f4d586e4d56 |
|
MD5 | 4168342c1654d6efd4c844417ae3f15e |
|
BLAKE2b-256 | 1fb685d4ec643a48a29ceeb7b175d62db0966c9d6c8b93c0e56b4076ddba881d |
Hashes for supriya-24.9b0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a03a9a41eeb88ff249a3da2317d361165d9a9af59951d709541c44016d701f8 |
|
MD5 | a818d841c705d15e6afcd7209e133a34 |
|
BLAKE2b-256 | a3ce21087a7e4d016ba2ee8bb19e895ced2f977d4249e5b47ba2d8835ead817d |
Hashes for supriya-24.9b0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14c78a26514efffc8bfaae36864f9129432660e6c3eb83b5317f1ac2199884aa |
|
MD5 | 89921c2363b73844aac28ff725dd7e71 |
|
BLAKE2b-256 | d6a0fe1b4a740dc33ff355fda5ae337d5e849ecaaf699f0487aa1c5af2e8e6a2 |
Hashes for supriya-24.9b0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac6f9d3524ef9c947b4052b2cf0fd3c81de4c27a1d112f9f73f50c14ff1ef737 |
|
MD5 | bc965203d103ac3e0103b8ede8d5ed82 |
|
BLAKE2b-256 | 8f0b15de60cce3b30a723b7e210eced555c9ee45eab6e1220a7df24f083fbfcb |
Hashes for supriya-24.9b0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 342ca37becb01510f8cb4ec2344ab810f03ab5d9a1dc807ae8444da8eb5475a9 |
|
MD5 | 1d4501e13f9d8ae996956ffb0275bf45 |
|
BLAKE2b-256 | 066f2cf56fcdce7ad5465fefb425ac767f73eb282da8b03a61a79ce10da7dfbe |
Hashes for supriya-24.9b0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d24ab6607d9cfbef5ca359e7a6efb6fd62a4b21303604fc1c9899849763d525b |
|
MD5 | 86940f63ff72a86ba7de9b600edb2068 |
|
BLAKE2b-256 | 7529c9e26b704528b6dcc0c9b545fd9a4bb84f3e2f69e52ec24da85c14e7215e |
Hashes for supriya-24.9b0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a61255cc876b737584af6708c363018263dfe18faeaf8c0ab8db16106494d1c5 |
|
MD5 | f48f78af931381ae3476bb83f055e240 |
|
BLAKE2b-256 | 884f2949c68358edbfa6dfb9e31afa25964d1c4a9087696081519bcc6d97eb77 |
Hashes for supriya-24.9b0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 671eef3293656d2e7bd2587a97903868453d3940a70ba58b0c5797fb846ac1fa |
|
MD5 | fcefba8e782f3563aac8edbc5170fcba |
|
BLAKE2b-256 | af75dfc855d32698229d781582944352ec6e4dbd5b92cb57dffb2f6ad848cab7 |
Hashes for supriya-24.9b0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3e38a25107b0c1ab48b6ce307de5e06c610f60e873c03ee61d2fd84bd51a9e7 |
|
MD5 | 67076120468016ae4260bdb0cc42a779 |
|
BLAKE2b-256 | 793abdd6c4de38add3d5d376fb2c806e5719c17a3422ecc3965b32de5a8dccdc |
Hashes for supriya-24.9b0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bec1fbafc89f636f2200bcf2de6abbc7d6219d49bca6358c9969b0ac8cd3a4e |
|
MD5 | 8aa0223f1cffd3f8fc113c7261b42a3e |
|
BLAKE2b-256 | 73e06ee9297bfc44f91cc526f5f29b27c939938294226450af92410c15ede90c |
Hashes for supriya-24.9b0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a5f3991875092a7cb530039fcb35ae0e487c6fb62dec2eaf43564cadc5bb1b |
|
MD5 | 148fa29cb334256fbe73ed7a198fd2a1 |
|
BLAKE2b-256 | 19f51fe4a4aed665dea6cf8a426c8c9a8b777d6b01ead16761341c5d50426b6b |