tlecomte / friture

Real-time audio visualizations (spectrum, spectrogram, etc.)
http://friture.org
GNU General Public License v3.0
877 stars 158 forks source link

Support alternative sampling rates/frame count. #146

Open zealws opened 3 years ago

zealws commented 3 years ago

At present friture only runs with a sampling rate of 48khz and exactly 512 frames/period.

However, it should be possible for friture to dynamically detect the sampling rate/frame count from the device itself. There's even a comment in the friture source code to that effect:

# the sample rate below should be dynamic, taken from PyAudio/PortAudio
SAMPLING_RATE = 48000
FRAMES_PER_BUFFER = 512

Seems like maybe this was a FIXME in the code that was never followed-up on, so I wanted to raise this as an issue.

Also the error message when you switch to a device with an invalid sampling rate is very opaque. A window entitled Input device error appears with this error message:

Impossible to use the selected input device, reverting to the previous one

It'd be nice if friture could catch the python error printed on the command line and surface that in the UI.

tzugen commented 1 year ago

I am trying to use Friture to graph ultrasonic frequencies. I have manually changed the sampling rate in the code, but the display is still limited to around 20khz. Anyone has some pointers?