I thought that since I was going to the Web Audio Hack Day here in Singapore, it would be great to have a more Web Audio focused Media Recorder demo, so I built a little demo that essentially asks for audio permission, then records a short clip of audio, decodes it as an audio buffer and uses it to loop a BufferSourceNode in Web Audio.
You wouldn't believe what happened next... or would you?
Two Things That Happened When Sole Ran This Demo
1. Chrome Canary Just Totally Gave Up
I filed a bug, since there wasn't really much I could do...
2. Nightly Sometimes Insisted In Returning Some Mysterious 596 Samples Length Which Was Totally Not What I Expected, And Did So Without Following Any Meaningful Reproducible Pattern
I tried to dump the contents of the returned blob once read as a buffer, using String.fromCharCode--perhaps looking at binary data while having my breakfast coffee would enlighten me?
As it turns out, no. So I filed another bug.
Try this yourself maybe?
The demo is here: instalooper (sources) ... just in case you want to play with the code--maybe it will be fixed next month, who knows!!? Or maybe it is just a bug in my machine and it works in everyone else's!
Disclaimer: I have not tested this anywhere else than Nightly and Canary. So I've no idea of how it works (or not) in mobile.
I have a more complicated version that not only loops the sample but also randomly changes its playback frequency. Sometimes the generated sounds are strangely fascinating. It still needs a bit of interface work, but hey... watch out, Steve Reich! 😎
And now... time to prepare to go to the airport and fly to Melbourne for JSConf.AU! More jetlag, YAY!