Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
samaaron / keepalive.erl
Last active September 27, 2021 15:05
TCP kill switch
-export([start/1, init/1, loop/1]).
start(DaemonPortNum) ->
spawn_link(?MODULE, init, [DaemonPortNum]).
init(DaemonPortNum) ->
io:format("connecting to Daemon via TCP...~n", []),
{ok, DaemonSocket} = gen_tcp:connect({127,0,0,1}, DaemonPortNum, [

Keybase proof

I hereby claim:

  • I am samaaron on github.
  • I am samaaron ( on keybase.
  • I have a public key whose fingerprint is FAE0 DB04 1B34 4F6F 0702 93B5 85D8 A2FD 323A F9A0

To claim this, I am signing this object:

samaaron / jam.rb
Created December 26, 2016 22:13 — forked from poppingtonic/jam.rb
Sonic PI Livecoding Snippet #1
live_loop :lloop do
with_fx :reverb, room: 0.5 do
with_fx :compressor do
sample :bd_boom, amp: 10, rate: 1
with_fx :reverb, room: 0.5 do
with_fx :krush, amp: 2, cutoff: 100 do
with_fx :slicer, probability: 0, phase: 0.125, mix: 0.5 do
use_synth :dsaw
define :eggs do |co=130|
time_warp 0 do
with_fx :reverb,room: 1 do
with_fx :krush, amp: 2, mix: 0.3 do
time_warp -0.01 do
play :e0, release: 8, cutoff: co, note_slide: 0.01, cutoff_slide: 2 do
control cutoff: 130
16.times do
control note: (scale, :e0, :minor_pentatonic).choose
define :foo do |&block|"hello")
foo do |m|
puts "#{m} Sam"
# Melodic Fun w/ Sonic Pi
# Playing basic notes with either MIDI numbers or
# note names:
comment do
play 70
sleep 1
play :C4
sleep 2
# Based on conversations with Dan Friedman and Jason Hemann
# To evaluate use Sonic Pi...
define :valof do |exp, env={}|
return exp if exp.is_a? Numeric
return env[exp] if exp.is_a? Symbol
if exp.is_a?(Array) && exp[0] == :lambda
lambda do |a|
x = exp[1][0]
# Coded by Sam Aaron
bizet_bass = (ring :d, :r, :r, :a, :f5, :r, :a, :r)
#bizet_bass = (ring :d, :r, :r, :Bb, :g5, :r, :Bb, :r)
live_loop :bizet do
with_fx :reverb, room: 1, mix: 0.3 do
with_fx :slicer, phase: 0.125 do
synth :blade, note: :d4, release: 8, cutoff: 100, amp: 1.5
16.times do
# Both live loops play in total rhythmical sync.
# Notice that they are both using the same seed
# One in Ruby and the other in the synthdef ;-)
# Note: needs Sonic Pi v2.7 to work correctly
live_loop :foo do
use_random_seed 10
64.times do
## Sonic Pi triplets example
live_loop :triplets do
density 3 do
play :e4, release: 0.1
sleep 1