Show HN: HTML5 Piano - with its own data URI synth
mrcoles.com
mrcoles.com
If you hit "0" or the button in the top right, it'll show a dashboard with settings and info on how to use it. I make that minimize from full size during page load as a vague indicator that it's hidden up there.
Also, I don't know if anyone notices the "info" link in the bottom left that scrolls the whole page down and shows some more info?
When I get chance I'll make a quick video of using it with the looper to perform a song.
- var isIos = navigator.userAgent.match(/(iPhone|iPod)/i); + var isIos = navigator.userAgent.match(/(iPhone|iPad)/i);
Thanks for letting me know it was still broken!
Unfortunately, as I said above, it will not play the music, but it will still shoot out waveforms from the piano. I spent several hours experimenting with different dataURI settings and then trying falling back to static .wav files. The latter was the most promising, but there was still a huge lag between calling .play() and the sound actually playing. Looks like you still have to rely on actual "apps" to have good sound on iOS. (If someone knows otherwise, please share!)
No more crash though. Cool.
HTML5 audio has lots of problems, but the clicking and distortion also gives it that special pop and click sound that you wouldn't otherwise get. Future browsers will just sound too robotic on this piano :)
Additionally, higher notes often get distorted as a result of the low sampling rate. I just changed it to turn on "visual mode" by default (that lightning bolt thing in the top right). You can actually see where the low sampling rate starts to affect the resulting wave form—which is sort of fun to see.
Sorry to be that guy. This is a very cool hack.
There's a looper too (that 2nd button, or the 9 key—hold down to start recording, lift up to stop recording and start playback) which can lead to interesting songs.
http://retro-treasures.blogspot.co.uk/2007/11/commodore-64-m...
https://github.com/mrcoles/javascript-piano/blob/master/audi...
Linear fade and quadratic fade sound nice on the way out, but all start at full volume.
Firefox works great.
Any acoustics nerds that can help me understand this?
The harmonics (sines whose wave length is an integer fraction of the fundamental) play a big role in how we perceive sounds.
I'd expect timbre to get weird from aliasing of the high harmonics, but since all the partials within an octave above that C5 are under the Nyquist frequency of a 2048Hz sample rate, I'm a little surprised that the pitch is affected.
I guess there's probably some destructive interference being caused by the aliasing though. Maybe that's what's ruining the tuning.