Wireless amp systems are really cool and convenient, but they're also crazy expensive. I thought I'd really like one but there was no way I could afford a professional one, so what other option did I have but to make my own?! After recently seeing a talk about the Web Audio API at a conference, I really wanted to try it out, so I thought I would!
What it does
Using an iRig (or some other device/cable) you plug your guitar into your phone and open up the 'play' page of amp in a browser. Then open the 'listen' page on another device and you'll be able to hear the amplified guitar playing - no wires between the two!
How I built it
It uses the Web Audio API to get the input from the guitar, which effectively acts like a microphone when plugged into the phone. It then uses Socket.io-p2p to stream the audio via WebRTC to the 'listen' page. The Node.js server is there only to serve the static pages and to facilitate the handshaking of the p2p WebRTC connection between the 'play' and 'listen' pages.
Challenges I ran into
The Web Audio API is still under active development (read: everybody is still arguing about how it should work), and so is WebRTC. Having previously used Socket.io many times, I thought it would be a good idea to use their p2p module to stream the audio. In the end it worked out okay, but the documentation was a bit rubbish.
Another major issue is the latency. When running the 'play' and 'listen' clients on the same machine, the latency is manageable, but over the network it's too much to be able to play guitar. This does somewhat invalidate this entire hack, but please ignore that fact.
Accomplishments that I'm proud of
I managed to get Socket.io-p2p working, something that as far as I can work out, not that many people have done. It ended up being a great wrapper for WebRTC, but the documentation really needs work. I've started on making an example of how to do media streaming over it, which I plan to submit a pull request for as this is something totally undocumented as of right now.
What I learned
WebRTC is pretty cool, and definitely something to look out for in the future. Same goes for the Web Audio API. Good documentation is also crazy important (but definitely already knew this).
What's next for amp
I'd really like to look into adding some traditional-style guitar effects (distortion, etc). Reducing the latency is probably top of the list for now though. Not entirely sure how I can do that!