Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Supriya

Supriya is a Python API for SuperCollider.

Supriya lets you:

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supriya-26.8b0.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supriya-26.8b0-py3-none-any.whl (957.8 kB view details)

Uploaded Python 3

File details

Details for the file supriya-26.8b0.tar.gz.

File metadata

  • Download URL: supriya-26.8b0.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for supriya-26.8b0.tar.gz
Algorithm Hash digest
SHA256 e9cc2c0ab4f92668ef90c7383f64c60c91585f7fc9ee6d8ed4d640542431fbb2
MD5 1f8a902c501d4ccbf595e2cafe0cbfe3
BLAKE2b-256 1d15837c9dd09bc9f4ca642b027f33c8f3294edc3c2bef7d539e2ffd75323eed

See more details on using hashes here.

Provenance

The following attestation bundles were made for supriya-26.8b0.tar.gz:

Publisher: publish.yml on supriya-project/supriya

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file supriya-26.8b0-py3-none-any.whl.

File metadata

  • Download URL: supriya-26.8b0-py3-none-any.whl
  • Upload date:
  • Size: 957.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for supriya-26.8b0-py3-none-any.whl
Algorithm Hash digest
SHA256 67260168d69f8e4d260f3f812b854f0da51217eb1d27d9204850f38e0623cff8
MD5 c1689b7f1a36424520142d1cc034d968
BLAKE2b-256 f52a644606d03fd2831f7ce5dfa613e872e20a6b74cfa0c855b71c1c1ba61b91

See more details on using hashes here.

Provenance

The following attestation bundles were made for supriya-26.8b0-py3-none-any.whl:

Publisher: publish.yml on supriya-project/supriya

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

26.8b0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page