This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function example01(audioContext, pulse) { | |
var destination = audioContext.destination; | |
var t0 = audioContext.currentTime; | |
pulse(destination, t0, { frequency: 440, volume: 0.3, duty: 0.8 }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.speaker { | |
width: 32px; | |
height: 32px; | |
stroke-width: 3px; | |
stroke-linecap: round; | |
stroke-linejoin: round; | |
border-radius: 4px; | |
background: #ecf0f1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from "react"; | |
import Volatile from "./Volatile"; | |
@Volatile({ timeout: 2500 }) | |
class UI extends Component { | |
static propTypes = { | |
data: PropTypes.number.isRequired, | |
}; | |
shouldComponentUpdate(nextProps) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importScript(src) { | |
return new Promise((resolve, reject) => { | |
const script = document.createElement("script"); | |
script.async = 1; | |
script.type = "text/javascript"; | |
script.src = src; | |
script.onerror = reject; | |
script.onload = () => { | |
document.body.removeChild(script); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const LOWPASS = "lowpass"; | |
const HIGHPASS = "highpass"; | |
const BANDPASS = "bandpass"; | |
const LOWSHELF = "lowshelf"; | |
const HIGHSHELF = "highshelf"; | |
const PEAKING = "peaking"; | |
const NOTCH = "notch"; | |
const ALLPASS = "allpass"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// velocity-for-color | |
// https://github.com/brunchboy/afterglow/blob/master/src/afterglow/controllers/ableton_push.clj#L24 | |
module.exports = (h, s, v) => { | |
if (v < 3) { | |
return 0; | |
} | |
const brightnessShift = (60 < v) ? 0 : (37 < v) ? 1 : (15 < v) ? 2 : 3; | |
if (s < 20) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectAudioChannel(type) { | |
var splitter = audioCtx.createChannelSplitter(2); | |
audioSource.disconnect(); // ? | |
switch (type) { | |
case 'L': | |
audioSource.connect(splitter); | |
splitter.connect(audioCtx.destination, 0); | |
break; | |
case 'R': | |
audioSource.connect(splitter); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const synthdef = require("synthdef"); | |
const def1 = synthdef(($) => { | |
let s; | |
s = $("SinOsc").ar(220, 0, 0.5); | |
s = $("Out").ar(0, s); | |
return s; | |
}); | |
const def2 = synthdef(($) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = new Uint32Array([ | |
0x46464952, 0x0000002c, 0x45564157, 0x20746d66, | |
0x00000010, 0x00020001, 0x0000ac44, 0x0002b110, | |
0x00100004, 0x61746164, 0x00000008, 0x8000c000, 0x3fff7fff | |
]).buffer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let audioContext = new AudioContext(); | |
let sched = new WebAudioScheduler({ | |
context: audioContext | |
}); | |
function metronome(e) { | |
sched.insert(e.playbackTime + 0.000, ticktack, { frequency: 880, duration: 1.00 }); | |
sched.insert(e.playbackTime + 0.500, ticktack, { frequency: 440, duration: 0.05 }); | |
sched.insert(e.playbackTime + 1.000, ticktack, { frequency: 440, duration: 0.05 }); | |
sched.insert(e.playbackTime + 1.500, ticktack, { frequency: 440, duration: 0.05 }); |