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
Free version of Okuru selfbot, okuru.xyz

Indigo Selfbot Free OpenSource selfbot, Premium version can be found at https://okuru.xyz (5$.) Usage python[3] main.py Installation To install you ca

Dimitri Demarkus 31 Aug 07, 2022
Just another sentiment wrapper.

sentimany Just a simple sentiment tool. It just grabs a set of pre-made sentiment models that you can quickly use to attach sentiment scores to text.

vincent d warmerdam 15 Dec 27, 2022
Persistent/Immutable/Functional data structures for Python

Pyrsistent Pyrsistent is a number of persistent collections (by some referred to as functional data structures). Persistent in the sense that they are

Tobias Gustafsson 1.8k Dec 31, 2022
My solutions to Advent of Code 2021 (written in Python)

Advent of Code 2021 This repository contains my solutions for the 2021 edition of Advent of Code. Please do not expect perfectly polished solutions, m

Nils 2 May 29, 2022
HiSim - House Infrastructure Simulator

HiSim is a Python package for simulation and analysis of household scenarios using modern components as alternative to fossil fuel based ones.

FZJ-IEK3 17 Dec 17, 2022
A tool for RaceRoom Racing Experience which shows you launch data

R3E Launch Tool A tool for RaceRoom Racing Experience which shows you launch data. Usage Run the tool, change the Stop Speed to whatever you want, and

Yuval Rosen 2 Feb 01, 2022
Pequenos programas variados que estou praticando e implementando, leia o Read.me!

my-small-programs Pequenos programas variados que estou praticando e implementando! Arquivo: automacao Automacao de processos de rotina com código Pyt

Léia Rafaela 43 Nov 22, 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 simple PID tuner and simulator.

PIDtuner-V0.1 PlantPy PID tuner version 0.1 Features Supports first order and ramp process models. Supports Proportional action on PV or error or a sp

3 Jun 23, 2022
A demo of a data science project using Kedro

iris Overview This is your new Kedro project, which was generated using Kedro 0.17.4. Take a look at the Kedro documentation to get started. Rules and

Khuyen Tran 14 Oct 14, 2022
Processamento da Informação - Disciplina UFABC

Processamento da Informacao Disciplina UFABC, Linguagem de Programação Python - 2021.2 Objetivos Apresentar os fundamentos sobre manipulação e tratame

Melissa Junqueira de Barros Lins 1 Jun 12, 2022
Mengzhan (John) code for Closed Loop Control system of Sharp Wave Ripples in Hippocampus CA3 region

ClosedLoopControl_Yu Mengzhan (John) code for Closed Loop Control system of Sharp Wave Ripples in Hippocampus CA3 region Creating Python Virtual Envir

Mengzhan (John) Liufu 1 Jan 22, 2022
WildHack 2021 solution by Nuclear Foxes team (public version).

WildHack 2021 Nuclear Foxes Team This repo contains our project for the Wildberries Hackathon 2021. Task 2: Searching tags Implement an algorithm of r

Sergey Zakharov 1 Apr 18, 2022
A Python package for searching journal publications and researchers

scholarpy A python package for searching journal publications and researchers Free software: MIT license Documentation: https://giswqs.github.io/schol

Qiusheng Wu 8 Mar 12, 2022
A simple way to read and write LAPS passwords from linux.

A simple way to read and write LAPS passwords from linux. This script is a python setter/getter for property ms-Mcs-AdmPwd used by LAPS inspired by @s

Podalirius 36 Dec 09, 2022
Notebook researcher - Notebook researcher with python

notebook_researcher To run the server, you must follow these instructions: At th

4 Sep 02, 2022
Python program that generates random user from API

RandomUserPy Author kirito sate #modules used requests, json, tkinter, PIL, urllib, io, install requests and PIL modules from pypi pip install Pillow

kiritosate 1 Jan 05, 2022
Process GPX files (adding sensor metrics, uploading to InfluxDB, etc.) exported from imxingzhe.com

Xingzhe GPX Processor 行者轨迹处理工具 Xingzhe sells cheap GPS bike meters with sensor support including cadence, heart rate and power. But the GPX files expo

Shengqi Chen 8 Sep 23, 2022
Windows symbol tables for Volatility 3

Windows Symbol Tables for Volatility 3 This repository is the Windows Symbol Table storage for Volatility 3. How to Use $ git clone https://github.com

JPCERT Coordination Center 31 Dec 25, 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