Skip to content

Instantly share code, notes, and snippets.

View antonhornquist's full-sized avatar

Anton Hörnquist antonhornquist

  • Linköping, Sweden
View GitHub Profile
@antonhornquist
antonhornquist / dw-howto-fix-led-issues.scd
Last active October 8, 2017 21:01
dw: How to fix led issues

s.latency; // 0.2 is the default s.latency=0.05; // better if possible s.options.hardwareBufferSize; // post default s.options.hardwareBufferSize=64; // great if possible s.reboot; // reboot needed after hardwareBufferSize is changed

(
// core
var monomeWidth = 16;
var numKits = 4;
var numDrumsPerKit = 4 * 4;
var numStepsPerPattern = monomeWidth * 4;
var numPatterns = monomeWidth * 4;
var tempoSpec = ControlSpec(10, 800, step: 1, default: 120);
var swingAmountSpec = ControlSpec(0.0, 50.0, step: 0.1, default: 25.0);
@antonhornquist
antonhornquist / engine_ack.lua
Last active September 7, 2019 21:52
Lua engine metadata examples
local ControlSpec = require 'controlspec'
local Formatters = require 'formatters'
local lib = {}
local specs = {}
specs.send = ControlSpec.DB:copy()
specs.send.default = -60
specs.sample_start = ControlSpec.UNIPOLAR

See examples in the following order (gist files are ordered alphabetically rather than by relevance/how i entered them):

  • testsine - simplest possible engine
  • passersby and glut - real engines with both commands and polls, the latter with polls defined in code
  • r - my modular engine
  • ack - ack, including the support library inline (see below)
  • testsine_pd - possible way to expose a testsine pd engine
  • [co](https://gist.github.
(
var nvoices = 7;
var pg;
var effect;
var buffers;
var voices;
var mixBus;
var phases;
var levels;

( var debug = false;

var numChannels = 8;

var buffers; var channelGroups; var channelControlBusses; var samplePlayerSynths; // TODO: not sure this is needed anymore since synths now are self-freeing and communication is made via channelGroups var muteGroups;

(
var root = "C:/my_stuff/newthing/engines"; // ~/dust/code
var enginesToLoad = PathName(root).deepFiles.select { |path|
path.fileName.asString.beginsWith("Engine_") and: (path.extension == "scd")
};
"% norns engines to load.".format(enginesToLoad.size).inform;
enginesToLoad.do { |path|

( // an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

/* TODO: assoc / assv / assq TODO TODO: (sc only) suspicion that slow ss_* functions has performance penalty - check by testing parsed statements in define_non_prim_standard_procedures TODO: (sc only) for clarity, use .value() over .() */

/*

// 1. Overview of Scheme

(* 5 8) // ==> 40

// 2.1 Identifiers

// Extended alphabetic characters may be used within identifiers as if they were letters. The following are extended alphabetic characters:

    • . * / < = > ! ? : $ % _ & ~ ^
-- an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.
--[[
]]
--[[
inspiration:
https://norvig.com/lispy.html
scheme r4rs @ https://people.csail.mit.edu/jaffer/r4rs_toc.html