SuperCollider library for Python

Overview

PyPI Documentation Status PyPI - Python Version

SuperCollider library for Python

This project is a port of core features of SuperCollider's language to Python 3. It is intended to be the same library in a different language and to keep sclang elegance in a pythonic way (if possible).

The main reason for this port is Python's capacity of interaction with other libraries applicable to composition, sonic-art and research. My wish is for this project to be useful for the SuperCollider community.

Note that this project is still under development and there are missing parts, bugs you are welcome to report, and documentation is under construction. The best way to learn about SuperCollider is going to the source.

Example

The idea is that you can write the same in Python as in sclang, with the same logic regarding multichannel expansion, arguments conversion to Control ugens, etc., it should be the same result. For example:

from sc3.all import *

s.boot()

@synthdef
def sine(freq=440, amp=0.1, gate=1):
    sig = SinOsc(freq) * amp
    env = EnvGen(Env.adsr(), gate, done_action=2)
    Out(0, (sig * env).dup())

sine.dump_ugens()

Wait for boot...

n = Synth('sine')
n.set('amp', 0.05)
n.set('freq', 550)
s.dump_tree(True)
n.release()
# s.free_nodes()  # If something went wrong free all nodes.
s.quit()  # Stop server at the end of interactive session or just quit ipython.

Install

From PyPI (usually outdated by now):

pip3 install sc3

From source in develop mode (recommended for the moment):

python3 setup.py develop --user

License

The sc3 library is free software available under Version 3 of the GNU General Public License. See COPYING for details.

NB: The sc3 library is a Python translation of the SuperCollider's library and inherits its same license and community guidelines.

