Using custom audio
This tutorial shows how to upload your own audio files to QTrobot Studio and play them in a game using the Show Plays Act Block.
Prerequisites
Your first game — you know how to create a game, add blocks, and run it.
Uploading audio files
Before using an audio file in a game, upload it to Studio:
- Click Audios in the Studio top menu.
- Create a folder — this name becomes the Base path for audios in your Start Block.
- Upload your audio files (
.mp3or.wav) into that folder.
In your Start Block, set Base path for audios to the folder name you just created.
Playing audio in a game
Use the Show Plays Act Block from the Blocks category to play an audio file. This block plays the audio while optionally showing a facial expression and a gesture at the same time — the three actions run in parallel.
- Set the audio name field to the filename without extension (e.g.
song-1for a file namedsong-1.mp3). - Optionally drag a Face block into the face slot and a Gesture block into the gesture slot.
Here is an example that plays a song while QTrobot shows a happy expression and claps:
In this example, the Base path for audios in the Start Block is audios, and the audio file is audios/song-1.mp3 on the robot. QTrobot plays the audio in full before the game moves to the next block.
You can mix Show Says Act blocks (for speech) with Show Plays Act blocks (for audio files) in the same game to combine QTrobot's voice with your own recorded audio.
Next steps
Continue with Recording gestures to learn how to create and use custom gestures.