Spherical forums

Sphere Development => Sphere General => Topic started by: Fat Cerberus on May 23, 2017, 12:18:47 pm

Title: What is SFXR?
Post by: Fat Cerberus on May 23, 2017, 12:18:47 pm
While reviewing the Sphere 1.x docs I came across a bunch of sound-related functions with "SFXR" in their names.  What are these functions for?  Some sort of DSP filter system?
Title: Re: What is SFXR?
Post by: Rhuan on May 23, 2017, 12:51:33 pm
I thought SFXR was 1.6 - I have an api.txt with it in but it's not in the one that comes with 1.5 if you download it now.

It was an interface for generating sounds by fiddling with some parameters - I never used it and no longer have a working version of 1.6 so can't comment further.
Title: Re: What is SFXR?
Post by: Fat Cerberus on May 23, 2017, 01:34:12 pm
Yeah, I knew it was 1.6, I was looking at the api.txt in the git repo.  I just wondered what it was.
Title: Re: What is SFXR?
Post by: DaVince on May 24, 2017, 07:01:16 am
What Rhuan said - basically, a sound generator. I never use it myself because the sounds that come out of it tend to be very similar and overused in indie games.
Title: Re: What is SFXR?
Post by: Eggbertx on May 24, 2017, 11:57:20 am
I was looking at that as well. It would bw nice to see some of its required functions implemented in miniSphere.
Title: Re: What is SFXR?
Post by: N E O on September 20, 2018, 12:47:04 am
I'm late to the party here, but yea SFXR is for audio generation. In the future I would certainly like to see more generalized audio generation functions akin to the Web Audio API, but no skin off our backs if Sphere doesn't officially implement it.
Title: Re: What is SFXR?
Post by: FBnil on December 31, 2018, 08:25:50 pm
Sorry for the lateness:
I took the code (with the blessings of the author) from http://www.drpetter.se/project_sfxr.html
And wrote an API for it for Sphere 1.6.
It was working, stable and tested.

There was a demo games/sfxr.zip and some unittests for it games/auto_test/scripts/test_sfxr.js
Are those resources needed?
If so, where can I upload them?
Title: Re: What is SFXR?
Post by: Fat Cerberus on January 02, 2019, 12:01:43 am
I think at this point, now that we're using ChakraCore instead of Duktape, I would probably want to implement something like this in JavaScript, on top of SoundStream, rather than bloating the Core API with what is really high-level functionality.  Then it would even work in Oozaru (which also implements SoundStream) without further code changes.
Title: Re: What is SFXR?
Post by: FBnil on January 27, 2019, 07:43:19 am
Wow, I have not looked into SoundStream, but that sounds rad!
whoa, a whole re-implementation like that! Lot's of code, man!
https://github.com/fatcerberus/sphere-mp3/blob/master/lib/mp3.js
Title: Re: What is SFXR?
Post by: Fat Cerberus on January 27, 2019, 11:40:23 pm
I didn't write that mp3 decoder, that was from this project:
https://github.com/audiocogs/mp3.js

SoundStream itself is really simple to use, you just specify your sample rate and feed it raw PCM audio.  Here's the API:
https://github.com/fatcerberus/minisphere/blob/master/docs/sphere2-core-api.txt#L2012-L2062