

Ask HN: Has anyone developed a web API for sound samples? - md224

I'd like to try my hand at creating a web-based real-time collaborative music platform, but one of the biggest hurdles is putting together a library of solid instrument samples for the user to trigger. I really wish there was a simple API for selectively downloading specific instrument libraries from a third-party provider to the client, much like Google's WebFonts API provides a simple way of selectively loading fonts straight from Google.<p>Does such an API exist? If not, I feel like this would be an incredibly useful product that many music-oriented web developers could benefit from. There's even a good chance I'd pay for it!
======
ecaroth
I agree with you - just recently I spent WAY too long trying to find a good
free sound sample for a notification chime and integrate it into a cross-
browser audio object. Not sure if you are thinking of the implementation-end
as well (aka javascript/HTML5/flash player of some variety) that can consume
the api or just the api itself.

What would have been the ideal solution for me would have been a JS script I
could have included then simply instantiated with a sound (like 'bell chime')
and exposes simple javascript controls like goTo, play, stop, pause etc and
worked seamlessly cross-browser with HTML5 and flash fallback. I know sound
players like this exist (minues he included sound bytes) but they all have the
overhead of the UI for player controls.

~~~
jaredsohn
Consider SoundManager2 (<http://www.schillmania.com/projects/soundmanager2/>).
It allows controlling sounds via HTML5 or Flash via a JavaScript API without
any UI overhead.

------
jaredsohn
If you build this, you may want to look at Google's Web Audio API
([http://chromium.googlecode.com/svn/trunk/samples/audio/index...](http://chromium.googlecode.com/svn/trunk/samples/audio/index.html))

------
inthecompanyof
Can you expand a little further on your pain point?

~~~
md224
Certainly... if I wanted to create an app where a user could play a virtual
"instrument" via the computer keyboard, I would want to trigger a specific
audio sample (e.g. a piano note or a drum hit) when the user presses a key.
There are already several libraries out there (SoundManager2 comes to mind)
that allow for fairly simple cross-browser audio output, but the problem is
procuring the audio samples themselves. I could go to the trouble of scouring
the internet for solid sound samples, uploading all of them to my server, and
setting up all of the note/sample mappings... however, much like Google has
made it unnecessary for every web developer to upload all the custom fonts
they want to their server, I'd like an API that allows me to browse and
include instrument sample packs without having to first track down the
samples, upload them, and manually map everything.

The goal is to make client-side samplers as painless as possible, lowering the
barrier to real-time music generation on the web... kind of like a modern
alternative to simple MIDI instruments.

I could see this being useful not only for virtual web instruments, but also
for any website that wants to utilize some form of dynamic musical feedback.

EDIT:

I could see this being implemented in a lightweight or a heavy-duty fashion:

1) Lightweight: API merely provides note-mapped URLs to the audio samples, up
to the developer to decide how to pull in each sample and store/output it.

2) Heavy-duty: API takes care of storage and output. Creates an instrument
object with a play method that takes a note value (MIDI value?) as input. This
is more in line with what ecaroth suggested.

