音の設計書
(sdef: json)
(builder: function)
(name: string, builder: function)
(builder: function, ctls: string[])
(name: string, builder: function, ctrls: string[])
import neume, { scapi } from "neume"; | |
const neu = neume(); | |
const { mul, SinOsc } = scapi; | |
const hello = neu.def("hello", () => { | |
const freq = ctl("freq"); | |
SinOsc(freq)::mul(0.2); | |
}); |
.header { color: #000080 } | |
.comment { color: #7ca668 } | |
.constant.language { color: #569cd6 } | |
.constant.numeric { color: #b5cea8 } | |
.constant.regexp { color: #b46695 } | |
.constant.rgb-value { color: #d4d4d4 } | |
.entity.name.tag { color: #569cd6 } | |
.entity.name.selector { color: #d7ba7d } | |
.entity.other.attribute-name { color: #9cdcfe } | |
.entity.other.attribute-name.css { color: #d7ba7d } |
"use strict"; | |
// $ scsynth -u 57110 | |
const dgram = require("dgram"); | |
const OSC = require("osc-msg"); | |
const colors = require("colors"); | |
const SynthDefEncoder = require("synthdef-json-encoder"); | |
const SC_PORT = 57110; |
"use strict"; | |
function toTime(hi, lo) { | |
hi >>>= 0; | |
lo >>>= 0; | |
var seconds = hi - 2208988800; | |
var milliseconds = lo / 4294967296; | |
return (seconds + milliseconds) * 1000; |
#!/bin/sh | |
cmd="" | |
arg=$* | |
if [ -z "$cmd" ]; then | |
if [[ $1 =~ (^|\/)test\/.+\.js$ ]]; then | |
if [[ $(npm run) =~ ( test ) ]]; then | |
cmd="npm run test" | |
arg="-- $*" |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
(function (global){ | |
"use strict"; | |
require("promise-decode-audio-data"); | |
var AudioContext = global.AudioContext || global.webkitAudioContext; | |
var audioContext = new AudioContext(); | |
var audioData = new Uint32Array(1024).buffer; |
copy files
build & start server
$ npm install
$ npm run build
$ python -m http.server
function pulse(destination, playbackTime, opts) { | |
var t0 = playbackTime; | |
var audioContext = destination.context; | |
var oscillator = audioContext.createOscillator(); | |
var gain = audioContext.createGain(); | |
var frequency = opts.frequency; | |
var volume = opts.volume; | |
function createPulseWave(audioContext, duty, length) { | |
var a = new Float32Array(length); |