JarikDem-Bot / ai-waifu

AI VTuber Waifu and voice assistant
MIT License
44 stars 5 forks source link

Invalid number of channels #4

Closed WiseKingOfUruk closed 6 months ago

WiseKingOfUruk commented 6 months ago

File "C:\Users\chibi\Desktop\Nero\main.py", line 25, in main() File "C:\Users\chibi\Desktop\Nero\main.py", line 6, in main waifu.initialize(user_input_service='whisper', File "C:\Users\chibi\Desktop\Nero\waifu.py", line 46, in initialize self.update_tts(service=tts_service, output_device=output_device, voice=tts_voice, model=tts_model) File "C:\Users\chibi\Desktop\Nero\waifu.py", line 99, in update_tts sd.check_output_settings(output_device) File "C:\Python\lib\site-packages\sounddevice.py", line 697, in check_output_settings _check(_lib.Pa_IsFormatSupported(_ffi.NULL, parameters, samplerate)) File "C:\Python\lib\site-packages\sounddevice.py", line 2747, in _check raise PortAudioError(errormsg, err) sounddevice.PortAudioError: Invalid number of channels [PaErrorCode -9998]

I'm stumped, I don't even know where to start

duckxy commented 6 months ago

Same problem Screenshot 2024-01-06 023448was

-Python ver 3.10.5 already reinstall

JarikDem-Bot commented 6 months ago

Thank you for opening the issue and contributing to this project!

I've implemented error handling. Now, before this error message will be a short explanation and device list.

To fix this:

  1. Check the list of devices that print's before an error message
  2. Find the first device that starts with CABLE Input. For me, it's CABLE Input (VB-Audio Virtual C, MME (0 in, 2 out)
  3. Copy ID of this device (it's printed before device name)
  4. Paste it as value of output_device in main.py inside initialize method

If your CABLE Input device has ID 3, update it in initialize method:

waifu.initialize(user_input_service='whisper',
                     stt_duration = None,
                     mic_index = None,

                    chatbot_service='openai',
                    chatbot_model = None,
                    chatbot_temperature = None,
                    personality_file = None,

                    tts_service='elevenlabs', 
                    output_device=3,
                    tts_voice='Rebecca - wide emotional range',
                    tts_model = None
                    )

I'm planning to add GUI in the future, so then I'll make a better way to solve it! Thanks for bringing this to my attention!

WiseKingOfUruk commented 6 months ago

I am happy to say that it worked, my value was 7, now this is supposed to work with VTubeStudio right? is there any special action I need to take to do that? since currently it's just audio.

WiseKingOfUruk commented 6 months ago

Right and does it just record until you say something? I feel like that would fill up storage real quick if it even records silence. I'm just worried about wasting my tokens.

JarikDem-Bot commented 6 months ago

I'm glad to hear that it fixed your issue!

To make Waifu work, you'll need to set a few settings in VTube Studio. You need to select CABLE Output as microphone, select preview option, and setup Mouth Open setting. You can find more detailed explanation in README file, under 6th list item in "Installation" part, there's Settings: you can click on to reveal screenshots with explanation.

Additionally, you can go through most of parameters and check the "Auto-breath" box to add idle movent for 2D avatar.

As for audio recording, that's a really important point that I've missed. Thanks for pointing this out! I'm afraid it really does record silence. Unfortunately, I'll be busy for the next few days on my work. If there's free time to spare I'll look into this issue. But it's more likely that I'll be able to fix it only on Monday

WiseKingOfUruk commented 6 months ago

image

image

I followed the instructions yet it is still unable to lipsync, also take your time with the audio recording issue most people have a keybind which records your audio, but i am more interested in simply chatting and it automatically picks up on it.

WiseKingOfUruk commented 6 months ago

Also another potential issue I found is that while you're using V-CABLE for the output, you cannot hear anything else from your computer other than the AI, no music, no videos. I'm just bringing it into your attention if you weren't aware and I was wondering if there was a possible fix for it.

EDIT: I just used a diff output other than V-CABLE to hear everything.