meenie / 8bit.js

8Bit.js Audio Library - Write music using 8bit oscillation sounds.
778 stars 37 forks source link

Noise channel #11

Closed mchwalek closed 11 years ago

mchwalek commented 11 years ago

Original NES had 5 channels:

Source: http://battleofthebits.org/lyceum/View/NES/

With your library you can currently achieve the 2 pulse channels and the triangle channel. As for DPCM I don't care. It could be neat if the library would support the NES noise channel, but it certainly will be tricky. What do you think about that?

Some resources about the NES noise channel: http://wiki.nesdev.com/w/index.php/APU_Noise http://forums.nesdev.com/viewtopic.php?t=3879 http://www.youtube.com/watch?v=la3coK5pq5w http://bobrost.com/nes/files/nessound.txt

meenie commented 11 years ago

I'll have to admit that this type of thing is way over my head. I'm just a musician, not an audio engineer. I'm not really sure where to start. Any advice?

JoshuaKGoldberg commented 11 years ago

Bump, this would be terrific. I would use the crap out of this on FullScreenMario.

eugene-bulkin commented 11 years ago

http://noisehack.com/generate-noise-web-audio-api/ could maybe help?

meenie commented 11 years ago

Once we figure out how to make these different channels, I have a plan on how to extrapolate the section of code that creates the current oscillators and put that into it's own function. That way we can add in audio packs for different types of sounds. Create a small API where you pass it the frequency, start/stop times, and what type of sound you want. This will use type of sound to see which sound pack to use. It then passes the sound pack the required info and then it returns an object that can be connected to the current audio chain. This way can come up with complex sounds and can be dropped right into 8bit.js for use as a new instrument :).

meenie commented 11 years ago

http://noisehack.com/generate-noise-web-audio-api/ could maybe help?

Perfect! That will take care of the noise channel. I will get started on what I described in my previous comment.

meenie commented 11 years ago

Along with the rewrite of 8bit.js into Band.js, I have created 3 new instruments for noise (white, pink, and brown). You can see the new library here: https://github.com/meenie/band.js - Also, here is an example of using the new White Noise instrument: http://plnkr.co/edit/LG20SL?p=preview

Going to close this off and it can be picked up in a new issue in the new Band.js repo if necessary.