SFML community forums

General => Feature requests => Topic started by: torokati44 on January 01, 2013, 01:21:55 pm

Title: Configuring SoundRecorder processing frequency
Post by: torokati44 on January 01, 2013, 01:21:55 pm
Hello Laurent and everybody else!

I am playing around with spectral analysis (with FFT) and stuff like that, and as SFML can record sounds,
I thought it would be great if I could analyze not only sounds stored in a file, but in real time, as it comes out of my speakers, or goes into my microphone. (You know, everyone loves spectrograms...)

But upon deriving my recorder class from SoundRecorder I have seen that it hands me the samples in batches of roughly 4410 long (10 times a second), which is a bit "laggy", if you are watching the spectrogram.

This is because you have that 100 ms sleep in SoundRecorder.cpp somewhere.
I have hacked my copy of SFML to make this delay configurable, and setting it to 10 ms is quite a lot better.

So I think maybe you should make this option available in the mainstream source too, because some applications require lots of small sample batches very frequently (like this one), while others are OK with a few large ones, and want to spare with resources. (Although on today's multi-core computers a few hundred calls of a function this small every second is not a big deal, especially on a separate thread.)

Greetings:
Attila
Title: Re: Configuring SoundRecorder processing frequency
Post by: Nexus on January 01, 2013, 01:53:12 pm
This feature has already been requested (here (http://en.sfml-dev.org/forums/index.php?topic=5908.0), here (http://en.sfml-dev.org/forums/index.php?topic=9724) or here (http://en.sfml-dev.org/forums/index.php?topic=6566)), possibly Laurent forgot about it. Maybe a GitHub issue is appropriate, but it will hardly be implemented before SFML 2.1 :)
Title: Re: Configuring SoundRecorder processing frequency
Post by: torokati44 on January 01, 2013, 02:37:03 pm
Oh, okay, sorry.
I have searched for it before posting, but maybe with the wrong keywords, because I didn't find these.
Sorry for bothering again!
I don't mind if it won't be included in the near future, I made it working for myself, just wanted to share the idea.
Title: Re: Configuring SoundRecorder processing frequency
Post by: Laurent on January 01, 2013, 03:16:09 pm
I haven't forgotten about it, but yes, you should create an issue on the tracker if it doesn't exist yet. I thought there was already one.
Title: Re: Configuring SoundRecorder processing frequency
Post by: torokati44 on January 01, 2013, 05:15:34 pm
I haven't found an issue about this in the tracker, so I've created one.