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
Contains a Jupyter Notebook for calculating remaining plants required based on field/lathhouse data.

Davis-Sunflowers-Su21 Project goals: Plants influence their reproduction and mating system in many ways. Various factors such as time of flowering, ab

1 Feb 10, 2022
This repository contains the exercices for the robotics class at Supaero, 2022.

Supaero robotics, 2022 This repository contains the exercices for the robotics class at Supaero, 2022. The exercices are organized by notebook. Each n

Gepetto team, LAAS-CNRS 5 Aug 01, 2022
Nimbus - Open Source Cloud Computing Software - 100% Apache2 licensed

⚠️ The Nimbus infrastructure project is no longer under development. ⚠️ For more information, please read the news announcement. If you are interested

Nimbus 194 Jun 30, 2022
A free and open-source chess improvement app that combines the power of Lichess and Anki.

A free and open-source chess improvement app that combines the power of Lichess and Anki. Chessli Project Activity & Issue Tracking PyPI Build & Healt

93 Nov 23, 2022
CircuitPython Driver for Adafruit 24LC32 I2C EEPROM Breakout 32Kbit / 4 KB

Introduction CircuitPython driver for Adafruit 24LC32 I2C EEPROM Breakout Dependencies This driver depends on: Adafruit CircuitPython Bus Device Regis

Adafruit Industries 4 Oct 03, 2022
Serverless demo showing users how they can capture (and obfuscate) their Lambda payloads in Datadog APM

Serverless-capture-lambda-payload-demo Serverless demo showing users how they can capture (and obfuscate) their Lambda payloads in Datadog APM This wi

Datadog, Inc. 1 Nov 02, 2021
Graveyard is an attempt at open-source reimplementation of DraciDoupe.cz

Graveyard: Place for Dead (and Undead) Graveyard is an attempt at open-source reimplementation of DraciDoupe.cz (referred to as DDCZ in this text). De

DraciDoupe.cz 5 Mar 17, 2022
A Gura parser implementation for Python

Gura parser This repository contains the implementation of a Gura format parser in Python. Installation pip install gura-parser Usage import gura gur

JWare Solutions 19 Jan 25, 2022
A set of tools for ripping music from Konami mobile games

Konami Mobile Ripping Toolset A set of tools for ripping music from Konami mobile games Contents nigger.py for niggering konami's website, ripping all

5 Oct 20, 2022
Grouping nucleotide coordinate ranges.

NuclRanger Grouping nucleotide coordinate ranges. A quick pre-processing step for "bedtools getfasta":- https://bedtools.readthedocs.io/en/latest/cont

Sujanavan Tiruvayipati 1 Oct 04, 2022
JLC2KICAD_lib is a python script that generate a component library for KiCad from the JLCPCB/easyEDA library.

JLC2KiCad_lib is a python script that generate a component library (schematic, footprint and 3D model) for KiCad from the JLCPCB/easyEDA library. This script requires Python 3.6 or higher.

Nicolas Toussaint 73 Dec 26, 2022
ColabFold / AlphaFold2_advanced on your local PC (or macOS)

LocalColabFold ColabFold / AlphaFold2_advanced on your local PC (or macOS) Installation For Linux Make sure curl and wget commands are already install

Yoshitaka Moriwaki 207 Dec 22, 2022
Ahmed Hossam 12 Oct 17, 2022
Ked interpreter built with Lex, Yacc and Python

Ked Ked is the first programming language known to hail from The People's Republic of Cork. It was first discovered and partially described by Adam Ly

Eoin O'Brien 1 Feb 08, 2022
Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages

Calculatrix What is Calculatrix ? Calculatrix is a project where I'll create plenty of calculators in a lot of differents languages. I know this sound

1 Jun 14, 2022
A program that takes Python classes and turns them into CSS classes.

PyCSS What is it? PyCSS is a micro-framework to speed up the process of writing bulk CSS classes. How does it do it? With Python!!! First download the

T.R Batt 0 Aug 03, 2021
Class and mathematical functions for quaternion numbers.

Quaternions Class and mathematical functions for quaternion numbers. Installation Python This is a Python 3 module. If you don't have Python installed

3 Nov 08, 2022
CMPE 204 Modelling Project

CISC/CMPE 204 Modelling Project Welcome to the major project for CISC/CMPE 204 (Fall 2021)! Change this README.md file to summarize your project (few

totallyrin 2 May 16, 2022
This script can be used to get unlimited Gb for WARP.

Warp-Unlimited-GB This script can be used to get unlimited Gb for WARP. How to use Change the value of the 'referrer' to warp id of yours You can down

Anix Sam Saji 1 Feb 14, 2022
An assistant to guess your pip dependencies from your code, without using a requirements file.

Pip Sala Bim is an assistant to guess your pip dependencies from your code, without using a requirements file. Pip Sala Bim will tell you which packag

Collage Labs 15 Nov 19, 2022