Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
@samaaron
samaaron / gist:bb679bf99f3c3a939676
Created March 5, 2015 16:10
Sonic Pi v2.4 API list
rest?
use_arg_bpm_scaling
with_arg_bpm_scaling
midi_to_hz
hz_to_midi
set_control_delta!
set_sched_ahead_time!
use_debug
with_debug
use_arg_checks
@samaaron
samaaron / gist:1398198
Created November 27, 2011 21:41
Clojure mk-tmp-dir!
(defn mk-tmp-dir!
"Creates a unique temporary directory on the filesystem. Typically in /tmp on
*NIX systems. Returns a File object pointing to the new directory. Raises an
exception if the directory couldn't be created after 10000 tries."
[]
(let [base-dir (file (System/getProperty "java.io.tmpdir"))
base-name (str (System/currentTimeMillis) "-" (long (rand 1000000000)) "-")
tmp-base (mk-path base-dir base-name)
max-attempts 10000]
(loop [num-attempts 1]
## Sonic Pi triplets example
## http://sonic-pi.net
live_loop :triplets do
density 3 do
play :e4, release: 0.1
sleep 1
end
end
@samaaron
samaaron / keepalive.erl
Last active September 27, 2021 15:05
TCP kill switch
-module(keepalive).
-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, [
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
@samaaron
samaaron / dnb.rb
Last active August 23, 2020 08:10
Derivative Drum and Bass
# Super simple drum and bass
# Coded by Sam Aaron w/ Sonic Pi
# To play: download Sonic Pi from the link below, paste the code in and hit Run
# http://sonic-pi.net
use_bpm 100
live_loop :amen_break do
@samaaron
samaaron / Reich Phase - Overtone
Last active December 26, 2019 20:29
Steve Reich's Piano Phase - Sonic Pi vs Overtone
(ns overtone.examples.compositions.piano-phase
(:use overtone.live
overtone.inst.sampled-piano))
;; Steve Reich's Piano Phase
(def piece [:E4 :F#4 :B4 :C#5 :D5 :F#4 :E4 :C#5 :B4 :F#4 :D5 :C#5])
(defn player
[t speed notes]

Keybase proof

I hereby claim:

  • I am samaaron on github.
  • I am samaaron (https://keybase.io/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
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
end
end
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
# 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
end