grame-cncm / faustlive

Advanced self-contained prototyping environment for the Faust programming language
Other
80 stars 18 forks source link

Cannot change FaustLive sampling rate on Windows #35

Open nyanpasu64 opened 4 years ago

nyanpasu64 commented 4 years ago

I'm running Windows 10 1909, and FaustLive 2.14.4.

image

If I change the sampling rate, either with a patch open or not, reopening the Preferences dialog reveals the sampling rate is still at 44100 Hz. And setting the sampling rate to 1000-8000 Hz does not muffle synthesizer files as expected, meaning the sampling rate does not take effect.

sletz commented 4 years ago

What is the actual audio interface you are using ? You may have to change the sampling rate directly on it (that is using a configuration tool that is part of the audio interface).

nyanpasu64 commented 4 years ago

My default audio input is a VB-Audio cable running at either 32000 Hz or 96000 Hz. My default audio output is a Realtek interface set to either 48000 Hz or 96000 Hz. No matter what combination I pick, FaustLive's preferences panel claims it's running at 44100 Hz.

sletz commented 4 years ago

Then I guess it is a limitation of the PortAudio layer we are using to to access audio card. Nothing easy we can do since AFAICS PortAudio does not have any resampling feature.

nyanpasu64 commented 4 years ago

I enabled the sampling rate printout in my patch, and found that the patch is indeed running at 44100 Hz both before and configuring FaustLive to use 96000 instead.

I think it's more a result of how you're using PortAudio, than a limitation of PortAudio itself. 44100 comes up several times in the source code in src/Audio/PA used to configure PortAudio. I theorize that when FaustLive runs at 44100 Hz, Windows resamples all input-device audio to 44100 Hz before sending it to Faust, then resamples Faust's 44100 Hz output to the currently configured output-device rate.

I'll look more into this once I get FaustLive to build.

sletz commented 4 years ago

OK, the PortAudio code in FL is there : https://github.com/grame-cncm/faustlive/tree/master/src/Audio/PA and it also uses a PortAudio file which is part of the Faust repository here: https://github.com/grame-cncm/faust/blob/master-dev/architecture/faust/audio/portaudio-dsp.h