w-okada / voice-changer

リアルタイムボイスチェンジャー Realtime Voice Changer
Other
16.4k stars 1.8k forks source link

Non-matching sample rate causes gaps #223

Closed MysteryPancake closed 1 year ago

MysteryPancake commented 1 year ago

My microphone has a sample rate of 48,000 Hz The model I'm using has a sample rate of 40,000 Hz.

I notice there are regular gaps in the output, even though my res time is much less than buf time. This occurs when recording as well. The recording stays at 40,000, which causes it to go out of time. The pitch also doesn't match up, it is a few semitones off (about as much as the sample rate difference).

I suspect this may be an issue due to the sample rate mismatch not being handled.

w-okada commented 1 year ago

Which VC do you use? RVC or so vits svc? Both of them, I convert sampe rate. https://github.com/w-okada/voice-changer/blob/e6938250b6a01920918006c27691dbbbd5f1aeba/server/voice_changer/VoiceChanger.py#L381

MysteryPancake commented 1 year ago

I tried both, RVC and So-Vits 4. I noticed it happens even when the original model has a matching sample rate.

This may be helpful: I tried resampling my input recording from 48,000Hz to 44,100Hz. This decreases the pitch by to 85%. When using this file in the AudioInput section, the output (with gaps removed) sounds completely correct.

I suspect it's due to the way Chromium handles sample rates, since this app uses Electron.

MysteryPancake commented 1 year ago

This only affects "client device", "server device" works perfectly. I will use it instead for now :)

w-okada commented 1 year ago

OK. Close this issue.