Show HN: Drum machine in 100 lines of HTML/JS
31–40 of 51 posts
Re: Show HN: Drum machine in 100 lines of HTML/JS
#32Never use setInterval for audio based applications. It's just totally unreliable. WebAudio has nice built in features for high precision timing.
When the goal is showing off what you can do with 100 lines of code, what's wrong with it? I doubt high precision timing can be done with the same amount of code.
Re: Show HN: Drum machine in 100 lines of HTML/JS
#33Re: Show HN: Drum machine in 100 lines of HTML/JS
#34Earlier quoted context omitted.
When the goal is showing off what you can do with 100 lines of code, what's wrong with it? I doubt high precision timing can be done with the same amount of code.
First, it's an enourmous waste of computing resources. Second, it doesn't even work, since the 'setinterval' is unusable for audio timing. Third, what's there to show off? So Javascript got a 'PlayWav' function that you call in not so regular intervals depending on buttonstate. Simple beatbox is simple. Could aswell be 30 lines.
Re: Show HN: Drum machine in 100 lines of HTML/JS
#35Never use setInterval for audio based applications. It's just totally unreliable. WebAudio has nice built in features for high precision timing.
When the goal is showing off what you can do with 100 lines of code, what's wrong with it? I doubt high precision timing can be done with the same amount of code.
I've researched this in the past and it's nowehere near significant more complexity. In fact, a primitive solution is about the same as a setInterval call.
Re: Show HN: Drum machine in 100 lines of HTML/JS
#36Never use setInterval for audio based applications. It's just totally unreliable. WebAudio has nice built in features for high precision timing.
When the goal is showing off what you can do with 100 lines of code, what's wrong with it? I doubt high precision timing can be done with the same amount of code.
Re: Show HN: Drum machine in 100 lines of HTML/JS
#37I thought the drum sounds would be generated using JS, but they are just pre-recorded samples (bass_drum.wav, snare_drum.wav, low_tom.wav, mid_tom.wav, hi hat, cymbal, cowbell, hand clap, hi tom, conga, claves). I'm looking for drum-generated sounds using pure javascript, so I can make changes on them and create new kinds of sounds. I already created some pure JS sounds (e.g. laser sounds, bass effect, white noise, a…
The sounds should work across browsers when you're manually playing (use the bottom row of your keyboard) but when sequenced playback happens, things get weird. Chrome more accurately reproduces the sounds as I'm imagining them.
Grab the whole thing at https://github.com/leviathant/BossDR110/tree/feature/synthes... or just play around with it yourself at http://bitrotten.com/dr110/webaudio/
Re: Show HN: Drum machine in 100 lines of HTML/JS
#38http://imgur.com/a/O1dy8
Re: Show HN: Drum machine in 100 lines of HTML/JS
#39http://imgur.com/a/O1dy8
Re: Show HN: Drum machine in 100 lines of HTML/JS
#40http://imgur.com/a/O1dy8