HTML5 Piano
mrcoles.com
mrcoles.com
(Of course, I know, this is all according to standards and all. But still.)
Our web app that plays audio in sync on multiple devices works in iOS, Chrome (non mobile) & Firefox Aurora. Were eagerly awaiting for the newest Chrome for Android to drop.
Feel free to ask any questions or suggest any changes. As @danso pointed out, this is the repo https://github.com/mrcoles/javascript-piano
https://plus.google.com/+ChrisWilson/posts/cs4J6sS9qmJ
You download the experimental browser, then turn on this flag:
chrome://flags/#enable-web-midi
You can get events by plugging in your USB MIDI keyboard and loading a browser page with this code:
I've verified this with my Casio keyboard, and the webpage can receive events when I play. It can also play audio out through my Casio's speakers.
This will open up a whole new type of website, where you can plug in your instrument and jam with friends, or learn along with a tutorial visualization or video.
Even replacing audio with MIDI, the network latency imposed by even the speed of light is too great for simultaneous jamming with friends in other places. Heck, it's even an issue for marching bands -- the difference between the speeds of light and sound across even a football field requires special attention in order to keep things sounding together for the people in the stands.
The only good solution I've seen for this is NINJAM[0], a protocol for online jamming where, instead of trying to fight latency, the creators changed the problem. By enforcing a uniform tempo and number of beats per phrase (inside of which a repeating chord progression must fit), people can jam together by playing to what the other people played n beats ago, and everybody else will hear you n beats late.
I started working on a browser-based client for this protocol a while ago[1], though I unfortunately put it on the back burner before figuring out proper vorbis encoding/decoding in JS. A MIDI adaptation of this could prove to be quite fun, and I think my client (if ever finished) could actually benefit a bit from some MIDI integrations already present in some existing clients as well. Thanks for bringing it to my attention.
[0] http://www.cockos.com/ninjam/ [1] https://github.com/BHSPitMonkey/ninjam-js
Try it out!
Same concept but allows you to pick chords.
I let the html5piano.com domain expire but its still up on Azure:
There are lots of things that make actual QWERTY piano difficult, e.g., fewer keys than notes on a piano, hitting complex chords would be very difficult (regular typing doesn't train you to type entire words in a single combined press of keys), computer keyboards have no benefits of weighted keys—but perhaps at least one note a time melodies could be played pretty proficiently by non-musicians with a QWERTY player?
If you click the square in the upper right, you'll get options to change the waveform and volume response. There are some other options too, like shifting by an octave or changing the color of the piano :)
Better things could be done by using the web audio APIs, but I explicitly started this project wanting to build audio using data URIs.
Which was based on this one in JavaScript: https://github.com/skybrian/midiplayer
It is still online at http://labs.hardinfo.org/pb/.
To play, turn it on (green button), then press "Memória Tons" (third button from the right in the last row).
---
Relevant: http://www.jamwithchrome.com/
Here are two web audio API example apps... http://sleep.fm (online alarm clock; view on iOS device)
And
http://speakerblast.com - blast audio in sync on multiple devices
Anyone know other web apps that heavily use the web audio API?
If so how did you guys get the audio to play in sync across devices?
We've been trying to figure that out.
I wrote this web app in May 2012—I don’t think iOS was there yet? I’m open to a pull request though https://github.com/mrcoles/javascript-piano but since the project was mainly a test for generating different wave files as dataURIs (and the piano was an afterthought that was actually spawned from this half-baked idea http://mrcoles.com/media/test/guy/ ), idk if the dataURI approach is any easier on iOS yet (or ever will be)?
> This is an HTML5 synth piano that generates all of its audio files on the fly using data URIs.
The audio.js shows this process in a bit more detail:
https://github.com/mrcoles/javascript-piano/blob/master/audi...
I assume the audio APIs would make less click-y sounds (and don't suggest manually created wave files as a solid way to create perfect sounds), but I also sort of like the clicks. When I presented this at Hack and Tell NYC, I claimed that you had to play it in Firefox 12 to get hear the exact clicks that were originally intended in the product ;?j
Some days I wish I'd learned how to play the piano.
Would be so cool to create a full 88 keys digital piano on a flat piece of glass with a touch layer. No edges, but for the well rounded toughened glass with see through.
Simulated weighted keys using software, have modes (Strings is a must!), basic metronome, equalizer, controls and additional synth effects; and well on top of that a custom built browser to suit the window size of 58.8 x 12.8 x 22.2 inches! :D
There's a reason most band pianists haul around electric pianos with heavy weighted keys rather than cheaper keyboards that contain the same sound synthesis engine.
Of course, the ideal situation is a mix of electronic devices’ flexibility and physical keyboards’ feedback. That could be something like a touch screen that can raise and lower physical bumps on it to feel like keys, or vibrate with different strengths in different places to provide feedback to each finger. But we don’t have that technology yet.
What will happen is a slow change in playing style, so things will sound different. Sort of like the change from arch to Torte bow for violins, only more radical.
The plural of anecdote is not "data", but I, for one, will no longer understate the difficulty in transitioning to a new type of action.
And then with these web-capable devices we can end up building a web of sounds! Have applications talk on notes, coherence, resonance -- hyper speech/sound transfer protocol (hstp://)? #weekendimaginations :D