A self-contained version of what I have in my sonic-pi-experiments repo. It uses my play-helper and drum sequencer helpers, so here I've pasted them into the buffer so anyone can run it.
Here's a recording of it on Soundcloud.
use_bpm 94 | |
live_loop :drums do | |
# 1 e & a 2 e & a 3 e & a 4 e & a | |
cymbal = bools(0,0,0,0, 0,1,0,1, 0,0,0,0, 0,1,0,0) | |
hard = bools(0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,0) | |
soft = bools(0,0,0,0, 0,0,0,1, 0,1,0,1, 0,0,0,1) | |
kick = bools(1,0,1,0, 0,0,0,0, 0,0,1,0, 0,1,0,0) | |
with_fx :reverb, room: 0.4, damp: 0.1, amp: 1.5 do | |
16.times do |
define :music do |txt, vol_scale=100| | |
octave = 5 | |
length = 4 | |
use_bpm 120 | |
txt = txt.downcase.gsub(/^mml@| |;$/, '').gsub(/#/, '+').gsub(/w/, 'r') | |
while not txt.empty? | |
r = txt.scan(/^(.)([+-]?)(\d*)(\.?)(.*)$/) | |
cmd, opt, num, dot, txt = r[0] | |
#print cmd, opt, num | |
case cmd |
{"+auto switch":{"color":"#99dd99","defaultProfileName":"direct","name":"auto switch","profileType":"SwitchProfile","revision":"155a03f540b","rules":[{"condition":{"conditionType":"HostWildcardCondition","pattern":"*internal.swiftkey.com"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"ec2-*"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"ip-10-*"},"profileName":"AWS"},{"condition":{"conditionType":"HostWildcardCondition","pattern":"10.*"},"profileName":"AWS"}]},"-confirmDeletion":true,"-downloadInterval":1440,"-enableQuickSwitch":false,"-exportLegacyRuleList":false,"-monitorWebRequests":false,"-quickSwitchProfiles":["system","auto switch"],"-refreshOnProfileChange":true,"-revertProxyChanges":true,"-showInspectMenu":true,"-startupProfileName":"","schemaVersion":2,"+AWS":{"bypassList":[{"conditionType":"BypassCondition","pattern":"<local>"}],"color":"#dd3333","fallbackProxy":{"host":"localhost","port":8157,"scheme":"socks5"},"name": |
#!/usr/bin/env inlein | |
'{:dependencies [[org.clojure/clojure "1.8.0"]] | |
:jvm-opts []} | |
;; to run, use inlein: https://github.com/hyPiRion/inlein (or paste into a repl) | |
(defn primes | |
"Generate a lazy infinite sequence of primes, using method from (improved to skip even numbers): | |
https://web.archive.org/web/20150710134640/http://diditwith.net/2009/01/20/YAPESProblemSevenPart2.aspx" |
# Guitar Strumming - by Emlyn | |
# This tries to work out the guitar (or ukulele etc.) fingering for arbitrary chords (and tuning). | |
# It seems to work reasonably well for basic chords, but is quite naive and probably makes many mistakes. | |
# Ideas, bug reports, fixes etc. gratefully received, just comment below, or tweet @emlyn77. | |
# Feel free to make use of this code as you like (with attribution if you feel like it, but you don't have to). | |
# Thanks to @Project_Hell_CK for fixing the tuning, and spotting that it gets chord(:f, :major) not quite right. | |
# Next note higher or equal to base note n, that is in the chord c | |
define :next_note do |n, c| | |
# Make sure n is a number |
A self-contained version of what I have in my sonic-pi-experiments repo. It uses my play-helper and drum sequencer helpers, so here I've pasted them into the buffer so anyone can run it.
Here's a recording of it on Soundcloud.
let tail_y = 0 | |
let tail_x = 0 | |
let head_y = 0 | |
let head_x = 0 | |
let eaten = false | |
let score = 0 | |
let dir = 0 | |
let food_y = 0 | |
let food_x = 0 | |
let alive = false |
# The Secret Garden by Pauline Hall | |
use_synth :saw | |
use_bpm 100 | |
use_midi_defaults channel: 1 | |
# play note/chord | |
define :pl do |ns, t, p=0.8| | |
if not ns.respond_to?('each') | |
ns = [ns] |
# I set myself a challenge to code a piece using only white noise. | |
# White noise contains equal amounts of energy at every (audible) frequency. | |
# It sounds like this: | |
#synth :noise | |
# Not very musical. | |
# But... it contains every frequency, so every possible sound or piece of music | |
# is hidden in there somewhere... you just have to filter out the parts you don't want. |