synaesthesia icon indicating copy to clipboard operation
synaesthesia copied to clipboard

Framerate limit in version 20221112

Open ra-om opened this issue 2 years ago • 3 comments
trafficstars

Hi, it seems the visualization display is now limited to about 43fps, whereas it used to be over 100. It looks fine as-is though. Is this intentional? Vsync is completely turned off but has no effect

ra-om avatar Dec 04 '22 19:12 ra-om

The frame rate is synchronized with audio data. The FFT (which produces the spectrum from waveform data) processes 1024 samples (NumSamples) by default. The PortAudio code gets data at inFrequency (22050 Hz by default) in chunks of half of that. Then code in soundbuf.cc creates a new visualization frame after it receives MIN_NEW_SAMPLES, which is also NumSamples/2. So: 22050 / 512 is close to 43.

Changing both the Pa_OpenStream() chunk size and MIN_NEW_SAMPLES can easily speed up visualization. I suppose this should be made customizable somehow, at least with a command line argument.

Successive frames use overlapping sound data, and speeding up frame rate increases the overlap, but it can still reveal more detail in the music.

dreamlayers avatar Dec 06 '22 23:12 dreamlayers

https://github.com/dreamlayers/synaesthesia/commit/795788a26fc9dbb807662d2f125c92c4af72ee93 adds a FPS setting.

dreamlayers avatar Dec 07 '22 05:12 dreamlayers

Amazing, Thank you! also for the explanation.

ra-om avatar Dec 11 '22 22:12 ra-om