A Python API for SuperCollider
Project description
Supriya
Supriya is a Python API for SuperCollider.
Supriya lets you:
-
Boot and communicate with SuperCollider's
scsynth
synthesis engine: servers in realtime. -
Compile SuperCollider SynthDefs natively in Python code
-
Explore nonrealtime composition with scores.
-
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.7b0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f158c554046440f51cae789b30c70f7735de718374a6b2dabb158d329233daba |
|
MD5 | 4a092723a2f8dc21137cfcb33c0b5ae7 |
|
BLAKE2b-256 | abf964104c07d3675aacd8d803e8b2766172f7c4a88efacd4b77a78c7eb45d3d |
Hashes for supriya-24.7b0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2d2420f1e1833b7fe686fad06b815da7f7146d924254d0979da44ab058f1a19 |
|
MD5 | 4dab2e85216b9acbcbcd94eeb7a89216 |
|
BLAKE2b-256 | 3401587b0d54b78b9b805f736270960ae2ac60cc4490c9be5276b00f092ce450 |
Hashes for supriya-24.7b0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23512eb4c71a4053fcf4a058ce993ba80c073bfdbcdc261875761a1742ef9cc7 |
|
MD5 | e91599c4a4760b6c7774319d66a52ee2 |
|
BLAKE2b-256 | 61c43d53ef8d6dea024bca7998e3a7b358c4d4906678567a985c6d0c2ddd371d |
Hashes for supriya-24.7b0-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1eba4fd7132abfba21381fe471f867176a05df0c8faa0755eb9890f219b26a |
|
MD5 | ab4ad07f4c0cc7fcd5f59f72325485c0 |
|
BLAKE2b-256 | 0422208dcbc242d84b42de7c69640662e4a0537c73b31f19e0d257562faba705 |
Hashes for supriya-24.7b0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 703ebdea4b80bd5e69bc55ef4f6a7fed570051b80c9b3ede5ea1a2ab97551441 |
|
MD5 | ec563c2fbede2b8d830e10e25ed184ee |
|
BLAKE2b-256 | 4e8f34ba15e40440377d23aa0e0a76c44f79377bd65cfb86f198eb62ed1bf20e |
Hashes for supriya-24.7b0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b04e042f3943ec9be5fba77db149c5f9674b690520b78f7925e783ef13cfe5fc |
|
MD5 | 02287df8af27ff7b2eae17ab0abafdae |
|
BLAKE2b-256 | 991942a913c343ad1c032c5f541655dba8b07965aab7d2bb24bd9ca9fc7822d3 |
Hashes for supriya-24.7b0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4a0cc8fe97ccd5b713f74538543d7b09bc12f7640def4ae37bb71d2d56c4552 |
|
MD5 | d3aba45b9fd4a6a478c8bf872b00e142 |
|
BLAKE2b-256 | 6e4667e74afd357935763c7a1e5138f0bad5b35a088534e034cb93eda0e6c4c4 |
Hashes for supriya-24.7b0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab797a2dbd6320b28d00e1409b03805d812549760c01fe838dc4f6d17d5093a |
|
MD5 | 787e564cd5611e45064eb6509fcd56a0 |
|
BLAKE2b-256 | fec9e16f9ff15ba925cdfafc1e0fb08ae649c637e884cf2a6dd7245337a54380 |
Hashes for supriya-24.7b0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cd9b3600686a67adb741e462736f08209cb88543a26263f6496cd605f27a873 |
|
MD5 | b270a0f90869f22575cc7e47e650c14a |
|
BLAKE2b-256 | d86a6a75f0268aae6e0a604592d9ffecb560c17305947318a03ccc2f87e9b16c |
Hashes for supriya-24.7b0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d73e000fd577f8d2730cd7b2ba90af4781faba64c422dd2e1282f1d4a01ad4de |
|
MD5 | b3bbd6f03ada413749f35cb49cdaa06a |
|
BLAKE2b-256 | 81af32902b5ce69b2d26c12ef466c5ffe96b65224eae91c565b530efc2510d8e |
Hashes for supriya-24.7b0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a49c175799c40fd668d2fbac1029ff8576bc0a5177a9144e7831ef80accd169 |
|
MD5 | f34d8e85dedb06b593837dda30c960f7 |
|
BLAKE2b-256 | 9368ebe5f8e9a0b4590fedbea6141ff577f2da58c75108e1a5a778a361d2e913 |
Hashes for supriya-24.7b0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29ef7f24cc52ad23a4b8a31a021a035f239ed56e4b02e8b1df039d7bb8fa33a6 |
|
MD5 | ee3942acef5c041aec87c2fc1f544791 |
|
BLAKE2b-256 | 42af83779dc0c8111e9f4b495e20078b3411017355f9928fa81bdcdfebec9160 |
Hashes for supriya-24.7b0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbb32d01d191303142410e73874331ac32b829b0114d4f13004240669dbdb8c7 |
|
MD5 | bc9da18b528f024873fa38c1bdebb8b9 |
|
BLAKE2b-256 | c7ad383c2fdd8791b1c8d059f615dda08ffc5aded271752c14e35aae613b035f |
Hashes for supriya-24.7b0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 326bb397c946b26e83d5ed56692e236804c66f0ca49eca298749c6489555e6f9 |
|
MD5 | fde58dcc2b1e087b8686c7c175be573e |
|
BLAKE2b-256 | 5461d29a1326551dc61ad8fe432059e61edaab23a726b901aca566a526947fd6 |
Hashes for supriya-24.7b0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53dff6a659196cf608ea697cf53a388724fc2c25f6d2fc3166eb2f07092fb86c |
|
MD5 | d8e7aa19ef3af1611cc4d9e9f3cc2745 |
|
BLAKE2b-256 | 9c4ea5507129bf6ca6ef1dc31f4683cf3e664b895eaf5005882130f3f32680b5 |
Hashes for supriya-24.7b0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62c9b02ea867c6572c76355ce23e5f34657fad0befb8dc2d82bb3015d3ef25b2 |
|
MD5 | d2455f2889c9395578d6dc5dff18d456 |
|
BLAKE2b-256 | a05edb019e0ed87c0b71a069ecaef52adc5632c5621ad47ebc8fbd390d21493c |
Hashes for supriya-24.7b0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a33d7d0cdcad5ce2f2dd88c3f3475c0272dea8569e98b1132b9346948b8e991 |
|
MD5 | 401fde98ef24890011b3f8d6b23d63d3 |
|
BLAKE2b-256 | 451e7ce4d400b57eff0e660b58b0c3de620f0e71ffbd347269828757e944d4fb |
Hashes for supriya-24.7b0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 833291893ba326fd80a70cae58abe7c30ed064844718be212d0dd0bf1cd6b025 |
|
MD5 | 74e438e75dfa4b221ed0b1e47ee48d48 |
|
BLAKE2b-256 | b07abf764c86db04824402f6cd779124b5a2fa25e40d6063a5dbce8773ad361e |
Hashes for supriya-24.7b0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3384cb3148631548eed8b2eb4053c4ff77d50883397aa5e38a24fbf7b8007e8 |
|
MD5 | 3acdb655a524f2c555f5c751e5fb89ed |
|
BLAKE2b-256 | a17fe3ccb6598a30331f0445a91cbf0edaef3c5375b808a93b52b2e3f27514ce |
Hashes for supriya-24.7b0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1449928a736b03af2dd63271c27886c1f323a59b90c2105bfd1a8428e85a50f1 |
|
MD5 | dccd2a2c285c9a59e136b9aade01bffc |
|
BLAKE2b-256 | 7f7a402e72bb685c710d7a68c90e2535f8cf82f786944cb09184c90f607d98e4 |
Hashes for supriya-24.7b0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9382490d61d6074b14de830749da76e9dfd478b7bcc84182304cd107d9f0eb61 |
|
MD5 | 6884114535b9c746b25f1dda716f4791 |
|
BLAKE2b-256 | 8a0d0d7acf9ed7e55cd4f2711b4537fed6e6ff3f37396ae3ef90ac9faba8e71d |
Hashes for supriya-24.7b0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3ff6ab4256472fb440dea2eb448cb6329030404bcb73d777c8521e399af8707 |
|
MD5 | d5fed504476c933e65e0811db367b2e7 |
|
BLAKE2b-256 | bf327aa46c24b57331d70b6daccb97c2872543f9f6b6cc7812d43ab48b1464ad |
Hashes for supriya-24.7b0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e8e34b02138700fdd333b57d91ce05a86ebc38efa4c25eaa14215294ea0af17 |
|
MD5 | fa21a8c2c428d5e39e3007d3b0573113 |
|
BLAKE2b-256 | 9ffe63518f04b39724e67e82ac69a6090bd61017cfa4c534be61061706084527 |
Hashes for supriya-24.7b0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc9604f18454915e44283ccf7ce96b9bb75602dbd655b7e6e472fb72ee1cebb6 |
|
MD5 | 8e40fe37369904972e65dbeb71b78fe4 |
|
BLAKE2b-256 | 420867670514b5cb59aee9d2169dee765446ed3a1584849ead224eac83794023 |
Hashes for supriya-24.7b0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c8713e6bdf079a00d6a3f4c418b4d195cc49b2d5fbaf9cbe97d17d347accaef |
|
MD5 | adfb727d6d188eff7d41a8959b96b775 |
|
BLAKE2b-256 | 7545e7916ebd7bfcc7905c84eec4a6d5e844f21ad7743c50ab27180a99392997 |
Hashes for supriya-24.7b0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7763add3fb7b5640320d83c516cf9611dfc21e2be4f4996d15c423269f43534 |
|
MD5 | 08ced823272077a7c5f1a4b6f577611d |
|
BLAKE2b-256 | c2eb1b591ae5e2a0ebbfb4c57d37877a9d1de891a7a42e58bb5923de8737e7b9 |
Hashes for supriya-24.7b0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936331bac40bbdf300a34bdec73e8c5077d1b900df02e947103f5c662913a935 |
|
MD5 | 1338906aede73fe770c1ebb57d1e7118 |
|
BLAKE2b-256 | dc6a68f8dc49438a086830f98fff642345d59acdcf205066724e33d2c8099a71 |
Hashes for supriya-24.7b0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72ec5c629def3b78479015de2020b491ca6d344277af3507d7d807e4cfd76f0f |
|
MD5 | 5d396d15bd0d3e13db61e5a418f6c8db |
|
BLAKE2b-256 | c8751318c2d2c27cf67723c1b54db66dc51eebd16c4ff99e9d7f154c23728563 |