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
| trait Expr[+A] | |
| trait Value | |
| trait AudioValue extends Value | |
| trait Elem extends Expr[Value] | |
| trait AudioElem extends Elem with Expr[AudioValue] |
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 collection.mutable.{SortedSet => MSet} | |
| val s = MSet(10 -> "a", 10 -> "b", 3 -> "c", 3 -> "c", 3 -> "d", 44 -> "a", 0 -> "a") | |
| // -> 0, 3, 3, 10, 10, 44 | |
| val t = MSet(10 -> "a", 10 -> "b", 3 -> "c", 3 -> "c", 3 -> "d", 44 -> "a", 0 -> "a")(Ordering.by(_._1)) | |
| // -> 0, 3, 10, 44 . in other words, key inequality does _not_ matter, only ordering |
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
| play { | |
| val env = IEnvGen.kr(IEnv(0, Env.Seg(3, 1, linShape) :: Nil, 0), MouseX.kr(0,1)) | |
| env.poll(1) | |
| } | |
| ///////// | |
| def test(off: Double, dur: Double, fadeIn: Double, fadeOut: Double) { | |
| val x = gui { |
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
| // Note this is still cubic interpolation, unfortunately VDiskIn doesn't have an interp argument. | |
| // So you don't get as cripsy sound as with linear interp (would need BufRd and annoying buffer management). | |
| val p = "/Volumes/data/hhrutz/Mnemo/Misc130428_3/superjam/rec/|fsc9.aif" | |
| val spec = io.AudioFile.readSpec(p) | |
| val b = Buffer.cue(path = p, numChannels = spec.numChannels) | |
| val r = Buffer.alloc(numFrames = 32768, numChannels = spec.numChannels) | |
| val rate = 0.5 | |
| val dur = spec.numFrames / (rate * spec.sampleRate) | |
| val q = "/Users/hhrutz/Desktop/test.aif" |
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 reflect.runtime.{universe => ru} | |
| val m = ru.runtimeMirror(getClass.getClassLoader) | |
| case class Bar(i: Int) | |
| val tpe = ru.typeOf[Bar] | |
| val classBar = tpe.typeSymbol.asClass | |
| val cm = m.reflectClass(classBar) | |
| val ctor = tpe.declaration(ru.nme.CONSTRUCTOR).asMethod | |
| val ctorm = cm.reflectConstructor(ctor) |
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 scala.swing._ | |
| new Frame { | |
| contents = new ComboBox(Seq("one", "two")) { | |
| listenTo(selection) | |
| reactions += { | |
| case event.SelectionChanged(_) => println(selection.item) | |
| } | |
| } | |
| pack() |
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" : "EvalWindowed", | |
| "data" : { | |
| "window" : { | |
| "class" : "WindowEvents", | |
| "data" : { | |
| "size" : 5, | |
| "step" : 2 | |
| } | |
| }, |
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
| trait Sys { | |
| type Global | |
| } | |
| object Settings { | |
| def apply(sys: Sys)(glob: sys.Global): Settings { type S = sys.type } = | |
| new Settings { | |
| type S = sys.type | |
| val system: S = sys | |
| val global: sys.Global = glob |
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
| boot() | |
| val in = play { Out.ar(0, "bus".ar(0)) } | |
| in.mapa("bus" -> 40) | |
| val out1 = play { Out.ar(40, WhiteNoise.ar(0.25)) } | |
| val out2 = play { Out.ar(40, SinOsc.ar(400) * LFPulse.ar(4) * 0.5) } | |
| in.moveAfter(out2) // mapa / InFeedback doesn't mix bus signals with different time stamps :-( | |
| in.free(); out1.free(); out2.free() |