This file contains 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
<script> | |
var sendMIDIMessage = (function () { | |
var counter = 0; | |
return function (arr) { | |
counter++; | |
if (counter % 1000000 === 0) { | |
console.log(counter + " messages"); | |
} | |
}; | |
}()); |
This file contains 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
// This code is hereby placed in the PUBLIC DOMAIN. | |
package main | |
import "fmt" | |
import "net/http" | |
import "os" | |
// A very simple go local file server. | |
// 1. Serves on port 8000 | |
// 2. Serves files relative to the directory in which you run the server. |
This file contains 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
// This server doesn't suffer from the problem | |
// mentioned in http://arclanguage.org/item?id=1263 | |
// | |
// Run by placing this file alongside IO.WebServer.js | |
// and IO.js and invoking node as - | |
// node arc.js | |
// | |
// Then visit http://localhost:9000/said in your browser. | |
var IO = require('./IO.WebServer.js'); |
This file contains 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
// Assumes a valid matrix and returns its dimension array. | |
// Won't work for irregular matrices, but is cheap. | |
function dim(mat) { | |
if (mat instanceof Array) { | |
return [mat.length].concat(dim(mat[0])); | |
} else { | |
return []; | |
} | |
} |
This file contains 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
<script> | |
var ac = new webkitAudioContext; | |
var j = ac.createScriptProcessor(1024, 1, 1); | |
var startTime, startTimeGrabbed = false, samples = 0, sampleCountTime = 0, frames = 0; | |
j.onaudioprocess = function (event) { | |
if (!startTimeGrabbed) { | |
startTime = ac.currentTime; | |
samples = 0; |
This file contains 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
<!DOCTYPE HTML> | |
<body> | |
<script> | |
var N = 1; | |
try { | |
var ctx = new AudioContext(); | |
} catch (e) { | |
ctx = new webkitAudioContext(); | |
} |
This file contains 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
// Gets the AudioContext class when in a browser environment. | |
function getAudioContext() { | |
try { | |
var AC = (window.AudioContext || window.webkitAudioContext || window.mozAudioContext); | |
function myAC() { | |
var ac = new AC(); | |
// Future compatible names. | |
ac.createGain = ac.createGainNode = (ac.createGain || ac.createGainNode); |
This file contains 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 audioContext = new AudioContext(); | |
var kFreq = 660, kDecayTime = 0.5, kStartTime = 1.5, kGain = 0.25; | |
var oscNode = audioContext.createOscillator(); | |
oscNode.frequency.value = kFreq; | |
var gainNode = audioContext.createGain(); | |
gainNode.gain.value = kGain; | |
gainNode.gain.setTargetAtTime(0.0, audioContext.currentTime, kDecayTime); | |
oscNode.connect(gainNode); | |
gainNode.connect(audioContext.destination); | |
oscNode.start(audioContext.currentTime + kStartTime); // Start a little into the future. |
This file contains 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
/* Copyright (c) 2013, Srikumar K. S. ([email protected]) | |
* All rights reserved. | |
* | |
* Licensed under the MIT License - | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains 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
<div id="render"></div> | |
<!-- Take these from https://github.com/srikumarks/IO.js --> | |
<script src="IO.js"></script> | |
<script src="IO.Browser.js"></script> | |
<script> | |
// The rendering process that writes out the array passed to | |
// it into the div element with id = 'render'. | |
var render = IO.do([ | |
function (arr) { | |
if (arr.length > 10) { |