The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

329450 (2) [Avatar] Offline
#1
The project file
[ 636 bytes ]
I'm wondering if anyone has similar problem. I tried to use the exact source code copied from the book's PDFfile. After "lein cljsbuild once" without any error message, I tried to load the HTML in Chrome (the latest Version 41.0.2272.101 m), and Firefox (version:

After loading the HTML file, no error message, no sound, and clicking the button "PLAY" produces no sound, and no error message.

But using Chrome's inspection tool, I did found errors:

"Uncaught TypeError: undefined is not a function"
at the line 32967 of all.js:
node.noteOn(delay);

I have no idea how to fix the problem. It seems that the compiled javascript file is not complete.

Thanks for your help on how to debug the problem.

The related files are attached.

(I tried even the source code from the author, the same problem exists in my environment.)


Yu
352430 (1) [Avatar] Offline
#2
music.cljs
[ 3 KB ]
project.clj
[ 454 bytes ]
The problem has to do with the Web Audio API. It changed a bit after the book was published. In particular three function names were dropped / changed...

createGainNode() has been renamed to createGain()

The noteOn() and noteGrainOn() methods were consolidated into a single start() method, and the noteOff() method was renamed to the stop() method.


You can read more about it here...

https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Porting_webkitAudioContext_code_to_standards_based_AudioContext



I attached an updated project file along with a music.cljs file that includes the above mentioned changes. It works nicely in FireFox 37 and Chrome 42.0.2311.90


Best regards,

Jim