Skip to content

Instantly share code, notes, and snippets.

-- 水戸黄門の曲のイントロはクロスリズムになってるよ
bps 0.85
-- 4/4
d1 $ sound "[[bd*4], [~ sn:1 ~ sn:1], [hc hc hc ho:1]]"
-- 3/4
d1 $ sound "[[bd*3], [~ sn:1 [~ sn:1 ~ ~]], [hc hc ho:1]]"
-- beat off
d1 $ silence
;; db => https://github.com/Factual/clj-leveldb
;; json => https://github.com/clojure/data.json
(def json-db (atom nil))
(defn val-encoder [m]
(let [s (json/write-str m)]
(byte-array (map byte s))))
(defn val-decoder [ba]
(let [s (byte-streams/to-string ba)
@nbqx
nbqx / test.rb
Created February 18, 2014 15:12
require 'scissor/echonest'
s = Scissor(ARGV.shift)
Scissor.join(
s.bars.map do |bar|
segment = bar / 32
Scissor.join(segment.each_slice(4).to_a.map{|x| x.sort_by{rand}}.flatten)
end
) >> 'out.mp3'
@nbqx
nbqx / index.js
Created February 12, 2014 06:28
koa + leveldbでgyazoみたいやつ
var fs = require('fs'),
crypto = require('crypto');
var through = require('through'),
base64 = require('base64-stream'),
mime = require('mime'),
koa = require('koa'),
router = require('koa-router'),
parse = require('co-busboy'),
level = require('level'),
_.mixin({
pluckNest: function(obj,names){
return _.reduce(names,function(o,n){
return _.pluck(o,n)
},obj);
}
});
@nbqx
nbqx / q.jsx
Created January 15, 2014 02:39
#target InDesign-7.0
function queue(funcs,scope){
(function next(){
if(funcs.length>0){
var f = funcs.shift();
f.apply(scope,[next].concat(Array.prototype.slice.call(arguments,0)));
}
})();
};
function *(){
this.type = 'text/html';
this.body = '<h1>20131227</h1><p>Shigoto Osame</p>';
}
var Writable = require('stream').Writable,
TmpFile = require('temporary').File,
exec = require('child_process').exec,
util = require('util');
util.inherits(InDesignWritableStream, Writable);
function InDesignWritableStream(opt){
var self = this;
self.cmd = ['osascript'];
(ns make-noise.s
(:use overtone.live))
;;;;;;;;;; SYNTH
(definst noise1 [freq 440 dd 70 attack 0.01 sustain 0.4 release 0.1 vol 0.6]
(* (env-gen (lin-env attack sustain release) 1 1 0 1 FREE)
(lf-noise2 (line (* freq dd) freq sustain))
vol))