diff --git a/Playing-Audio-Files.md b/Playing-Audio-Files.md index 4d61193..d82c6ba 100644 --- a/Playing-Audio-Files.md +++ b/Playing-Audio-Files.md @@ -1,15 +1,11 @@ -. - -### Introduction +## Introduction FTC Blocks can play short sounds on Robot Controller (RC) phones and Driver Station (DS) devices. Here's a general guide to this fun and useful feature. A [different tutorial](https://github.com/WestsideRobotics/FTC-DS-Speech/wiki) covers Text-to-Speech Telemetry that plays only on the DS phone or Driver Hub -- also a fun and useful feature. -*** - -### Step 1 - Audio Files +## Step 1 - Audio Files Find or record your sound files. Blocks can play audio files in the popular **.wav** and **.mp3** formats. Some short samples are posted [here](https://github.com/FIRST-Tech-Challenge/WikiSupport/tree/master/FTC-sound-files). Click a file name and then the `Download` button. @@ -21,7 +17,7 @@ In Windows, the Sound Recorder program creates .wma files. Many free websites l [

Return to Top](#introduction)

-### Step 2 - My Sounds +## Step 2 - My Sounds In the top-level Blocks interface (list of OpModes), click on "**Sounds**" at the right side of the screen. @@ -33,7 +29,7 @@ This open a new Chrome tab called **My Sounds**, where you can upload and manage [

Return to Top](#introduction)

-### Step 3 - SoundPool Menu +## Step 3 - SoundPool Menu Leave the My Sounds tab open, and return to the first Chrome tab. Open a Blocks OpMode (old or new). At the left side, look under Android, and **SoundPool**. @@ -41,15 +37,15 @@ Leave the My Sounds tab open, and return to the first Chrome tab. Open a Blocks [

Return to Top](#introduction)

-### Step 4 - Initialize SoundPool +## Step 4 - Initialize SoundPool -It's best to do this before waitForStart, to save time later. +It's best to do this before `waitForStart`, to save time later.

[[/images/Playing-Audio-Files/0140-initialize-SoundPool.png|]]

[

Return to Top](#introduction)

-### Step 5 - Preload Sound +## Step 5 - Preload Sound **Optional** to preload the sound file, which theoretically improves response for larger files. This is done with a **Repeat** Loop. Change the '**while**' to '**until**', and attach one of the **preloadSound** Blocks. There's one for the SoundResource class which (in 2019-2020) contains the memorable (!) Skystone sounds, and the other is for your own previously uploaded sound files. @@ -67,7 +63,7 @@ For safety and convenience, add a secondary condition to the Repeat Until loop: [

Return to Top](#introduction)

-### Step 6 - Play Sound +## Step 6 - Play Sound Now add the play Block where desired. Again, enter the exact audio filename. @@ -91,7 +87,7 @@ Right-click on any column heading, and choose "Length" (not "Duration"). This h [

Return to Top](#introduction)

-### Use in Development +## Use in Development Sounds can be a very useful tool for programming and debugging. They can mark the transition from one autonomous action to another, often very hard to see. Different sounds can indicate certain conditions, such as encoder ranges or sensor values, or different stages in the program. Sometimes the robot is executing an unexpected or unknown operation, easily identified with a unique sound. @@ -101,7 +97,7 @@ Sounds are most practical in a test environment, without the extreme noise of a [

Return to Top](#introduction)

-### SoundPool Options +## SoundPool Options Review the **optional** green Blocks to adjust volume, rate and looping. Hover the cursor over each Block for instructions. @@ -111,9 +107,9 @@ Make these settings **before** playing the audio file. [

Return to Top](#introduction)

-### Other Notes +## Other Notes -The sound plays back on **both** RC phones and DS devices. Make sure the device **audio** volume is set high, not just the ringtone volume. Note that the REV Control Hub has no speakers. +The sound plays back on **both** RC phone and DS device. Make sure the device **audio** volume is set high, not just the ringtone volume. Note that the REV Control Hub has no speakers. The **.stop** command simply stops a currently playing sound file. It does not permanently disable SoundPool. @@ -127,7 +123,7 @@ Special note... you may find that Android does not load or play the audio files [

Return to Top](#introduction)

-### Longer Playbacks +## Longer Playbacks Some users have trouble playing audio files longer than about 6 seconds.