Music Community Lab (MCL) put together a write-up of the events of Live Code Lab 2019, back in February. This is just a brief synopsis of my experience.

MCL Board Member Activities

As a board member, I was lucky enough to assist with event setup, errand running, check in, and photography. I also go the chance to chat with volunteers, participants, and Dr. Adam Patrick Bell’s visiting research group.

Workshops Attended

As a MCL board member, I often do not get to participate in workshops at our events. This time, my fellow board members ensured that I got to participate. Thank you! Attending these workshops allowed me to broaden my Csound and Python knowledge.

Both workshops started out similarly. We learned how to make a basic beat, added more and more on top of it that beat, and were given pointers. The workshop leaders described the different capabilities of each system. They hinted about how to learn more about both.

Why these two workshops? My private dabblings in computer music often use Csound and Python.

Csound: Hexadecimal Beats

Steven Yi, currently a visiting assisting professor at RIT, presented Hexidecimal Beats. Hexidecimal Beats is his system for using hexadecimal notation to live code in Csound. Basically, this system allows you to set what four 16th notes are doing with one keystroke. Coupled with the fact that Csound itself allows for highly customizable instruments, this allows for a very customizable and fast live coding experience.

This system lends itself to 4 based meters easily. Triplets, 32nd notes, and other rhythms can be introduced using lag.

To try this out, go to Steven created a cheat sheet describing useful functions for the Hexadecimal beat system. He also has a few tutorials and references describing how to use Csound live. If you want to try it yourself, I recommend starting with Tutorial 1. While not specific to the hexadecimal technique, the tutorial gives you a lot of background on Whitout this, the hexidecimal beat technique is confusing.

I am excited about getting better at using Csound live with hexadecimal beats . I need to do some more digging in the documents to learn how to do everything. You can also learn by watching some of Steven’s live code sessions for tricks, which are linked to on his blog.

I have not yet gotten the hang of doing much that sounds interesting in Csound Live. However, I have high hopes of doing so in the future. Here is a demo to copy and paste into, which shows you what I can do so far!

Csound Live Code / Hexidecimal Beats Demo

Paste the example code into, paste it over all the code in the browser, highlight everything, and hit cntrl-e to run. This is what I can currently do with CsoundLive!

;; Select this code and press ctrl-e to evaluate
;; reset_clock()

;; callback instrument for csound-live-code
instr P1
  ;--- drums
  ; snare
  hexplay(	"1002",
      		"SD", p3,
      		in_scale(-1, 0),
      		fade_in(7, 128) * ampdbfs(-12))
  ; bass drum
  hexplay(	"1111",
      		"BD", p3,
      		in_scale(-1, 0),
      		fade_in(8, 128) * ampdbfs(-6))
  ; open high hat
      "0HH", p3,
      in_scale(-1, 0),
      fade_in(9, 128) * ampdbfs(-5))

    ;--- bass linked
    ; pickup note
      		"Sub5", p3,
      		in_scale(-1, 1.5),
      		fade_in(11, 128) * ampdbfs(-12))
    ; first note
      		"Sub5", p3,
      		in_scale(-1, 0),
      		fade_in(11, 128) * ampdbfs(-12))
    ; second note
    hexplay(	"00200000",
      		"Sub5", p3,
      		in_scale(-1, 1.5),
      		fade_in(11, 128) * ampdbfs(-12))
    ; third note
    hexplay(	"00020000",
      		"Sub5", p3,
      		in_scale(-1, 2),
      		fade_in(11, 128) * ampdbfs(-12))
    ; fourth note
      		"Sub5", p3,
      		in_scale(-1, 3.5),
      		fade_in(11, 128) * ampdbfs(-12))


I was inspired by Basin Street Blues, and was trying create something similar in Csound Live Code. There is quite a ways to go before this sounds bluesy, or anything like the original. Without introducing some sort of lag, I don’t think it is possible. If you think otherwise, please, enlighten me! I would love to make this a bit better.

Python / Supercollider: FoxDot

David Stein, or ColonelPanix in live coding circles, introduced us to live coding using an environment called FoxDot. In FoxDot, we used the Python programming language to control the Supercollider music programming language, and ended up with sounds as output.

ColonelPanix has live coding tutorial and cheat sheet on his website. Read them!

FoxDot with Python draws a lot of inspiration from Python. Data structures are the same. I have not experimented with if I can use other libraries in conjunction with FoxDot, but it seems likely that I can. While the tutorial was run in an outside environment, I can run FoxDot using my Atom editor from inside of a .py file.

Follow the directions at FoxDot’s installation page to start up FoxDot. One method of going through the process includes opening SuperCollider, typing FoxDot.start, and highlighting the line and hitting cntrl-Enter to start up SuperCollider. Then, to start FoxDot, go to the command line, and type Python -m FoxDot. The FoxDot documents have other methods of startup, as well as many tutorials.

FoxDot Demo

To see what I can currently do, copy and paste the code below into a FoxDot programming environment, highlight the lines you want to hear, and hit cntrl-Enter. Once again, I tried to recreate Basin Street Blues. This one sounds a little closer to the original. To stop instruments, uncomment one of the lines s1.stop(), db.stop(), etc., and run them by hitting cntrl-Enter. If you uncomment the comments behind the pitches or durations, you can soup up the performance with other variations on the theme.

Clock.bpm = 60

