Skip to main content

Live coding music with SuperCollider

Project description

FoxDot - Live Coding with Python v0.6

FoxDot is a Python programming environment that provides a fast and user-friendly abstraction to SuperCollider. It also comes with its own IDE, which means it can be used straight out of the box; all you need is Python and SuperCollider and you're ready to go!

v0.6.4 fixes and updates

  • Fix Tkinter issues with "KP" events and added selection using shift + numpad usage
  • Update setup.py to allow FoxDot to be started from the CLI just using a simple FoxDot command.

v0.6.3 fixes and updates

  • Fixed bug stopping pentatonic versions of scales being updated
  • Moved a few samples around - notably the default "o" snare drum was replaced with the default snare drum assigned to "u"
  • Echo effect now relates to number of beats instead of the value of sustain such that echo=0.5, sus=4 means you hear the echoed sound after half a beat, not after 2 beats.
  • Added navigation using the numpad

Installation and startup

Prerequisites

Recommended

Installing FoxDot

  • Open up a command prompt and type pip install FoxDot. This will download and install the latest stable version of FoxDot from the Python Package Index if you have properly configured Python.
  • You can update FoxDot to the latest version if it's already installed by adding -U or --upgrade flag to this command.
  • Alternatively, you can build from source from directly from this repository:
$ git clone https://github.com/Qirky/FoxDot.git
$ cd FoxDot
$ python setup.py install
  • Open SuperCollder and install the FoxDot Quark and its dependencies (this allows FoxDot to communicate with SuperCollider) by entering the following and pressing Ctrl+Return (Note: this requires Git to be installed on your machine if it is not already):
Quarks.install("FoxDot")
  • Recompile the SuperCollider class library by going to Language -> Recompile Class Library or pressing Ctrl+Shift+L

Startup

  1. Open SuperCollider and type in FoxDot.start and evaluate this line. SuperCollider is now listening for messages from FoxDot.
  2. Start FoxDot by entering python -m FoxDot at the command line.
  3. If you have installed the SC3 Plugins, use the "Code" drop-down menu to select "Use SC3 Plugins". Restart FoxDot and you'll have access to classes found in the SC3 Plugins.
  4. Check out the YouTube tutorials for some in-depth tutorial videos on getting to grips with FoxDot

Installing with SuperCollider 3.7 or earlier

If you are having trouble installing the FoxDot Quark in SuperCollider, it’s usually because the version of SuperCollider you are installing doesn’t have the functionality for installing Quarks or it doesn’t work properly. If this is the case, you can download the contents of the following SuperCollider script: foxdot.scd. Once downloaded, open the file in SuperCollider and press Ctrl+Return to run it. This will make SuperCollider start listening for messages from FoxDot.

Frequently Asked Questions

You can find answers to many frequently asked questions on the FAQ post on the FoxDot discussion forum.

Basics

Executing Code

A 'block' of code in FoxDot is made up of consecutive lines of code with no empty lines. Pressing Ctrl+Return (or Cmd+Return on a Mac) will execute the block of code that the cursor is currently in. Try print(1 + 1) to see what happens!

Player Objects

Python supports many different programming paradigms, including procedural and functional, but FoxDot implements a traditional object orientated approach with a little bit of cheating to make it easier to live code. A player object is what FoxDot uses to make music by assigning it a synth (the 'instrument' it will play) and some instructions, such as note pitches. All one and two character variable names are reserved for player objects at startup so, by default, the variables a, bd, and p1 are 'empty' player objects. If you use one of these variables to store something else but want to use it as a player object again, or you want to use a variable with more than two characters, you just have to reserve it by creating a Player and assigning it like so:

p1 = Player("p1") # The string name is optional

To stop a Player, use the stop method e.g. p1.stop(). If you want to stop all players, you can use the command Clock.clear() or the keyboard short-cut Ctrl+., which executes this command.

Assigning synths and instructions to a player object is done using the double-arrow operator >>. So if you wanted to assign a synth to p1 called 'pads' (execute print(SynthDefs) to see all available synths) you would use the following code:

p1 >> pads([0,1,2,3])

The empty player object, p1 is now assigned a the 'pads' synth and some playback instructions. p1 will play the first four notes of the default scale using a SuperCollider SynthDef with the name \pads. By default, each note lasts for 1 beat at 120 bpm. These defaults can be changed by specifying keyword arguments:

