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 findMidiDevices(name) { | |
return navigator | |
.requestMIDIAccess() | |
.then((midiAccess) => { | |
let input, output; | |
midiAccess.inputs.forEach((currentInput) => { | |
if(currentInput.name === name) input = currentInput; | |
}); | |
midiAccess.outputs.forEach((currentOutput) => { | |
if(currentOutput.name === name) output = currentOutput; |
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
var select = document.createElement('select'); | |
var selectedPort = null; | |
var onMessage = function (event) { | |
// TODO: Use the message | |
}; | |
var selectPort = function (id) { | |
var newPort = midiAccess.inputs.get(id); |
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 getAudioData (url, time) { | |
return new Promise(function (resolve, reject) { | |
var context = new AudioContext(); | |
var track = new Audio(url); | |
var bufferLength = time * context.sampleRate; | |
var buffer = new Float32Array(bufferLength); | |
var collector = context.createScriptProcessor(0, 1); | |
var audioSource = context.createMediaElementSource(track); | |
var samplesCollected = 0; |
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 NOTE = 69; | |
const NOTE_ON = 0x90; | |
const NOTE_OFF = 0x80; | |
const SECONDS = 1000; | |
function startSequencer (destination) { | |
let active = false; | |
setInterval(() => { | |
const now = performance.now(); | |
const type = active ? NOTE_OFF : NOTE_ON; |
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
var OP1MidiInterface = function(midi) { | |
var data, cmd, channel, type, note, velocity; | |
midi.inputs.forEach(function(input) { | |
if (input.name.indexOf('OP-1') > -1) { | |
document.dispatchEvent(new Event('midi-connected')); | |
input.onmidimessage = onMIDIMessage; | |
} | |
}); | |
midi.onstatechange = onStateChange; |
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
// Source: https://jsfiddle.net/KeithMcMillenInstruments/zma6pzt9 | |
var midi, data; | |
// request MIDI access | |
if (navigator.requestMIDIAccess) { | |
navigator.requestMIDIAccess({ | |
sysex: false | |
}).then(onMIDISuccess, onMIDIFailure); | |
} else { | |
alert("No MIDI support in your browser."); |
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
// Check this image, with all the buttons etc. | |
// https://s3.amazonaws.com/ext.agencewebdiffusion.com/Daniel/APCmini-vMix.PNG | |
// these are the available colors | |
var OFF = 0; | |
var GREEN = 1; | |
var GREEN_BLINK = 2; | |
var RED = 3; | |
var RED_BLINK = 4; | |
var YELLOW = 5; |
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
#!/bin/bash | |
# reconfigure AWS CLI credentials | |
set -e | |
function requires() { | |
if ! command -v "$1" &>/dev/null; then | |
echo "Requires $1" | |
exit 1 | |
fi |
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
#!/bin/bash | |
# Declare requirements in bash scripts | |
set -e | |
function requires() { | |
if ! command -v $1 &>/dev/null; then | |
echo "Requires $1" | |
exit 1 | |
fi |
NewerOlder