#2554 Audio Pod

Jeremy Criquet Fri 5 Aug 2016

Just to continue the converstaion Steve and I were having from skyfoundry.com, I brought up my interest in developing an audio pod. This is something I feel would expanded a lot of the options the Fantom has.

Steve Eynon: An audio pod? That'd be useful!

Would it be to play spot sound effects, or playing tunes?

I'd be temped to write a wrapper around the Bass Audio Library. There's a Java wrapper for it already called NativeBass, so you could potentially use that.

Well, what I was thinking is something that was pretty seamless that would work for both Java and Javascript... I want to avoid some of the pitfalls that fwt had, which eventually caused the creation of dom and domkit. However, that may not be possible.

Plugging it into these libraries probably is pretty trivial. What I'm more thinking about is what the api would look like on the Fantom side, that is easy to use, and integrates nicely with libraries on both sides.

SlimerDude Fri 5 Aug 2016

Adding sound effects to web apps would be cool! Specifically I'm thinking of Games. I know there's Gundam, but I also have another (3D vector based) in the pipeline. (I'm just waiting for work to ease up, like most people!)

Anyway, a cross platform sound API should be very feasible - just need to keep the Fantom API simple to give more flexibility on the native side.

On the Java side, I achieved it in Gundam in a few lines - see JavaOnlySound.

Then in JS, I'd use HTML Web Audio.

For the Fantom API. I'd probably start with something as basic as Sound.play() and Sound.stop() (see Sounds) and see that could work in both worlds. Event driven behaviour and the like can always wait until later.

Jeremy Criquet Fri 5 Aug 2016

Well, I think have audio channels would be VERY helpful. Most things would probably like the ability to customize the volume levels for sounds, music, voice, ambient noise, etc. (games specifically).

That was my thoughts when I originally was designing this back in college, at least.

SlimerDude Sat 6 Aug 2016

Audio volumes and channels indeed would be very cool! My needs are pretty simple, and I just saying code has to start somewhere!

I thought the sounds API would be limited by the Javascript native code, but looking at the comprehensive W3C specs for Web Audio API I don't think it's going to be an issue!

SlimerDude Thu 29 Nov 2018

I never mentioned it, but Escape the Mainframe has a (micro) cross-platform sound API for both Java and Javascript. It lets you start / stop sound effects and adjust the volume. It's not a lot, but enough for basic in-game sound effects.

Source code on GitHub here:

Login or Signup to reply.