meenie / band.js

Band.js - Music composer interface for the Web Audio API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Impossible to update notes without recreating the BandJS instance

codefromhezad opened this issue · comments

I cant grasp my head around this. If I try to load() a song, it works perfectly the first time. But if I load() another song after (without recreating a new BandJS() object), it looks like the previous notes are still in the buffer (I can hear them over the new ones !).

I hope it's understandable and I didn't overlook something in the documentation.

Hi @hezad,

At the moment, you will have to create a new instance of BandJS if you want to keep loading notes. I can see how that would be very annoying if you were building an interface for this and utilising the load() method. I'll have to update the library to accommodate this. At the moment I'm on vacation and won't be home until the 21st of this month. If I have some downtime I'll try and put in a fix and release it before then if I can.

Cheers,
cody

No problem. Creating a new instance wouldn't be so bad, but the AudioContext seems to be out of memory once I recreate the instance twice or thrice without reloading the page. Can't wait for a fix about this :)

This being said, please enjoy your vacation. Band.js is a really nice library.

Pierrick

With regards to the running out of memory, I've got a new version in the works that fixes this. Instead of loading all of the notes at once, it now only loads 50 notes from each instrument and then buffers in more notes every 5 seconds. So now it can handle songs of unlimited length. I've got my Mario Bros repeating 2000 times so it's at 667 mins and I can seek around without any delay and it takes up minimal memory.

Awesome ! Any chance to see that commit soon ?

Checkout the improvement-throttling-notes branch and look at the Mario Bros example. You'll see that you can seek around the song.

Hum .. It looks like the build/ folder of this branch has the same build as the master branch. Do you think you'd have some time to quickly explain the build process on the README so any Grunt/Bower noob (like me) could build the lib ?
That would be awesome :)

Thanks a lot,
Pierrick

Make sure you have NodeJS installed and then run npm install -g grunt-cli to install grunt. Then in the base directory of BandJS run npm install and the run the command grunt. I'm on my mobile so sorry for the lack of formatting.