Armagan Amcalar
JSConf Iceland
March 2nd, 2018
dashersw
2013 Pedalboard by Royd Andalis licensed under CC BY 2.0
dashersw
pure CSS magic.
dashersw
Armagan Amcalar
Head of Software Engineering @ unu GmbH
Founder @ Lonca Works
dashersw dashersw
A standard browser API that enables advanced audio applications within the browsers
3D sound processing in games
Sound production applications
Voice training
Art installations
and anything you can imagine about audio
dashersw
dashersw
source
channel splitter
delay
biquad
filter
gain
gain
channel merger
target
a network of nodes
dashersw
AudioContext
OfflineAudioContext
GainNode
DelayNode
AudioBufferSourceNode
MediaElementAudioSourceNode
PannerNode
ConvolverNode
AnalyserNode
ChannelSplitterNode
ChannelMergerNode
BiquadFilterNode
DynamicsCompressorNode
WaveShaperNode
OscillatorNode
AudioWorkerNode
const context = new AudioContext();
const gain = context.createGain();
gain.connect(context.destination);
const request = new XMLHttpRequest();
request.open('GET', 'some_sound.mp3', true);
request.responseType = 'arraybuffer';
request.onload = function() {
context.decodeAudioData(request.response, function(buffer) {
var source = context.createBufferSource();
source.buffer = buffer;
source.connect(gain);
}, onError);
}
request.send();
Small example
github.com/dashersw/pedalboard.js
The first open-source WebAudio framework for guitar effects
GPL Licensed
Well-documented
Abstractions based on the guitar world:
pedals, pots, switches, LEDs
Built on top of Google Closure Library
Compiles with Google Closure Compiler in Advanced Mode
Uses MVVM architecture
dashersw
Stage
Board
Box
Footswitch
Led
Pot
FileInput
StreamInput
dashersw
Reverb
Delay
Overdrive
Conv (convolver)
Cabinet
Volume
The bed for everything, where we live, where we breathe
The container for a bunch of guitar pedals
Parent class of all pedals, has one toggle footswitch, a status LED and a potentiometer for volume
dashersw
An abstract class that is a source of sound. FileInput and StreamInput extend Input
Lets you use any recorded audio as a source file in various formats as supported by the browser (MP3, WAV, OGG etc.)
Lets you use any recording equipment (mics, guitars, mixers) as a source so you can replicate GarageBand
dashersw
Parent class for all potentiometers
A B type linear potentiometer for adjusting pedal parameters (manages AudioParam)
An A type logarithmic potentiometer for controls like volume and overdrive, which are typically logarithmic.
dashersw
Toggles the pedals or on off with a true bypass mechanism — works like a 3PDT switch.
Works alone or coupled with a Footswitch, shows the status of the pedal or anything you like (i.e., tempo)
dashersw
The API we've been waiting for!
MIDI: Musical Instrument Digital Interface
Connect DJ and musician gear to your computer and control the environment!
Video applications
Photo editing tools
Games and interactive applications
const input, out;
navigator.requestMIDIAccess().then(onMIDIInit);
function onMIDIInit(midi) {
const inputs = midi.inputs.values();
const outputs = midi.outputs.values();
for (let input = inputs.next(); input && !input.done; input = inputs.next()) {
input.value.onmidimessage = MIDIMessageEventHandler;
haveAtLeastOneDevice = true;
}
for (let output = outputs.next(); output && !output.done; output = outputs.next()) {
out = output;
}
}
function MIDIMessageEventHandler(event) {
console.log(event.data) // [176, 12, 127]
}
Armagan Amcalar
dashersw
slides: https://slides.com/armaganamcalar/jsconfis
demo: pedals.io