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
Self sustained producer-consumer(prosumer) policy study using Python and Gurobi

Prosumer Policy This project aims to model the optimum dispatch behaviour of households with PV and battery systems under different policy instrument

Tom Xu 3 Aug 31, 2022
Boot.img patcher for Tolino ebook readers to enable ADB and root.

I'm not responsible for any damage to your devices by running this tool. Please note that you may loose warranty when using this, although (This is no

Aaron Dewes 9 Nov 13, 2022
Minos-python - A framework which helps you create reactive microservices in Python

minos-python Summary [TODO] Packages minos-microservice-aggregate minos-microser

Minos Framework 380 Jan 04, 2023
An html wrapper for python

MessySoup What is it? MessySoup is a python wrapper for html elements. While still a ways away, the main goal is to be able to build a wesbite straigh

4 Jan 05, 2022
Library management using python & MySQL

Library management using python & MySQL Dev/Editor: Pavan Ananth Sharma & MK Akash Introduction: This is an intermediate project which is a user-frie

Pavan Ananth Sharma 2 Jul 05, 2022
The Playwright Workshop for TAU: The Homecoming

tau-playwright-workshop This repository contains the instructions and example code for the Playwright workshop for TAU: The Homecoming on December 1,

Pandy Knight 134 Dec 30, 2022
0xFalcon - 0xFalcon Tool For Python

0xFalcone Installation Install 0xFalcone Tool: apt install git git clone https:/

Alharb7 6 Sep 24, 2022
Python script for converting obsidian md-file to html (recursively adds all link/images)

ObsidianToHtmlConverter I made a small python script for converting obsidian md-file to static (local) html (recursively adds all link/images) I made

47 Jan 03, 2023
One destination for all the developer's learning resources.

DevResources One destination for all the developer's learning resources. Find all of your learning resources under one roof and add your own. Live ✨ Y

Gaurav Sharma 33 Oct 21, 2022
An Advanced Wordlist Library Written In Python For Acm114

RBAPG -RBAPG is the abbreviation of "Rule Based Attack Password Generator". -This module is a wordlist generator module. -You can generate randomly

Aziz Kaplan 11 Aug 28, 2022
Create standalone, installable R Shiny apps using Electron

Create standalone, installable R Shiny apps using Electron

Chase Clark 5 Dec 24, 2021
Grammar of Scalable Linked Interactive Nucleotide Graphics

Gosling.js Gosling.js is a declarative grammar for interactive (epi)genomics visualization on the Web. ⚠️ Please be aware that the grammar of Gosling.

Gosling 126 Nov 29, 2022
Ballistic calculator for Airsoft

Ballistic-calculator-for-Airsoft 用于Airsoft的弹道计算器 This is a ballistic calculator for airsoft gun. To calculate your airsoft gun's ballistic, you should

3 Jan 20, 2022
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python

Scalene: a high-performance CPU, GPU and memory profiler for Python by Emery Berger, Sam Stern, and Juan Altmayer Pizzorno. Scalene community Slack Ab

PLASMA @ UMass 7k Dec 30, 2022
This is sample project needed for security course to connect web service to database

secufaku This is sample project needed for security course to "connect web service to database". Why it suits alignment purpose It connects to postgre

Mark Nicholson 6 May 15, 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
Synchrosqueezing, wavelet transforms, and time-frequency analysis in Python

Synchrosqueezing is a powerful reassignment method that focuses time-frequency representations, and allows extraction of instantaneous amplitudes and frequencies

John Muradeli 382 Jan 06, 2023
Launcher program to select which version of the Q-Sys software to launch.

QSC-QSYS Launcher Launcher program to select which version of the Q-Sys software to launch. Instructions To use the application simply save the "Q-Sys

Zach Lisko 2 Sep 28, 2022
Export transactions for an algorand wallet to a CSV file

algorand_txn_csv_exporter - (Algorand transaction CSV exporter) This script will export transactions for an algorand wallet to a CSV file. It is inten

TeneoPython01 5 Jun 19, 2022
This repository can help you made a PocketMine-MP Server with Termux apps!

Hello This GitHub repository can made you a Server PocketMine-MP On development! How to Install Open Termux Type "pkg install git && python" If python

1 Mar 04, 2022