Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
//https://cdn.jsdelivr.net/npm/[email protected]/dist/hydra-synth.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Hydra = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted,
@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, [

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
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|
block.call("hello")
end
foo do |m|
puts "#{m} Sam"
end
# 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
# 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
end
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