Comments
  • FM7 synth

    FM7 synth

    Hi! Is it possible to add FM7 synth? I am especially interested in its arAlgo function. Thanks.

    Also, I tried writing something like:

    from sc3.synth import ugen as ugn
    
    class FM7(ugn.MultiOutUGen):
        @classmethod
        def ar(cls, ctlMatrix, modMatrix):
            return cls._multi_new("audio", ctlMatrix, modMatrix)
    
        def _init_ugen(self, *inputs):
            self._inputs = inputs
            return self._init_outputs(6, self.rate)
    

    but it will return "ChannelList([ChannelList([ChannelList([..." which I don't know how to convert into sound.

    opened by gexahedron 16
  • Add missing bin_dir() method to DarwinPlatform class.

    Add missing bin_dir() method to DarwinPlatform class.

    I'm not sure if this is the correct way to add this method, but it worked on my Mac.

    I had to add this because when it tried to import everything (Sphinx does this when building docs), it tried to call bin_dir() and raised a NotImplementedError.

    opened by munshkr 3
  • Updates on the fly, for live-coding

    Updates on the fly, for live-coding

    Hi! Say I want something like Pbindef with dynamic updating, for live coding, like here in Eli Fieldsteel video: https://youtu.be/8Is3hJvzjvs?t=1217 How do I do this? How do I use quant (so that new updates/changes will land on a beat, not in the middle of a pattern)? How do I update speed of TempoClock?

    opened by gexahedron 2
  • Scsynth not found.

    Scsynth not found.

    Hello, First this project look really interesting. Something you dream at night when you begin in Python and Supercollider... And you did it! i love the transcription between the two laguage.

    I wanted to test and get this error (with your example script) : ERROR:sc3.synth.server:localhost failed to boot, program scsynth not found

    I'm on mac OS Catalina. Python3.7.4 SuperCollider 3.11.2 My regular SuperCollider app is in /Applications/SuperCollider. I copied this app to this path to : /Users/macbook/Applications/SuperCollider but same result...

    got sc3 from source code in develop mode (everything goes fine).

    For info i can use without problem an other SuperCollider / Pyhton project => supercollider and start SC server within VS-Code. So i'am wondering why it doesn't find my Scsynth program?

    Thank you very much. I hope to test it soon ! Michaël Filler.

    opened by Cricot2 2
  • syntax for patterns, loading buffers etc

    syntax for patterns, loading buffers etc

    Hi,

    I was wondering if you wouldn't mind clarifying what the syntax would be for accessing the patterns functionality, and for loading buffers. Also is JITLib (Ndef, Pdef, Tdef etc) included in this wrapper?

    Thanks,

    Mark

    opened by markhanslip 1
  • Use Sphinx to generate documentation.

    Use Sphinx to generate documentation.

    Includes an index.rst based on README.md, and sets autodoc and other Sphinx extensions for autogenerating module documentation from docstrings.

    Personally, I also recommend configuring readthedocs for free hosting and automatic generation on git pushes :)

    opened by munshkr 1
  • Missing patterns from RandomDistPatterns.sc

    Missing patterns from RandomDistPatterns.sc

    Discussed in https://github.com/smrg-lm/sc3/discussions/14

    Originally posted by d3vp July 31, 2022 So far I have added the following things I found missing in sc3:

    • method: Env.delay
    • class Pgauss(ValuePattern)

    Is there any alternative to delay?

    opened by smrg-lm 0
  • Problem using list of freq in synthdef & Pbind

    Problem using list of freq in synthdef & Pbind

    Hi,

    First of all, thank you for the great library. I am trying to implement this example using sc3.

    from sc3.all import *
    
    @synthdef
    def dtmf(freq=(770, 1633), out=0, amp=0.2, gate=1):
        son = SinOsc.ar(freq, 0).sum() * amp
        env = EnvGen.ar(Env.asr(0.001, 1, 0.001), gate, done_action=2)
        Out.ar(out, Pan2.ar(son * env * amp))
    
    # this works:
    Pbind({'instrument': 'dtmf',
            'dur': Pwhite(0.2, 0.5),
            'sustain': 0.15,
            'amp': 0.3,
            'freq': Prand([697, 1209, 770, 1209], 13)
    }).play();
    
    # but this does not work:
    Pbind({'instrument': 'dtmf',
            'dur': Pwhite(0.2, 0.5),
            'sustain': 0.15,
            'amp': 0.3,
            'freq': Prand([[697, 1209],[770, 1209], [852, 1209], [697, 1336]], 13)
    }).play();
    

    But getting following error:

    ERROR:sc3.base.clock:EventStreamPlayer(EventStreamPlayer._stream_player_func.<locals>.esp_func) scheduled on SystemClock
    Traceback (most recent call last):
      File "/Supercollider/sc3/sc3/base/clock.py", line 237, in _run
        delta = task.__awake__(cls)
      File "/Supercollider/sc3/sc3/base/stream.py", line 608, in __awake__
        return self.next((self, clock))
      File "/Supercollider/sc3/sc3/base/stream.py", line 491, in next
        self._last_value = next(self._iterator)
      File "/Supercollider/sc3/sc3/seq/eventstream.py", line 140, in esp_func
        yield self._play_and_delta(outevent)
      File "/Supercollider/sc3/sc3/seq/eventstream.py", line 148, in _play_and_delta
        outevent.play()
      File "/Supercollider/sc3/sc3/seq/event.py", line 624, in play
        self['freq'] = self._detuned_freq()  # Before _get_msg_params.
      File "/Supercollider/sc3/sc3/seq/event.py", line 221, in _detuned_freq
        return self('freq') * self('harmonic') + self('detune')
    TypeError: can't multiply sequence by non-int of type 'float'
    

    Not sure if I am doing something wrong or it is a bug or missing feature.

    opened by d3vp 4
Owner
Lucas Samaruga
Lucas Samaruga
Battle-Ship - Python-console battle ship

Battle-Ship this SHOULD work in lenux(if i spelled it wrong spam issues till I fix it) the thing that maby wont work is where it clears the screen the

pl608 2 Jan 06, 2022
Sample python script for monitoring Rocketchat database and get statistics of users.

rocketchat-DB-monitoring Sample python script for monitoring Rocketchat database and get statistics of users. 1. Update python: yum check-update && yu

Mojtaba Taleghani 1 Apr 12, 2022
Inacap - Programa para pasar las notas de inacap a una hoja de cálculo rápidamente.

