dreamlayers/synaesthesia

Framerate limit in version 20221112

ra-om opened this issue · 3 comments

ra-om commented

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

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.

795788a adds a FPS setting.

ra-om commented

Amazing, Thank you! also for the explanation.