r/javascript • u/magenta_placenta • Dec 27 '17
SoundJS - a Javascript library for working with Audio. It provides a consistent API for loading and playing audio on different browsers and devices. Currently supports WebAudio, HTML5 Audio, Cordova / PhoneGap, and a Flash fallback
https://github.com/CreateJS/SoundJS3
3
u/Lakelava Dec 28 '17
Does it add support to codecs the browser doesn't have? If yes, are those codecs added with web assembly?
4
u/kingromes Dec 28 '17
As someone pointed out in this thread, SoundJS doesn't do anything the browser can't already do -- it just simplifies the API, handles browser issues, and assists with determining what file formats can play (etc).
Supporting additional codecs is definitely not on the roadmap at this time, though it is an interesting idea.
-5
0
Dec 27 '17
[deleted]
15
20
u/gieter Dec 27 '17
Not bad for a crossbrowser compatible api. Not everyone had a modern browser.
0
Dec 27 '17
[deleted]
1
u/gieter Dec 27 '17
60 vs 30 is nothing compared to the cost of finding and fixing crossbrowser issues the library should have done for you.
Also Howler does not have IE8 support and soundjs does. Granted, that should not be a requirement these days.
2
u/brown59fifty Dec 28 '17
This doesn't support IE8 either. Fixing crossbrowser issues? What issues? it's just wrapper around HTML5 APIs, which every browser supported by this lib (so IE9+) support well, and it provides nothing more than native functionalities. It's probably good lib for those who are using that CreateJS ecosystem and want to wrote consistent code, but for everyone else it's a waste of memory.
Sorry if I'm wrong, but that's how it looks like...
5
u/kingromes Dec 28 '17
When SoundJS was released (2010/2011), there was no HTML5 or WebAudio, so it wrapped HTML tag audio, as well as a Flash-based solution (which was left in to help older browsers). It also works as a plugin for more advanced preloading scenarios with PreloadJS. Tag-based audio is a beast that we will be glad to get rid of in a future release. Every browser had quirks and issues, and a ton of work went into supporting all of them (as well as things like Audio Sprites to get around mobile limitations).
WebAudio and PhoneGap/Cordova support was also added over the years. They aren't part of the main library (and don't add to the bloat), but there are things necessary in the main library to facilitate the plugin architecture.
I don't disagree with the main point though. SoundJS has become a bit bloated, and with the well-supported WebAudio API being available pretty much everywhere, the next major release should see a reduction in filesize.
(source: I manage a lot of this stuff @ gskinner)
1
u/brown59fifty Dec 28 '17
I fully understand that! And don't get me wrong, I'm just thinking about using actual version of lib in context of today's world of evergreen browser (not that older versions with backward support).
Thb I'm not a fan of adding more and more external libraries to the project to cover basic functionalities available in browser of out the box... I remember the times when we've got to make hundrets of hack to privide cross-browser compatibility, but now we don't have to. And that's the reason why my opinion someone can get as negative from the beginning ;)
0
Dec 27 '17
[deleted]
0
Dec 27 '17
[deleted]
3
Dec 27 '17
Depends on your target market. Lots of people in Germany have insanely powerful smartphones, but if you're not in a major city, your network connection speed will suck.
0
Dec 27 '17
[deleted]
3
Dec 28 '17
I never said that they're from Germany, I said that most Germans have modern smartphones, but shitty network outside of major cities.
0
Dec 27 '17
[deleted]
13
u/Arve Dec 27 '17 edited Dec 28 '17
Your question is way out of scope for a library like this. The only thing this library is made to do is to provide a cross-browser-compatible means of loading and playing sound.
Analyzing "the pitch of a note in a soundtrack" is a completely nontrivial task. If it's doing something simple like implementing a spectrum analyzer, the WebAudio API or any library that implements it should work. If you're trying to do something like automatically transcribe an arbitrary audio stream to sheet music, you're in for a world of pain plus a bunch of code that you won't find in any audio library anywhere.
(All previous efforts at transcribing music, on any platform, pretty much all suck to the point that it's worthless - this has to do with the very nature of sound. While it's possible to transcribe input from a single instrument like a guitar to then convert to MIDI data, doing so for music with multiple distinct instruments is next to impossible. In either way: There are no libraries that does this for you, and you are going to need to write code from scratch)
4
u/timothyallan Dec 28 '17
Wait, this library doesn't give me a polyphonic Melodyne like feature set in IE8? Totally unusable.
2
u/spoonopoulos Dec 28 '17
It isn’t next to impossible as much as quite complex and of variable utility (depending on the source). There’s a fair bit of literature, mostly in the domain of blind source separation, related to polyphonic transcription and “demixing”, as it were.
2
u/iccir Dec 28 '17
Arve's reply is correct - this is a very hard problem. I don't know of any JS library which implements a solution. That said, if you want to research it, I'd start by searching for "f0 detection" or "f0 estimation". If other music/sound is playing, add "polyphonic" to your search.
33
u/VeryAngryBeaver Dec 27 '17
That's a surprise, I work at gskinner the company behind this library. If there's any questions or comments I'll try to answer them or pass it along to the developers maintaining the library.