# -- Pitches for each phrase
# 1
pphrase1 = P[0, 2, 3, 3.5, 4]#.shuffle().shufflets(3)
# 2
pphrase2 = P[7, 5.5, 5, 4,  5]#.invert()
# 3
pphrase3 = P[7, 5.5, 7, 7, 7, 7, 8]
# Ending
pphrase4 = P[7, 5.5, 5, 4, 5, 0, 1, 1.5, 1, 0]

# -- Durations for each phrase
# 1
rphrase1 = P[1, 2/3, 1/3, 1/2, 3/2 ]#.shuffle()
# 2
rphrase2 = P[1, 2/3, 1/3, 1/2, 3/2]#.shuffle()
# 3
rphrase3 = P[1/3, 2/3, 3/2, 2/3, 1, 2/3, 3/2 + 2/3 +1 ]#.shuffle()
# Ending
rphrase4 = P[1, 2/3, 1/3, 2/3, 1/3, 2/3, 1/3, 1, 2/3, 1/3 + 2]

# -- Melody
# By intervals, 0 is C, 2 is E, so on ..
# plucked guitar
s1 >> pluck(    # Pitches
                pphrase1  | pphrase2  | pphrase3 | pphrase4,
                # Durations
                dur = [rphrase1 | rphrase2 | rphrase3 | rphrase4],
                amp = 0.75, # Amplitude
                lpf = 700,  # low and high pass filters: cuts a frequency range
                hpf = 300 ,  #     out for pluck to be heard & not compete


# plucked double bass
db >> dbass(    # Pitches
                pphrase1  | pphrase2  | pphrase3  | pphrase4,
                # Durations
                dur = rphrase1 | rphrase2 | rphrase3 | rphrase4,
                amp = 0.75 , # Amplitude
                lpf= 300    #double bass is now alone in freq. range

# brass section
sw >> swell(    # Pitches
                pphrase1  | pphrase2  | pphrase3  | pphrase4,
                # Durations
                dur = rphrase1 | rphrase2 | rphrase3 | rphrase4,
                amp = 0.75 #, # Amplitude

# no rests! not sure how to add them, so just extended notes too long.

# -- Add Drums!
# Made from drum samples

dr >> play("xxxxxxxx        xxxxxxxx",
            bpm = 30)

# -- Halt all insruments
# s1.stop()
# db.stop()
# sw.stop()
# dr.stop()

# -- Thoughts on instrument choices that sound decent
# - To see all, use command
# -     print(SynthDef)
# --------------------------------
# scatter - soso, not accurate
# charm
# bell
# gong
# viola
# klank - for new agey reverb/ reflections/echoes
# feel - like klank, less reverb
# glass - new agey, can't even hear melody, just have fragments'
# soft - varies loudness and messes up accuracy of rhythms and notes, like scatter
# quin - sounds like harmonica or reed organ or bad accordian, or melodica
# spark - new agey but accurate, almost like a pluck followed by brass section
# blip - accurate, almost like xylophone
# ripple - like accordian
# creep - gets louder as note goes on... otherwise really annoying
# orient - modeled off of middle eastern harp / kanun
# zap - cut off, almost like hold strings and pluck at same time. dampened sound.
# marimba
# bug - interesting effect, hold over notes, lots of really sharp vibrato
# pluse - almost sounds like sine wave, close to a really loud and annoying clarinet.
# saw - saw wave (sounds almost like bad alto )
# snick - xylophones in back, bad drums in front
# twang - so out of tune it hurts
# karp - almost like a harp, plucked guitar
# arpy - buzzy and quickly diminishing string
# nylon - not terrible, but sounds synthetic. like a bad keyboard sound, with lots of buzz
# donk - if want to do with percussion like tabla, or really low flute
# swell - sort of like a brass section sounds like, really heavy on the brassy-ness
# razz - sounds a little like a woodwind section, if you could squint with your ears
# sitar - harshly plucked string, but not very much of the cool reverb of sitar
# jbass - almost like some low woodwinds (bass clarinet?, bari sax)
# sawbass - growly sounding bass, with too much exposure on amp, sometimes used in blues
# prophet - new agey
# pads - synth. piano sound
# ambi - organ
# space - high pitched orcarina like sound often used in space music, almost like whistle
# keys - piano
# sinepad - xylaphone like

What if I wanted to replace an instrument? After all, there is a list of instruments (SynthDefs) in comments at the bottom of my code. Say we wish to switch dbass out for orient. First, stop dbass with db.stop(). Then, replace dbass with orient after db >>. Then, restart db >> .

CsoundLive vs. FoxDot

With CsoundLive, it’s easier to control sixteenth note based rhythms, drum tempos, and the construction of different instruments. With higher customizability comes a steeper learning curve. But once that curve is surpassed, it should be possible to change code more speedily using Csound Live.

With FoxDot, it’s easier to code, and jump into coding. There is less confusion about how to code. Python is also a slightly more popular programming language, and it is likely because of this that Foxdot has more inbuilt functions that you can use to modify the expression of the code.

With both, it’s easy to change the flavor of the piece by highlighting and selecting different instruments.

Live Code Lab as Inspiration

One day, I would like to see if I can use a live coding language to recreate and reimagine traditional blues pieces. Live coders write code that sounds like a dj’s music in real time. Dancers could dance to it. As a blues dancer, I think that a dj being able to change the music as I dance would be neat.

Try this in NYC

If you want to know more about live coding and are near NY, the LiveCodeNYC community is very friendly. It can’t hurt to join them and code while learning.