Fork me on GitHub
#music
<
2020-07-08
>
kennytilton11:07:15

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 McCormick11:07:55

@hiskennyness destination would be expecting the audiocontext destination:

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

Chris McCormick11:07:24

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

Chris McCormick11:07:28

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

kennytilton14:07:56

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:

kennytilton14:07:00

TypeError: synth.call is not a function

kennytilton14:07:30

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

kennytilton14:07:59

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

👍 3