Skip to content

Instantly share code, notes, and snippets.

function update_pattern(instrument_i, track_i, pos)
local song_pos = rs().transport.playback_pos
local pattern_i = rs().sequencer:pattern(song_pos.sequence)
local track = rs():pattern(pattern_i):track(track_i)
track:clear()
local next_line = track:line(song_pos.line + 1)
next_line:note_column(1).note_value = 48
next_line:note_column(1).instrument_value = instrument_i
@triss
triss / note_sigil.ex
Created August 29, 2014 11:21
won't test
defmodule WesternNotation.NoteSigil do
@moduledoc ~S"""
Module that allows notes from western music notation succinctly
"""
notes = %{
c: 0, d: 2, e: 4, f: 5, g: 7, a: 9, b: 11
}
def sigil_n(string, []) do
@triss
triss / gist:ee21084cd07f1c47cca6
Created August 26, 2014 17:31
Euclidean pattern generator
defmodule Euclidean do
import List, only: [duplicate: 2]
import Enum, only: [take: 2, drop: 2]
import Stream, only: [cycle: 1]
def rotate(pattern, amount) do
drop(pattern, amount) ++ take(pattern, amount)
end
def pattern(hitLength, length \\ 16, rotation \\ 0)
@triss
triss / gist:e889de731f46fcee25d6
Created August 24, 2014 20:29
soundfileview kaboom
ERROR: Primitive '_QObject_InvokeMethod' failed.
Failed.
RECEIVER:
Instance of QSoundFileView { (0x28b4f38, gc=B4, fmt=00, flg=00, set=06)
instance variables [38]
qObject : RawPointer 0x26d3e00
finalizer : instance of Finalizer (0xfaa3218, size=2, set=1)
virtualSlots : nil
wasRemoved : false
font : nil
@triss
triss / gist:d5080adbfd8e4322e99f
Created August 24, 2014 10:57
SC plugins build issue on Ubuntu 14.04
[ 97%] Building CXX object source/CMakeFiles/TagSystemUgens.dir/TagSystemUGens/TagSystemUgens.cpp.o
/home/tris/sources/sc3-plugins-src-2012-05-26/source/TagSystemUGens/TagSystemUgens.cpp:78:0: warning: "GET_BUF" redefined [enabled by default]
#define GET_BUF \
^
In file included from /usr/include/SuperCollider/plugin_interface/SC_PlugIn.h:26:0,
from /home/tris/sources/sc3-plugins-src-2012-05-26/source/TagSystemUGens/TagSystemUgens.cpp:26:
/usr/include/SuperCollider/plugin_interface/SC_Unit.h:251:0: note: this is the location of the previous definition
#define GET_BUF \
^
/home/tris/sources/sc3-plugins-src-2012-05-26/source/TagSystemUGens/TagSystemUgens.cpp: In function ‘void DbufTag_end(DbufTag*, int, int)’:
euclideanBeat :: Int -> Int -> [Int]
euclideanBeat hitSpacing length = take length (cycle ([1] ++ replicate (hitSpacing - 1) 0))
@triss
triss / core.clj
Created May 25, 2014 19:16
euclidean beat sin clojure
(ns clojtest.core)
(defn rotate-left
([coll] (rotate-left 1 coll))
([n coll] (concat (drop n coll) (take n coll))))
(defn euclidean-beat
([hit-length length rotation]
(rotate-left rotation
(euclidean-beat hit-length length)))
import processing.pdf.*;
import triss.colourlovers.*;
ArrayList<PVector> points;
ArrayList<Line> lines;
color[] colours;
int c = 0;
int quant = 3;
@triss
triss / gist:8883949
Last active August 29, 2015 13:56
fractal 0.1
// https://github.com/triss/colourlovers
import triss.colourlovers.*;
color[] colours;
int c;
void setup() {
size(1000, 1000);
noLoop();
@triss
triss / Grabbing sounds and mangling them
Created October 23, 2013 16:15
Grabbing sounds and mangling them
s.boot;
// ----------------------------------
// grabbing sound and playing it back
// ----------------------------------
// in supercollider we usually store sound in buffers...
// we'll need to allocate an empty one... this one's 10 seconds long
~buffer = Buffer.alloc(s, 10 * s.sampleRate);