music

Ever heard of it?
kennytilton 2020-07-08T11:31:15.030600Z

Is anyone familiar with cljs-bach or klangmeister? I am just looking for a hello world example to get rolling. The cljs-bach readme gets as far as suggesting:

; Play the ping synthesiser now, at 440 hertz.
(-> (ping 440)
    (connect-> destination)
    (run-with context (current-time context) 1.0)))
…but leaves it to us to provide destination, apparently a DOM node. I was hoping to find a complete example. I do not see anything in the klangmeister repo like an example. The google comes up empty, too.

Chris McCormick 2020-07-08T11:38:55.031100Z

@hiskennyness destination would be expecting the audiocontext destination:

var audioCtx = new AudioContext;
gainNode.connect(audioCtx.destination);

Chris McCormick 2020-07-08T11:39:24.031500Z

(-> (js/AudioContext.) .-destination)

Chris McCormick 2020-07-08T11:41:28.032600Z

seems like context above is already the audiocontext so: (let [destination (.-destination context)] ... ) should work

kennytilton 2020-07-08T14:24:56.034600Z

Fantastic, @chris358. That worked great. I can evaluate all the forms without error, and the destination looks like a destination. But when I evaluate the whole shebang I get:

kennytilton 2020-07-08T14:25:00.034800Z

TypeError: synth.call is not a function

kennytilton 2020-07-08T14:27:30.036900Z

Hmm. That is in an Intellij/Cursive repl connected via figwheel to my browser. Possibly not meant to work that way?

kennytilton 2020-07-08T14:27:59.037400Z

But, hey, thanks for the huge leg up! 🙏

👍 1