Inacap Programa en python para obtener varios datos académicos desde inacap y subirlos directamente a una hoja de cálculo. Cómo funciona Primero que n

Gabriel Barrientos 0 Jul 28, 2022
Santa's kitchen helper for python

Santa's Kitchen Helper Introduction/Overview Contents UX User Stories Design Wireframes Color Scheme Typography Imagery Features Exisiting Features Fe

Paul Browne 4 May 31, 2022
Simple Kahoot Botter.

Kahoot A simple Botter made in Python 3 for Kahoot.com. Also sorry for the shitty code lol. How to Run You need Python 3 installed on your device. Aft

7 Jun 29, 2022
Tutorials on advanced python topics, and literate programming framework to write them.

Advanced course on Python3 This course covers several topics Python decorators The python object system / meta classes Also see my text on Python impo

Michael Moser 59 Dec 19, 2022
a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself.

Handy Project a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself. the handy pro

amirkasra esmaeilian 13 Jul 05, 2021
Notifies server owners of mod updates, also notifies of player deaths and player joins through Discord.

ProjectZomboid-ServerAssistant Notifies server owners of mod updates, also notifies of player deaths and player joins through Discord. A Python based

3 Sep 30, 2022
⏰ Shutdown Timer is an application that you can shutdown, restart, logoff, and hibernate your computer with a timer.

Shutdown Timer is a an application that you can shutdown, restart, logoff, and hibernate your computer with a timer. After choosing an action from the

Mehmet Güdük 5 Jun 27, 2022
Store Simulation

Almacenes Para clonar el Repositorio: Vaya a la terminal de Linux o Mac, o a la cmd en Windows y ejecute:

Johan Posada 1 Nov 12, 2021
An easy FASTA object handler, reader, writer and translator for small to medium size projects without dependencies.

miniFASTA An easy FASTA object handler, reader, writer and translator for small to medium size projects without dependencies. Installation Using pip /

Jules Kreuer 3 Jun 30, 2022
The program calculates the BMI of people

Programmieren Einleitung: Das Programm berechnet den BMI von Menschen. Es ist sehr einfach zu handhaben, so können alle Menschen ihren BMI berechnen.

2 Dec 16, 2021
Liquid Rocket Engine Cooling Simulation

Liquid Rocket Engine Cooling Simulation NASA CEA The implemented class calls NASA CEA via RocketCEA. INSTALL GUIDE In progress install instructions fo

John Salib 1 Jan 30, 2022
Module for remote in-memory Python package/module loading through HTTP/S

httpimport Python's missing feature! The feature has been suggested in Python Mailing List Remote, in-memory Python package/module importing through H

John Torakis 220 Dec 17, 2022
Msgpack serialization/deserialization library for Python, written in Rust using PyO3 and rust-msgpack. Reboot of orjson. msgpack.org[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Aviram Hassan 139 Dec 30, 2022
A webapp for taking fast notes, designed for business, school, and collaboration with groups.

JOTS Journal of the Session A webapp for taking fast notes, designed for business, school, and collaboration with groups.

Zebadiah S. Taylor 2 Jun 10, 2022
Structured Exceptions for Python

XC: Structured exceptions for Python XC encourages a structured, disciplined approach to use of exceptions: it reduces the overhead of declaring excep

Bob Gautier 2 May 28, 2021
tool to automate exploitation of android degubg bridge vulnerability

DISCLAIMER DISCLAIMER: ANY MALICIOUS USE OF THE CONTENTS FROM THIS ARTICLE WILL NOT HOLD THE AUTHOR RESPONSIBLE HE CONTENTS ARE SOLELY FOR EDUCATIONAL

6 Feb 12, 2022
Extremely unfinished animation toolset for Blender 3.

AbraTools Alpha IMPORTANT: Code is a mess. Be careful using it in production. Bug reports, feature requests and PRs are appreciated. Download AbraTool

Abra 15 Dec 17, 2022
My Analysis of the VC4 Assembly Code from the RPI4

My Analysis of the VC4 Assembly Code from the RPI4

Nicholas Starke 31 Jul 13, 2022