For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tutorial 4: Adding Voices

In tutorials 2 and 3 you created tasks that included dialogue between three NPCs. Bitpart supports adding audio files for those dialogue lines— either pre-recorded by actors or generated through platforms like ElevenLabs or Inworld. This tutorial uses our example audio generation script that you'll run via the command line to generate audio from either Inworld or Elevenlabs.

Resources you'll need for this tutorial:

  1. API Key for Inworld or ElevenLabs

  2. Utterance CSV from Tutorial 3

If you have questions that are not answered by our documentation, join our Discord server and post in #support.

Creating the Tutorial Audio Folder [0:36-1:01]

  1. Create a folder on your computer and name it Bitpart Tutorial Audio.

  2. Drag the utterance CSV file you generated at the end of tutorial 3 into this folder. If you open the CSV you will see it contains a list of all the dialogue lines in your project. There should be two copies of all the bar patron lines— one for each instance of the role. The last column in this spreadsheet is named file name. This field is asking for the file path on your computer where the audio recording of that line is stored. We don't need to do anything with it yet. Close the CSV file.

Setup [1:02-2:43]

  1. Clone the Bitpart-cli public repo: https://github.com/bitpart-ai/bitpart-cli.

  2. Open Windows PowerShell.

  3. Change the directory to the bitpart-cli repo. Find the repo in File Explorer, copy the path, and type cd with the path pasted directly after it. If there are any spaces in the path, you'll need to use quotations around it. It might look something like this: cd "C:\unreal repos\bitpart-cli" . Hit Enter.

  4. Create a virtual environment. This keeps packages in the project and avoids Windows long-path issues.

    1. Type this command and hit enter: python -m venv venv

    2. Type this command hit enter: .\venv\Scripts\Activate.ps1

  5. Your prompt will show (venv) in green when it's active.

  6. Install dependencies by entering this command: pip install -e .

  7. The Bitpart-CLI repo includes a file called .env.local. Open it. This file stores your API key for ElevenLabs or Inworld. Input your API key for the provider you want to use. For example: Inworld_API_Key=E123456789

Assign Voice IDs to Characters [2:44-4:05]

  1. In the power shell type: bitpart tts "path\to\utterances.csv" --project Tutorial --init --provider inworld

    1. Replace "path\to\utterances.csv" with the path to the utterances file in your Tutorial Audio Folder. If you right click on the utterances csv and select copy as file path you can past that path directly into the power shell.

    2. If you are using Elevenlabs, replace the word inworld after provider with elevenlabs.

  2. Hit enter. This command scans the utterances CSV file, collects unique character_name values, and writes a skeleton character_voices file with empty voice_ids you can fill in. This file will be added to the Bitpart Tutorial Audio folder.

  3. Open your character_voices.json file. There will be a section of the file for each NPC who has dialogue in your project and a space to fill in the voice ID you would like to use. Here are some suggested IDs for each character:

    1. BarPatron1:

      1. Inworld: Lucian

      2. ElevenLabs: yhf80q1381zd2JJQ4tM7

    2. BarPatron2:

      1. Inworld: Duncan

      2. ElevenLabs: 7rQX8r6PVq3gfJ8rZzyE

    3. Barkeep:

      1. Inworld: Graham

      2. ElevenLabs: NNl6r8mD7vthiJatiJt1

  4. Here's an example of what the finished JSON file could look like:

  1. Save the file.

Generate Audio Files [4:06-5:11]

  1. In the power shell, type bitpart tts "path\to\utterances.csv" --project Tutorial --provider inworld Remember to replace "path\to\utterances.csv" with the path to your utterances CSV, and if you're using ElevenLabs, replace Inworld with elevenlabs. If you want to verify that everything is set up correctly before running the full generation process, append --limit 1 to the command.

  2. Hit Enter. This command will call Inworld’s API and generate audio files for each line, using the voices specified in your character voices JSON file. As soon as generation is complete, you’ll see a message confirming how many lines were generated and how many, if any, failed to generate. If you get a 401 you may have forgotten to add your API keys to .envlocal.

  3. Open the Bitpart Tutorial Audio Folder. You should see all the generated audio files in this folder. Open the CSV file and note that the csv has been updated to include the file paths for each audio file. If you were using lines recorded by voice actors instead of completing the steps outlined above, you would open the utterances csv and add the file paths on your computer where each of the recorded lines is stored.

Update Data Assets in Unreal [5:12-7:52]

  1. Go back into your Unreal project. In the content browser, navigate to Bitpart Archetypes → Tutorial.

  2. Open the DT_TutorialUtterances data table. Switch tabs to the Data Table Details and under source file and point the source file at the version of your utterances CSV that is in Bitpart Tutorial Audio. Click Reimport. You should now see the File Name column filled out. Save and close the asset.

  3. Right click on DT_TutorialUtterances and select the Bitpart action Import Utterances. Select the Tutorial Folder as the target folder and click Import Utterances.

  4. Once the import completes, you’ll see new sub folders have been added to the Tutorial Folder, one for each NPC with dialogue lines. If you click into each one you’ll see the audio files for each line have been added.

  5. Search for BP_NPC_Patron in the content browser. Duplicate the blueprint. In your new BP_NPC_Patron2 open the Bitpart Character Component. In the details panel on the right, under the utterance section, assign DA_BarPatron2. This will ensure each of your bar patrons has a unique voice. Compile, save, and close the asset.

  6. Finally, update the Town Cast Spawner to spawn the BP_NPC_Patron2 into the bar. Click into the spawner and under Cast to Spawn find the element that is currently pointed at the BarPatron2 Target Point. Update the Pawn Class to BP_NPC_Patron2.

Click Play to see your content running with audio.

Last updated