p1 >> pads([0,1,2,3], dur=[1/4,3/4], sus=1, vib=4, scale=Scale.minor)

The keyword arguments dur, oct, and scale apply to all player objects - any others, such as vib in the above example, refer to keyword arguments in the corresponding SynthDef. The first argument, degree, does not have to be stated explicitly. Notes can be grouped together so that they are played simultaneously using round brackets, (). The sequence [(0,2,4),1,2,3] will play the the the first harmonic triad of the default scale followed by the next three notes.

'Sample Player' Objects

In FoxDot, sound files can be played through using a specific SynthDef called play. A player object that uses this SynthDef is referred to as a Sample Player object. Instead of specifying a list of numbers to generate notes, the Sample Player takes a string of characters (known as a "PlayString") as its first argument. To see a list of what samples are associated to what characters, use print(Samples). To create a basic drum beat, you can execute the following line of code:

d1 >> play("x-o-")

To have samples play simultaneously, you can create a new 'Sample Player' object for some more complex patterns.

bd >> play("x( x)  ")
hh >> play("---[--]")
sn >> play("  o ")

Alternatively, you can do this in one line using <> arrows to separate patterns you want to play together like so:

d1 >> play("<x( x)  ><---[--]><  o >")

Or you can use PZip, the zip method, or the & sign to create one pattern that does this. This can be useful if you want to perform some function on individual layers later on:

d1 >> play(P["x( x)  "].palindrome().zip("---[--]").zip(P["  o "].amen()))  

# The first item must be a P[] pattern, not a string. 

d1 >> play(P["x( x)  "].palindrome() & "---[--]" & P["  o "].amen())

Grouping characters in round brackets laces the pattern so that on each play through of the sequence of samples, the next character in the group's sample is played. The sequence (xo)--- would be played back as if it were entered x---o---. Using square brackets will force the enclosed samples to played in the same time span as a single character e.g. --[--] will play two hi-hat hits at a half beat then two at a quarter beat. You can play a random sample from a selection by using curly braces in your Play String like so:

d1 >> play("x-o{-[--]o[-o]}")

Scheduling Player methods

You can perform actions like shuffle, mirror, and rotate on Player Objects just by calling the appropriate method.

bd >> play("x o  xo ")

# Shuffle the contents of bd
bd.shuffle()

You can schedule these methods by calling the every method, which takes a list of durations (in beats), the name of the method as a string, and any other arguments. The following syntax mirrors the string of sample characters after 6 beats, then again 2 beats later and also shuffles it every 8 beats.

bd >> play("x-o-[xx]-o(-[oo])").every([6,2], 'mirror').every(8, 'shuffle')

Documentation

For more information on FoxDot, please see the docs folder (although largely unwritten). Please note that FoxDot is still in development and is changing all the time. I do my best to keep the website and README up to date but don't always have the time.

Using alternative editors

FoxDot comes pre-packaged with its own basic editor so that you don't have to tinker with config files or download any other tools but if you want to use an existing editor you can. Koltes has written a plugin for the popular Atom editor. You can install it by going to Settings -> Install -> Searching "foxdot" and pressing install on the plug in. Press Ctrl+Alt+f or go to menu -> Packages -> FoxDot -> Toggle to start FoxDot running.

Thanks

  • The SuperCollider development community and, of course, James McCartney, its original developer
  • PyOSC, Artem Baguinski et al
  • Members of the Live Coding community who have contributed to the project in one way or another including, but not limited to, Alex McLean, Sean Cotterill, and Dan Hett.
  • Big thanks to those who have used, tested, and submitted bugs, which have all helped improve FoxDot
  • Thank you to those who have found solutions for SuperCollider related issues, such as DavidS48

Samples

FoxDot's audio files have been obtained from a number of sources but I've lost record of which files are attributed to which original author. Here's a list of thanks for the unknowing creators of FoxDot's sample archive.

If you feel I've used a sample where I shouldn't have, please get it touch!

Project details


Release history Release notifications

Download files

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

Files for FoxDot, version 0.6.4
Filename, size File type Python version Upload date Hashes
Filename, size FoxDot-0.6.4-py3-none-any.whl (44.1 MB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size FoxDot-0.6.4.tar.gz (44.0 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page