Waifu_AI_Vtuber is a Python-based AI virtual YouTuber chatbot. The chatbot interacts with live YouTube chat, processes the messages, generates responses using the OpenAI GPT-3.5 model, and provides text-to-speech audio output for responses using VoiceVox engine.
- Real-time interaction with YouTube live chat.
- Utilizes OpenAI GPT-3.5 model for generating chat responses.
- Converts generated responses into Japanese text-to-speech audio.
- Creates subtitle files in any language that can be used in obs.
- Customizable character names and their prompt.
- Python Version 3.11. Download it here.
- API keys from OpenAI and AssemblyAI, you can get it from here OpenAI, AssemblyAI.
- VoiceMeeter banana Download it here, installed and running
- Voicevox software Version 0.14.7 or higher. Download it here, installed and running
- EarTrumpet Download it here, installed and running.
- Open Broadcaster Software. Download it here.
- Vtuber Studio. Download it here
-
Download OBS, Vtuber studio, EarTrumpet, VoiceMeeter banana(after you install VoiceMeeter banana you'll also need to restart your PC) and open VoiceVox.
-
For VoiceMeeter banana, we need to change voice output and voice input first.
-
Open the Control Panel by pressing the
Windows key
and typingControl Panel
. In the upper right corner, click onView by
and selectLarge icon
. -
Click on
Sound
, scroll down until you seeVoiceMeeter Input
, and then click on it. Finally, clickSet Default
. -
Click on
Recording
at the top, scroll down until you seeVoiceMeeter Aux Output
, click on it, and then clickSet Default
. -
The first time the program is opened, it would look like this.
-
Click on each
A1
to deselect them on all five panels. Similarly, do the same withB1
. It should now look like this. -
On the upper right corner, click on
A1
and select your speaker output (WDM is recommended). -
Now, click on
A1
for all VIRTUAL INPUTS. However, for VOICEMEETER AUX, you'll also need to click onB1
.
-
-
For Vtuber Studio.
-
Open the settings by double-clicking on the screen and then click on the gear icon located on the left side.
-
Scrolldown until you see
Microphone Setting
checkUse microphone
and selectVoiceMeeter Output (VB-Audio VoiceMeeter VAIO)
by clicking on theMicrophone
. -
Go to Model setting at the top left corner(a people icon with a gear). Scroll down until you see
Mouth Open
. Click oninput
and select or typeVoiceVolumePlusMouthOpen
. -
Optional: In
Microphone Setting
, I recommend settingVolume gain
to 20 and everything else is set to 0.
-
-
For OBS, we'll add subtitles to display the text, and for Vtuber studio, we'll use it to show Live2D.
-
To add a subtitle, press
+
in the source, selectText(GDI+)
, and name it asSubtitle
. -
After adding the text source, a window will appear like this. You'll need to check
Read from file
and then clickBrowse
. -
Navigate to
subtitle.txt
, which is located inside thetext_log
folder, and select it. -
Customize and configure the subtitle file according to your preferences, (For my recommendation, I suggest reducing the size of the text, setting
Alignment
to center andVerticle alignment
to center, right-clicking on the text, navigating toTranform
and selectingCenter Horizontally
. Also, checkOutline
, set the outline size to 10-14, and change the outline color to black by clicking onSelect color
). -
To add Vtuber Studio, press
+
in the source, selectWindow Capture
and name it asLive2D
-
After adding the video source, a window will appear like this. Click on
Window
, select[VTube Studio.exe]: VTube Studio
, onCapture Method
chooseWindows 10 (1903 and up)
, and then clickOK
. -
Right-click on the preview screen, choose
Windowed Projector (Preview)
, and resize it as your desire.
-
-
Running the code, open EarTrumpet and scroll down to the bottom you'll see
VoiceMeeter Input (VB-Audio VoiceMeeter VAIO)
, right click onPython 3.11.xx
and click onchange
icon, selectVoiceMeeter Aux Input (VB-Audio VoiceMeeter AUX VAIO)
. -
Change your
playback/output device
by clicking on the speaker icon on the taskbar (or go towindow setting
->System
->Sound
->Choose your output device
). SelectVoiceMeeter Aux Input (VB-Audio VoiceMeeter AUX VAIO)
first and then selcetVoiceMeeter Input (VB-Audio VoiceMeeter VAIO)
(we need to do this process to let Python recognize these playback devices). -
In Vtuber Studio, open the settings, navigate to
Microphone Setting
and click onReload
. -
Download the project zip file from GitHub or Clone this repository by typing these in terminal or command prompt (but if you choose to download the project as a zip file you'll also need to extract the zip file).
git clone https://github.com/ZeroMirai/VirtuAI-Helper.git
-
Open a terminal or command prompt and change the directory to the project folder by typing
cd
followed by where this folder is located for examplecd C:\Git_hub\VirtuAI Helper
. -
Install all necessary library by typing.
pip install -r requirements.txt
- Configure the necessary API keys and other config in config.txt.
- π
functions
: Contains modular components of the project.- π
keys
: folder to contain API keys.- π
api_key_chat
: File to store configuration for chatGPT's API keys.
- π
- π
chatbot.py
: Code to interact with the OpenAI GPT-3.5 model to create responses. - π
create_subtitle.py
: Code to generate subtitle files to use in obs. - π
tts.py
: Code for text-to-speech using Voicevox.
- π
- π
main.py
: Main code for the AI virtual YouTuber chatbot. - π
youtube_chat.py
: Code to read and process YouTube live chat messages.
Before running the program, Ensure you have changed all the configurations and pasted them right after the : in the file. The file must have the following format.
- Configure API keys and settings in the code files as specified in the comments in
api_key_chat.py
to generate chat responses andyoutube_chat.py
to capture a youtube live chat. - Update
main.py
with the character's name. - Update
youtube_chat.py
, invideo_id
get your video id at your youtube live url and paste it here. For examplehttps://www.youtube.com/watch?v=CSdEsXa
your video id isCSdEsXa
. - you can create your own AI personality by changing the prompt in the
RoleAndStory.txt
but don't change the rule part (if you are too lazy to write your own prompt you can also ask chatGPT to make your own one by asking).Generate me a prompt so I can use with my AI assistant "that's a ..(personality,gender,traits).., ..(other personality,gender,traits).."
- Open VoiceVox engine.
- Open
run_main_script.bat
andrun_read_chat_script.bat
.
Actually, this is a project that's made just for fun but if you are interested to contribute in this project here is how you can make this project better for everyone:
If you found a bug or have an idea for a new feature, feel free to requests and reports by open an issue on GitHub and post it if it's a bug please give as much detail as possible or suggest an idea please include a step or a clear description.
If you have suggestions or improvements.
- Fork the repository and create your own branch from
main
. - Work on your changes.
- Write clear, concise commit messages that describe the purpose of your changes.
- Open a pull request and provide a detailed description of your changes.
I'm primarily looking for code improvements and bug fixes. Once your changes are approved, they will be merged into the main project.
If you find this project useful I would be really grateful if you could consider sharing this small project with others and giving it a star on GitHub.
- Running main.py and youtube_chat.py simultaneously is necessary for the chatbot to function correctly.
- Make sure you have the required dependencies and API keys set up before running the code.
- If text in obs is not showing, make sure you place the Subtitle source above the Live2D source.
- Ensure that you have the required dependencies and configuration set up before running the code.
- Running the program and VoiceVox engine simultaneously is necessary for proper program functionality.
- You need to redo steps 5-7 every time the program is opened.
This project is licensed under the MIT License.
- Pytchat - Used for real-time YouTube chat interaction. For more information, visit Pytchat
- OpenAI - Used to generate responses with the chatGPT model. For more information, visit OpenAI API
- Voicevox by Hiroshiba - Used to synthesize speech in Japanese. For more information, visit VoiceVox Engine
Special thanks to Neuro-sama, who inspired me to start learning how to code and create my own waifu.