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.8b0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa482cd9e7ba4c04ed3a6cdbfc5928a235a5f3bdb9fda471e8ccbc0873716011 |
|
MD5 | 8ed1c45ee47a2a04a1c88a03220da596 |
|
BLAKE2b-256 | bdacff0e35a8ffc89d27f17864b5473378e38fd7ce9ace0188ee330f8d49c243 |
Hashes for supriya-24.8b0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f315ef04f4c13e397706e3822429e88d4977f9592f9edf33852ba82e6aec7aca |
|
MD5 | 1270ce5b435d5bd1d03e9d3df7fcd462 |
|
BLAKE2b-256 | 9e77ba88e78c1d572ff2734f391ee9e7c2b65cdc5f1a2c693657ddbc8b8e9d4b |
Hashes for supriya-24.8b0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfcee8eeac195856b9a6fa424b61553a6eb2940632e06f3d37b3819cdd33221a |
|
MD5 | d2fe67a861ea23011c21a5c86a878a85 |
|
BLAKE2b-256 | 4cf719636de817dddba90955011144b442482c9a724241a01238fd46f3343b75 |
Hashes for supriya-24.8b0-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db9bd7cc8f3b81b0f33057ceabdebbe6ec85ed0f7d24da326d1eeaf0e531ea0b |
|
MD5 | 6e65a5b4071d9764693aef23a072fd40 |
|
BLAKE2b-256 | 255bd8f2c36b48634fe02cd7093c5f1f526c6fb21d7b0e66ec3f8173de7159da |
Hashes for supriya-24.8b0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f1914c94093459540c9d77ad8be4dc4ba269158979e9b4d41d7af1d3d4733a |
|
MD5 | 0202ccb60595db851e289e47a02ee680 |
|
BLAKE2b-256 | aa0b23436b22f27f4d030401f8cb4a370d6d3f7b43e5f6a3b92a4b39abf383f6 |
Hashes for supriya-24.8b0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45309e2af530716ab79568eea4c9630b2b015de0ada62ac089930a7ee429fe5a |
|
MD5 | 21e00f6f5e10d1bd0fdf44f8ce094fb8 |
|
BLAKE2b-256 | afddc9befd2b8a5a53a829bb547d06d6737b13797968890d81da8e363b05a091 |
Hashes for supriya-24.8b0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4584d9fa6a808be1f938f9d83d1533c67b5bd789ce8b2f964bb63add6a3f7547 |
|
MD5 | 35358deffd2a7d56b06470c02441f10a |
|
BLAKE2b-256 | 30a0d5143f352c979388f1d500a0c7554a6e71a202a608721edc5eb383f14cd9 |
Hashes for supriya-24.8b0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6145dfef766165d268931d7744de4cf6212d39194a8a5f23bce5dde961ef239d |
|
MD5 | f834686f0454d2a4ebfabc2bb2ed6745 |
|
BLAKE2b-256 | 9b2874013a48f9400c5261c1dc5e53747e38c7ad502d17d6ff8d6508f10654b3 |
Hashes for supriya-24.8b0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03442cd1eec75599c7ff63ad72ad44bdb14884894639b5b9b6246b2fef9ae6f |
|
MD5 | 3fd6330cc608f68eea6f186da13fe382 |
|
BLAKE2b-256 | cf705e983f883aaa76b00526561ccf4cbed6ed6fcf9b6e1112f527d8eb1afc82 |
Hashes for supriya-24.8b0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60044b2fc068a557623455913b75b2d11a6675d2bd2739e38a2299495c969be1 |
|
MD5 | b95f849b341086b5fd92bc26d5599c89 |
|
BLAKE2b-256 | d6642835d79639b4684cf29b44ab36cfa6fe24cdc60a134c98b17769a735a8d0 |
Hashes for supriya-24.8b0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | addd8d3e5a48f5894a7bc482618aa2a2e36284e7b7cd1ef5765733f1c4952c66 |
|
MD5 | 8b89485dac16db6b622d52aaa8c7c1c3 |
|
BLAKE2b-256 | dc24cc99c2290a2e1e064e13e824bd76ce15ad613523a0d6b6039cdef6032c7d |
Hashes for supriya-24.8b0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b722d36dc10dd80a988b2c458f740f3ef18681cd84859bc66e2fe0a558b1e65 |
|
MD5 | 04460e1cb6d6918a99b561f4fd9894a2 |
|
BLAKE2b-256 | de3a9085841ff467fb9482fa4e6b360b6d0234fb2efde4f6b5d6fef29bbdf232 |
Hashes for supriya-24.8b0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db945b2e3e5f8ab973c522e931563738dc8347d94c5000c779cac979f5a9931 |
|
MD5 | 7d72632a5d82187e84207bfbadb655bf |
|
BLAKE2b-256 | bef090d117d1c4eb70aeebc33ec3f6bf0350a208430eaa1505fc7b9efc5f6924 |
Hashes for supriya-24.8b0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f69072c6433a9e1a7b416d42a3a1b4e7210c156c10ff3ee5e8c9667b138c4d2 |
|
MD5 | 64955ddbfd8796dafb5537055336ad55 |
|
BLAKE2b-256 | 3fb5f87183c1f5e0595e46006537162c24d093d4d71e4c2dd3b169d9cd841128 |
Hashes for supriya-24.8b0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aa76cad1a9a4091c65ffdbaffc7e93fa31ae5530488d56881014add747fc8e3 |
|
MD5 | ab4b6da55f9ecea7dd63df52d99578f4 |
|
BLAKE2b-256 | 5d4483b2d7245b1d6b8693adc40bb4b52ea1b840e50a9b4ce373354a6454d3c7 |
Hashes for supriya-24.8b0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aaffc432acc74809b5bc30215ae460554b277f84c46272245d8547d0d4c25b9 |
|
MD5 | b35f9a7cfbb56b91075a3a5b5bdb4548 |
|
BLAKE2b-256 | f019c46c5edd3f40fe7f2ca4c9314739c3451b9d08a7a8e42ac9f140d94da897 |
Hashes for supriya-24.8b0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cab2ccaf8502ff55e9807b55d79da728eaf8c75c3615657665aeeefd699bfe |
|
MD5 | 6ebaceafc176041952f2a2fb8f39a0d7 |
|
BLAKE2b-256 | e72826736c9afadf74edd32424905cc251dadfb036c9994e7b689cfe21739243 |
Hashes for supriya-24.8b0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be62e62019fd60ee138868111b64ea0b6172bad28d59ff5b07433cbeccf35d7c |
|
MD5 | ea8048ebe2c68619c8c7995b3cfd4158 |
|
BLAKE2b-256 | 9d8d3bb89c897c7c82eb3014114ff545c29b98fb3190ec38167bd33d300a8241 |
Hashes for supriya-24.8b0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 836ceaef2a1ebfa4ec4070bfb20b053381532a9564e3ece33fc41346f418ee7f |
|
MD5 | 3940d19717a3096d415dc7ec6c03629b |
|
BLAKE2b-256 | 0e88a53aa3ae4e4857d9a3aa060bdb0175ee0eb0e45d1d7185b9c79bbde83456 |
Hashes for supriya-24.8b0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb2cad58b5de40873027c7f8be4b9ccc653c3e1dc0124de873b01aa6751a2485 |
|
MD5 | acf303ec15248ece4b0c3429a6afc12f |
|
BLAKE2b-256 | 9c4f645b36c03e3ad0a0d53233595072660fb1bd846d6594abbed7c989ee6b8d |
Hashes for supriya-24.8b0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 312a76ededc9501719e1f135a28b5e465341dce0a0093e1cdee329193b40d713 |
|
MD5 | d08ac3fcc3b2b6c456f020b34de11e68 |
|
BLAKE2b-256 | 065233fccbc63cb388b96f6cb09873b87d993984a195c04aa018f477e2945bc3 |
Hashes for supriya-24.8b0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1b867c5b6b72be33389d8738aded603a4e0f2238ab7a214d344a8df1b901f3d |
|
MD5 | f69e3ad06c98cbbff43b0b788f0d9425 |
|
BLAKE2b-256 | c4ea35a26662575632ab11dfa28d9efb920277ca4547d4dc624df433eccc4a61 |
Hashes for supriya-24.8b0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 535b1d654a04fe4ae0c6925fbb21a0605078dba24501332829279dcae97abb59 |
|
MD5 | ab10516ee3271325de4d4c18e1445955 |
|
BLAKE2b-256 | 917aa24d9f28d208f07f0745ccd0e1feebaf30532a4d6d0f7ee3dca2bc8e8a15 |
Hashes for supriya-24.8b0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1829e3af386643d2b62106c5a1aa51e0487a6d14d3e18c305f36d522e135337e |
|
MD5 | 25fff780f6b417a1a81b4713e6558a84 |
|
BLAKE2b-256 | 3d5a8996a73f5807fe0de484629b2651ef30c3329e01acbde10891f49a22b0a3 |
Hashes for supriya-24.8b0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ead2934274eb70ff870cc8aac81540399167b3921d2baea17305a187f554ca |
|
MD5 | 7585b7827fb95026e2f892502a086417 |
|
BLAKE2b-256 | 218d4a1c1754e557b07e7a11b97e8f4990ae9f01af09caae8443a631259e375a |
Hashes for supriya-24.8b0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a761c6e399fd3f77695fa6584cdf37f9bfeb6ec1fc99584da6b286137d459b19 |
|
MD5 | 87aef6b00e265b8e7cec8addd7abe412 |
|
BLAKE2b-256 | d7f8ea7fe8785d7eecd78ff81e0cb36eff21dc199229b7090a73afe13e2ea2eb |
Hashes for supriya-24.8b0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e13db39203d6be8edd22256ed41732ea234bfa21c324e198a18fab44d1f54321 |
|
MD5 | 92f64f26f6e3dc3e2301c536176b3626 |
|
BLAKE2b-256 | 16ee1b49e9fc0ed16c9fc263cd799b03683953c735243cacff7001b47f6d6d6e |
Hashes for supriya-24.8b0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4bb2bb226903a09f26e849ffee2226fdaa402cf7577c830f741b928a2fbd4fd |
|
MD5 | 96e6af0107c41555f4081e20c82b86be |
|
BLAKE2b-256 | ad3bb75786be7f190eabcec64728691e3d5c0827b528ee4bb05f9ea3ecb0dbd6 |