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
| //////////////////////////////////////////////////////////////////////////////// | |
| /* old | |
| * T("sin", {freq:880, mul:0.5}).play(); | |
| */ | |
| let sin = timbre((T) => { | |
| return T("SinOsc.ar", { frequency: 880, mul: 0.5 }); | |
| }).start(); | |
| //////////////////////////////////////////////////////////////////////////////// | |
| /* old |
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
| class AudioBuffer { | |
| @TestAPI.props.readonly() | |
| duration() { | |
| return this.length / this.sampleRate; | |
| } | |
| @TestAPI.methods.param("destination", Float32Array) | |
| @TestAPI.methods.param("channelNumber", "positive number") | |
| @TestAPI.methods.param("[ startInChannel ]", "positive number") | |
| @TestAPI.methods.contract({ |
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
| export function splitTokens(str) { | |
| return str.match(/(".*?"|[^"\s]+)/g);); | |
| } |
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 def() { | |
| let lfo = new neume.LFSine(neume.KR); | |
| let sine = new neume.SineOscillator(neume.AR); | |
| let line = new neume.LineGenerator(neume.KR, 0, 1, 0.5); | |
| lfo.frequency.value = 1; | |
| lfo.range(780, 880).connect(sine.frequency); | |
| sine.connect(line); | |
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 convertIRtoAR(self, numOfSamples) { | |
| let value = self.value; | |
| let result = new Float32Array(numOfSamples); | |
| for (let i = 0, imax = result.length; i < imax; i++) { | |
| result[i] = value; | |
| } | |
| return result; | |
| } |
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 STORAGE = {}; | |
| function createFunctionPromise(func, args) { | |
| return new Promise(function(resolve, reject) { | |
| var data = func.apply(null, args); | |
| if (data instanceof Promise) { | |
| return data.then(resolve, reject); | |
| } |
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
| for (var t = 0; t < 1; t += Math.random() * 0.2) | |
| param.setValueAtTime(Math.random(), t); | |
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 fs = require("fs"); | |
| fs.writeFile("foo.txt", "FOOOOO!!!!!!!!"); |
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 createRandomAutoPanSegment() { | |
| let result = []; | |
| let length = Math.floor(Math.random() * 5 + 5); | |
| let pos = 0; | |
| for (let i = 0; i < length; i++) { | |
| if (Math.random() * 0.8 < i / length) { | |
| pos = 1; | |
| } | |
| if (pos === 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
| import ADSREnvelope from "@mohayonao/adsr-envelope"; | |
| let audioContext = new AudioContext(); | |
| let adsr = new ADSREnvelope({ | |
| attackTime: 0.5, | |
| decayTime: 0.25, | |
| sustainLevel: 0.8, | |
| releaseTime: 2.5, | |
| releaseCurve: "exp", | |
| }); |