SFML community forums
Help => Audio => Topic started by: kobilica on December 22, 2011, 11:06:23 pm
-
Hello, this code:
class Recorder : public sf::SoundRecorder
{
virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount)
{
cout << *(Samples+1000) << "\n";
return true;
}
};
Outputs me (from console) this kind of numbers:
0
-6
4
1
-8
-4
0
9
-2
7
-3
-3
2
-8
-5
-2
5
6
-4
-2
-7
-1
6
2
-15
-8
-4
-2
-2
2
-1
2
-1
-1
0
3
-5
-3
no matter what, if audio is playing or not, numbers are same.
I have X-FI, and I use "What u hear" as a recording input.
Now, what I want to know, does SFML always records from default audio device, and always records from microphone?
Hint, I want to make realtime audio visualizator.
-
Don't be afraid to use the "Edit" button, instead of creating a new thread just because you forgot to say something...
Yes, SFML always records from the default device.
-
Heh, looks like I didn't really had set up my "what u hear" device properly. It's working now, thanks.
-
Hello, I just wanted to ask, how can I speed up refresh rate? Right now it is 10 times per second, how can I make that atleast 40 times per second? Thanks.
-
The current version doesn't allow you to change the processing rate. You must change it in the SoundRecorder.cpp (there's a sf::Sleep(100) somewhere) and recompile SFML.
-
Ok, thanks, will do!
-
Hello. I have encountered new problem. I have set sf::Sleep(20), which should gave me ~882 Samples (44100/50) 50=1000ms/20ms.
But it always gives me 2205 samples, which should happen at sf::Sleep(50).
I suspect I have to change something, but don't know what.
-
Nop, it should work. Either it's what you do in OnProcessSamples which takes these extra 30 ms, or it's your OS' scheduler that has a very high resolution.
-
I have sf::Clock, which resets at begining of OnProcessSamples and outputs number at end of it. It takes only 2ms max to process everything.
So, it's my OS scheduler thing... how can I change that? I use Win 7.
-
http://www.facebook.com/photo.php?v=3034090137048
Also, FFT is working!
-
Windows 7 is not supposed to have such a bad resolution. Can you try sf::Sleep with different numbers? Like 1, 5, 10, 15, ...
-
I will. Gonna report soon 8)
-
No difference. Still 2205 Samples.
-
Hmm... Maybe an internal limitation in OpenAL.
-
so is there any posibilities that i speed up this? should i recompile openal or something?
-
I don't know, I have to do some tests and investigations.
-
Ok sweet! Then I will continue developing and then later update sfml. It would be nice, if you could run onprocesssamples every so captured samples (like every 2048 samples)
-
Or, don't stretch yourself much, I found CLAM library, gonna try infuse it with SFML.
-
Or I could use little help :lol: I really need to speed up this, I don't want to mess with CLAM yet.
-
Sorry but I won't have the time to investigate this now. I'm very busy with the release of SFML 2.