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
def = Synth.def (freq)-> | |
amp = Line.kr(1, 0, dur:1.5, doneAction:2) | |
mod = SinOsc.ar(freq * 2) | |
Out.ar(0, SinOsc.ar(freq, phase:mod, mul:0.25) * amp) | |
Task.loop -> | |
scale = Scale.major # Scale.diminished / Scale.choose() | |
synth = def.play() | |
Task.each [2,4,9,7,8,9], (degree)-> | |
freq = scale.degreeToFreq degree, 1046.50 |
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
def = Synth.def (freq=440, amp=1)-> | |
amp *= Line.kr(0.5, 0, 1.25, doneAction:2) | |
Out.ar(0, SinOsc.ar([freq, freq * 1.01]) * amp) | |
Task.loop -> | |
scale = Scale.major | |
t = Task.each [0,1,2,3,4,5,6,7], (degree)-> | |
def.play freq:scale.degreeToFreq degree, 880 | |
@wait 500 | |
.play() |
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
grunt.registerTask 'coverage', -> | |
path = require 'path' | |
istanbul = require 'istanbul' | |
Instrumenter = istanbul.Instrumenter # 計算用のファイルを作る | |
Collector = istanbul.Collector # 集計する | |
Reporter = istanbul.Reporter # 出力する | |
hook = istanbul.hook # あとで説明する | |
coverageVar = "$$cov#{Date.now()}$$" | |
instrumenter = new Instrumenter(coverageVar:coverageVar) |
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
Task.do -> | |
[s1] = [] | |
[ | |
=> | |
s1 = def.play() | |
@wait 100 | |
=> | |
s1.set freq:220 | |
@wait 200 | |
=> |
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
i = Iterator -> | |
x = 0 | |
@yield x # 0 | |
x += 10 | |
@yield x # 10 | |
x += 10 | |
if no | |
@yield "skipped" | |
else if yes | |
@yield x |
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
# 関数の中を調べて最終行が関数でない | |
SynthDef (freq=440)-> | |
Out.ar(0, SinOsc.ar(freq)) | |
# replaced | |
SynthDef((freq)-> | |
Out.ar(0, SinOsc.ar(freq)) | |
, ["freq", "440"]) | |
# 関数の中を調べて最終行が関数 = (template) |
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
CassetteSound.prototype.start = function() { | |
this.on = true; | |
var self = this; | |
if (!this.connected) { | |
this.connected = true; | |
// iOSはユーザー発のイベントから Web Audio API をスタートさせないと動かないので | |
// コンストラクタの connect を start に移動させる | |
if (this.dummy.noteOn) { // Firefox対策 (なぜか noteOn メソッドがない) |
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
(-> | |
trig = Dust.kr([5, 5]) | |
freq = TIRand.kr(110, 1760, trig).lag(1) | |
SinOscFB.ar(freq, 0.5.pi()) * Decay.kr(trig, 0.25) | |
).play() |
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
# src | |
a = for i in list by 2 | |
console.log i | |
@wait 1 | |
i | |
console.log a | |
# replaced | |
@wait a = Task.ForLoop list, 2, (i)-> | |
console.log i |
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
Task -> | |
i = 0 | |
loop | |
console.log i | |
1.wait() | |
.play() | |
Task -> | |
for i in [0..10] by 2 | |
console.log i |