cfoulc / cf

mod's and modules for VCV Rack
BSD 3-Clause "New" or "Revised" License
58 stars 16 forks source link

Player version 2.0.2 plays audio at wrong speed when WAV sample rate does not match VCV sample rate #52

Open cosinekitty opened 3 months ago

cosinekitty commented 3 months ago

I noticed this while playing a 44.1 kHz recording of my voice through the Player module. My voice sounded artificially high-pitched. Then I noticed in the menu [VCV Rack / Engine / Sample rate] that my rendering sample rate was set to 48 kHz. When I changed that sample rate to 44.1 kHz to match the WAV file's sampling rate, my voice sounds correct.

It makes sense that Player is reading samples from the file and sending them to its LEFT/RIGHT output ports. When the sample rate doesn't match, the audio sounds wrong. It would be nice to resample to the target sampling rate.

I know this is not a trivial request, but as a fellow developer, I'm willing to jump in and help with the resampling changes, should you choose to do this. There are some dsp helper functions in the VCV Rack SDK that should make this mostly painless.

I will be happy to submit a PR if you are open to it. Just let me know.

strogonoff commented 1 week ago

Same issue.

I’d say resampling shouldn’t be done by default, but perhaps it could be an option. If there’s a module that can resample audio, that’d work just fine, but I couldn’t find one. I obviously can resample recorded WAVs themselves, but I’d rather not have to load a new sample in this situation…

Player’s great overall, somehow other samplers tend to be either overly complicated or not functional enough.