6 ms·
Waud.js: Web audio library
- samhunta 10y agoMy only complaint is it is written in Haxe instead of ES6. It would make sense to code it in Haxe if it were to be ported to PHP, C++ and the likes but it appears to be strictly for web audio
- Klathmon 10y agoI don't want to derail this whole submission talking about haxe, but this is the first time I've really ever looked at it. It's not like haxe is some kind of crazy offshoot language, it looks pretty damn close to typescript and flow (But to me this looks closer to "regular javascript" than most typescript and flow does). With the exception of the `@:expose` and `@:keep` stuff, there isn't anything i've seen yet just browsing through the source that I don't understand (as a javascript developer), and i've never seen the language before in my life.
- 0x0 10y agoHaxe started out as an improved alternative flash compiler, and ActionScript was once slated to become ECMAScript compliant, so that's probably why it looks very close to "regular javascript". :)
- elsassph 10y agoHaxe is much older than TS/Flow: it was created in 2006. It's "unsurprising" by design, but there are advanced topics, like pattern matching or macros (AST metaprogramming), and the fact that you're not limited to targeting JS. It's not as cool (and backed by big Californian co) as JS/TS, but Haxe really grows on you when you start mastering it.
- jdonaldson 10y agoI'm guessing you've already looked into those keywords, but @:expose and @:keep are Haxe compiler metadata. These are tags that are used to provide additional information to the compiler. A full list is here: https://haxe.org/manual/cr-metadata.html https://haxe.org/manual/cr-metadata.html In many cases, compiler metadata is specific to a given target. E.g., they can be quite common on extern definitions. This allows the Haxe language to stay small, while providing flexibility for better target interoperability. In this case, @:expose will expose certain methods to the global namespace, and @:keep will prevent the compiler from removing code with its dead code elimination functionality. Both of these are very useful for creating and maintaining js libraries, regardless of whether or not the library is also cross-platform.
- adireddy 10y agoThis project started as a haxe library for projects targeting javascript http://lib.haxe.org/p/waud http://lib.haxe.org/p/waud and later made it available to wider javascript audience as there is no reason to restrict it to only haxe users.
- Hydraulix989 10y agoI just wish this would work on mobile.
- adireddy 10y agoIt was tested on all major mobile devices. If you have any issues on mobile, please report it.
- Hydraulix989 10y agoEven recording audio?
- paulirish 10y agoWeb Audio API is all about playback. The media capture API can tackle recording, and it works on mobile: http://simpl.info/mediacapture/ http://simpl.info/mediacapture/
- deleted 10y ago[deleted]
- Bahamut 10y agoI thought that only works for video? Wouldn't you want navigator.getUserMedia for audio only?
- Hydraulix989 10y agoRight, and on iOS, it just leaves the browser and opens the video recording app. Unless something has changed, getUserMedia still doesn't work on Chrome/Android or iOS/Safari yet.
- Bahamut 10y agoI believe you're correct - the state of audio recording on the web via browser is still awful. We are just finishing an investigation at work on my team, and find that we cannot avoid the use of Flash to record for IE/Edge/Safari...our only saving grace is that this app is mainly intended for desktop use. I wish mobile browser vendors didn't avoid this problem - I get that they're all prioriizing different things, but the state of audio/video recording & playback is abysmal.
- revelation 10y agoWhat is going on, why on earth are we now encoding audio in base64? It's gone beyond getting angry, now I'm just sad for the state of this whole schlamassel.
- adireddy 10y agoThe only reason for encoding audio in base64 is to reduce the number of requests which in turn reduces the loading time. It's an alternative to audio sprites. Useful when you have a lot of audio files to load.
- iverjo 10y agoNice library. The landing page needs some more work. The "features" section contains just keywords that are not explained. I'd like a sentence explaining each feature: what it does and when/why it is useful. For example, at first I didn't understand what "Auto Mute" meant. That was until I played a sound while I switched to another tab, which made the sound stop. When would one want to use auto mute? To me it felt unnatural/unwanted, almost like a bug. Explain why Web Audio API is used when available. What will not work (if applicable) when using the HTML5 Audio fallback? In what kind of web applications would I want to use Waud.js? Games?
- adireddy 10y agoThanks for the feedback. Will try and improve the home page. Auto mute can be helpful in cases like watching a video in one tab and if you don't want audio from another tab interfering, on devices when you press home button or when you receive a call, playing 2 games in 2 tabs, etc. Just there if you need it. Everything will work exactly the same way whether the browser supports web audio api or not. That's the aim anyway and if it doesn't its a bug. Definitely useful for games and any web apps that needs audio playback.
- jiggly_piff 10y agostrikingly similar to WAD - https://github.com/rserota/wad https://github.com/rserota/wad
- jeffehobbs 10y agoAPI docs link is a 404. But I'm looking to try this. Have you worked around with any of the audio playback changes (onlick vs. ontouchend vs onmouseup) in iOS 9/10? I'm curious what "audio unlock" on iOS means.
- adireddy 10y agoFixed API link. Audio playback changes in iOS 9/10 are handled in the library. Tested on various devices including iOS 6 and iOS 10 beta. If you notice any issues please report.