Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Configuring SoundRecorder processing frequency  (Read 2847 times)

0 Members and 1 Guest are viewing this topic.

torokati44

  • Newbie
  • *
  • Posts: 14
    • View Profile
Configuring SoundRecorder processing frequency
« 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

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Configuring SoundRecorder processing frequency
« Reply #1 on: January 01, 2013, 01:53:12 pm »
This feature has already been requested (here, here or here), possibly Laurent forgot about it. Maybe a GitHub issue is appropriate, but it will hardly be implemented before SFML 2.1 :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

torokati44

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Configuring SoundRecorder processing frequency
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Configuring SoundRecorder processing frequency
« Reply #3 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.
Laurent Gomila - SFML developer

torokati44

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Configuring SoundRecorder processing frequency
« Reply #4 on: January 01, 2013, 05:15:34 pm »
I haven't found an issue about this in the tracker, so I've created one.

 

anything