Playing audio/sound files


#1

Is there a way to play a sound file from a package? I naively tried using the audio html tag, which didn’t seem to work.


#2

I was able to get this working, using the Web Audio API.


#3

Can you explain how you do it?


#4

You can see it in the package I wrote: https://atom.io/packages/raptorize

There is one problem though. Currently, it seems that only one AudioContext object can be created per window - so there might be issues if multiple packages create their own AudioContexts. Ideally, Atom should manage a singleton AudioContext for all packages to use.