Skip to content

Instantly share code, notes, and snippets.

@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 / 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
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
--[[============================================================================
main.lua
============================================================================]]--
--------------------------------------------------------------------------------
-- tool registration
--------------------------------------------------------------------------------
--renoise.tool():add_menu_entry {
-- name = "Instrument Box:Random Renoise Kit...",
@triss
triss / synth.scd
Last active August 29, 2015 14:08
Louis
// run this code first to set up synthDef
(
SynthDef(\mainSynth, {
arg attack=0.5,decay=0.5,sustain=0.5,release=0.5,gate=1,modulation_rate=1,depth=50,rate=100;
var envelope,modulator,frequencyModCarrier,amplitudeModCarrier,ringModCarrier,signal;
envelope = EnvGen.ar(Env.adsr(attack, decay, sustain, release), gate);
modulator=BufRd.ar(1,modulatorBuffer,Phasor.ar(0,BufRateScale.kr(modulatorBuffer)*modulation_rate*buffTime,0,BufFrames.kr(modulatorBuffer)),1)*depth;
ringModCarrier = BufRd.ar(1, carrierBuffer, Phasor.ar(0, BufRateScale.kr(carrierBuffer) *
@triss
triss / simplestepper
Created November 5, 2014 14:26
Very simple step sequencer
s.boot;
// set up the Synth
(
SynthDef(\mainSynth, {
arg attack=0.5,decay=0.5,sustain=0.5,release=0.5,gate=1,modulation_rate=1,depth=50,rate=100;
var envelope,modulator,frequencyModCarrier,amplitudeModCarrier,ringModCarrier,signal,
// -------- I've had to add a modulatorType argument to the synth - the way things were it'd be impossible to change
modulatorType ;
@triss
triss / filterkernals
Created November 5, 2014 17:12
damon
(
var bandwidth = 0.1;
var lowKernel;
var highKernel;
var bandKernel;
var maxValue = 0;
var ratio;
var normalize = 1;
~synths = Array.fill(13, { Synth(\mainSynth) });
~sequence = Array.fill(13, { Array.fill(16, 0) })
// step through sequence
Tdef(\sequencePlayer, {
loop {
16.do {
arg i;
// here's the iterator for the different sequences
CPU0 CPU1
0: 1152406 1085120 IO-APIC-edge timer
1: 7 5 IO-APIC-edge i8042
8: 0 1 IO-APIC-edge rtc0
9: 1241 1265 IO-APIC-fasteoi acpi
12: 59 67 IO-APIC-edge i8042
16: 31068 27982 IO-APIC-fasteoi uhci_hcd:usb6, yenta
17: 5 5 IO-APIC-fasteoi uhci_hcd:usb7, firewire_ohci
18: 0 0 IO-APIC-fasteoi uhci_hcd:usb8, mmc0, r592, r852
19: 13562 14497 IO-APIC-fasteoi ehci_hcd:usb2
@triss
triss / gist:53f80df061b111a256c5
Created December 16, 2014 14:15
can't find namespace
ljs.user=> Figwheel: Starting server at http://localhost:3449
Figwheel: Serving files from '(dev-resources|resources)/public'
Compiling "resources/public/js/app.js" from ("src/cljs" "env/dev/cljs")...
WARNING: No such namespace: hm.core at line 1 src/cljs/little_drummer_boy/core.cljs
WARNING: Use of undeclared Var cljs.core.async/do-alts at line 62 file:/home/tris/.m2/repository/org/clojure/core.async/0.1.278.0-76b25b-alpha/core.async-0.1.278.0-76b25b-alpha.jar!/cljs/core/async/impl/ioc_helpers.cljs
WARNING: Bad method signature in protocol implementation, impl/Handler does not declare method called lock-id at line 214 file:/home/tris/.m2/repository/org/clojure/core.async/0.1.278.0-76b25b-alpha/core.async-0.1.278.0-76b25b-alpha.jar!/cljs/core/async.cljs
WARNING: Use of undeclared Var cljs.core.async.impl.protocols/lock-id at line 217 file:/home/tris/.m2/repository/org/clojure/core.async/0.1.278.0-76b25b-alpha/core.async-0.1.278.0-76b25b-alpha.jar!/cljs/core/async.cljs
WARNING: Bad method signature in protocol