Skip to content

Instantly share code, notes, and snippets.

View xavriley's full-sized avatar

Xavier Riley xavriley

View GitHub Profile
@xavriley
xavriley / qscintilla284.rb
Last active December 21, 2015 17:28
qscintilla284.rb
require 'formula'
class Qscintilla284 < Formula
homepage 'http://www.riverbankcomputing.co.uk/software/qscintilla/intro'
url "https://downloads.sf.net/project/pyqt/QScintilla2/QScintilla-2.8.4/QScintilla-gpl-2.8.4.tar.gz"
sha1 "7e15c261a7c1842f3a75e4878a880ab667224494"
#depends_on "pyqt5"
def install
@xavriley
xavriley / README.md
Last active July 21, 2019 18:32
Implementation of the "Group Humanizing" algorithm described in http://www.nld.ds.mpg.de/~holgerh/articles/Hennig_2014_PNAS.pdf
@xavriley
xavriley / README.md
Last active January 8, 2023 12:03
Arpeggiator in Sonic Pi

Arpeggiator in Sonic Pi

This is a work in progress

@xavriley
xavriley / README.md
Created April 19, 2015 11:46
degrade effect in Sonic Pi

Degrade effect for Sonic Pi

Our old friend Tidal has a function I quite like - degrade

Tidal is a pattern based language and degrade simply drops an event from a pattern 50% of the time.

input: [1,1,1,1,1,1,1,1]

-&gt; degrade(input)
@xavriley
xavriley / just_tuning.rb
Created April 21, 2015 16:00
Example of Just Temperament in Sonic Pi
# ratios from http://algoart.com/help/artwonk4/MicroTone/microtone.htm
JUST = [1, #c
16.0/15.0, #cs
9.0/8.0, #d
6.0/5.0, #ds
5.0/4.0, #e
4.0/3.0, #f
45.0/32.0, #fs
3.0/2.0, #g
@xavriley
xavriley / README.md
Created April 30, 2015 10:04
Super fast low memory OCR on a Mac

In OCR, everything seems to be using tesseract which is a huge, complex library with lots of dependencies.

Here's an alternative toolchain that shows potential and is much quicker to use

brew install pdfimages
brew install gocr
brew install ocrad

pdfimages path_to_pdf.pdf /tmp/out
@xavriley
xavriley / README.md
Created May 12, 2015 08:21
Stroke width transform with Docker on OSX
@xavriley
xavriley / voice_leading.rb
Last active August 29, 2015 14:21
Smooth voice leading between chords in Sonic Pi
# work out taxicab metric
def octave_transform(chord)
chord.map {|x| 60 + (x%12) }.sort
end
def t_matrix(chord_a, chord_b)
z = octave_transform(chord_a).zip(octave_transform(chord_b))
z.map {|a,b| b - a }
end
@xavriley
xavriley / phasing.rb
Last active August 29, 2015 14:21
Sonic Pi phasing a la Steve Reich
# There are lots of different ways to code this
# This is just one variation that uses one live_loop
use_synth :fm
use_synth_defaults release: 0.2
live_loop :phase, auto_cue: false do
# start the second loop as if 10k notes had elapsed
# c = 10000 if c == 0
# because the pattern is groups of 3, offsets which are
@xavriley
xavriley / polyrhythms.rb
Created May 15, 2015 10:53
Sonic Pi polyrhythms
# Try changing the numbers and clicking Run
@polyrhythm = [2,3]
live_loop :foo do
density(@polyrhythm.sort.first) { play :g; sleep 1 }
end
live_loop :bar, autocue: false do
sync :foo
density(@polyrhythm.sort.last) { play :c; sleep 1 }