SFML community forums

Help => Audio => Topic started by: Mills on February 05, 2020, 05:47:39 pm

Title: Disable audio filters
Post by: Mills on February 05, 2020, 05:47:39 pm
I didn't  find anything related to this in the forums.

I am programming some kind of "fantasy computer"in CSFML just for fun, similar to pico-8 (and things like that).

I nearly got it working, and it uses tiny wave samples with very low quality (1000Hz). I want the sound to be even more "retro" disabling the filters.

Is it possible to disable the fefault filters used by openal wave player?

Thanks.
Title: Re: Disable audio filters
Post by: eXpl0it3r on February 05, 2020, 06:29:59 pm
What filters are you referring to exactly?
Title: Re: Disable audio filters
Post by: Mills on February 05, 2020, 06:49:53 pm
What filters are you referring to exactly?

I did not explain it very well, I think people call it "sound dithering". I attached two samples to show it.
I just resampled a small sample from 8192 Hz to 44100 without any filters.

I just can use the resampled sounds like that, but I wanted them to be tiny in size.

If the hardware or the player has no sound filter, it sounds like the unfiltered version. SFML is playing like the filtered one.



Title: Re: Disable audio filters
Post by: eXpl0it3r on February 06, 2020, 04:58:56 pm
I don't think we use any special filtering, but maybe it's just a default filtering or maybe we're doing some resampling, which will act as a "filter".
The fact is that SFML will load your file in the provided sample rate. Whether SFML then resamples that or whether OpenAL has some default filter, I don't know.

Maybe Laurent knows?
Title: Re: Disable audio filters
Post by: Laurent on February 06, 2020, 05:50:57 pm
I don't know what OpenAL does internally, but I don't think there's any filter.

It's not clear how you produced these 2 files. And how you produced the file that you want SFML to play. Can you upload it?
Title: Re: Disable audio filters
Post by: Mills on February 06, 2020, 09:01:36 pm
I think nobody imagined OpenAL would be used with such low frequencies, so I just resampled the audio myself and solved the issue.

Input files are still at low sample rates, but I used the sound buffer functions from SFML to resample them internaly to 44100 (just copy from a sample array to other array), so that they sound "unfiltered" in all sound players.

About the sounds I uploaded...

I created the "filtered" wave in audacity, just resample from low sample rates to 44100, and it will also add some default dithering, destroying the retro sound.
The "unfiltered" file was created using open modplug tracker, which has a lot of "retro" options for audio.

Here you see the resampling options in open modplug:

(https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=26928.0;attach=4663;image)

And here the resampled waveforms (44100Hz):

(https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=26928.0;attach=4664;image)

Hope this helps someone trying to get retro sounds :).

Title: Re: Disable audio filters
Post by: Laurent on February 06, 2020, 09:46:33 pm
I see. The default resampler in OpenAL-Soft seems to use linear interpolation. After a quick search I found that you can change this behavior in OpenAL's config file, see https://github.com/kcat/openal-soft/blob/master/alsoftrc.sample#L170