Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
@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]
# key: ppc
# point_line: 0
# point_index: 0
# --
#██████╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
#██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
#██████╔╝██║ ██║██║ ╚████╔╝ ██║ ██║ ██║██████╔╝█████╗
#██╔═══╝ ██║ ██║██║ ╚██╔╝ ██║ ██║ ██║██╔══██╗██╔══╝
#██║ ╚██████╔╝███████╗██║ ╚██████╗╚██████╔╝██║ ██║███████╗
#Thanks to Daniel Wagner for the original Overtone translation of the main melody from
# Daft Punk's Giorgio By Moroder
repetition_sub_a = [:C5, :A3, :B4, :A3, :C5, :E5, :A3, :A4, :C5, :A3, :B4, :A3, :C5, :A4]
repetition_a = [:a4, :a3] + repetition_sub_a + [:a3, :a4] + repetition_sub_a
repetition_b = [:F4, :F4, :A4, :F4, :G4, :F4, :A4, :C5, :F4, :F4, :A4, :F4, :G4, :F4, :A4, :F4]
#slight variation of the above with different distances between the 2nd and 3rd note
repetition_b3 = [:E4, :E4, :G4, :E4, :Fs3, :E4, :G4, :B4, :E4, :E4, :G4, :E4, :Fs3, :E4, :G4, :E4]
@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
define :mockingjay do
use_synth_defaults release: 0.7
play 91
sleep 0.6
play 94
sleep 0.6
play 93
sleep 0.6
play 86
end
@samaaron
samaaron / gist:6509442
Last active December 22, 2015 17:59
Simple Promise implementation in Ruby
require 'thread'
module SonicPi
class Promise
def initialize
@val_sem = Mutex.new
@push_sem = Mutex.new
@box = Queue.new
@value = nil
// Doodle based on Sound Visualizer https://www.shadertoy.com/view/Xds3Rr
// and http://vimeo.com/51993089 @ the 0min 44s mark
// For Shadertone, tap into Overtone's volume...
uniform float iOvertoneVolume;
void main(void)
{
vec2 uv = 2*(gl_FragCoord.xy/iResolution.xy) - 1.0;
// equvalent to the video's spec.y, I think
float spec_y = 0.01 + 1.0*iOvertoneVolume;
float col = 0;
{:live-repl {:repl-options {:port 4555}}
:user {:plugins [[lein-clojars "0.9.1"]]
:aliases {"live" ["with-profile" "default,live-repl" "repl"]}}}
(ns suse.mixer
(:use [overtone.live]
[overtone.inst.sampled-piano]
[overtone.inst.synth :only [simple-flute]]))
(defcgen wobble
"wobble an input src"
[src {:doc "input source"}
wobble-factor {:doc "num wobbles per second"}]
(:ar