Changing the volume on the Touch Board
Is your Touch Board too quiet or too loud? You’re in the right place learn how to adjust the volume.
The Touch Board uses an onboard chip to play back MP3 files. This chip has an onboard digital volume control that you can use to adjust the volume to a level that you are happy with. In this tutorial, we’ll show you how to adjust this in code.
Learn how to connect to your board's capacitive sensors
Done with the Audio Guide? Follow this quick tutorial to customise your sounds and load your own MP3s.
An A to Z on setting up your Touch Board, changing the sounds, and creating an interactive surface with Electric Paint.
To begin you will need:
1 x Touch Board
1 x USB A to Micro B cable
1 x Computer running Mac OSX,
Windows or Linux
1 x Micro SD card with MP3 tracks
1 x Headphones or speakers
Changing the volume
This is an easy, one-step tutorial! First, we’re assuming that you have set up Arduino to work with your Touch Board on your computer. If not, follow the link below, complete that tutorial and come back when you’re done.
Changing the volume on the Touch Board is as simple as adding the line: MP3player.setVolume(X,Y); to your code, where X is the left channel volume and Y is the right channel volume. Lower values represent higher volumes, so MP3player.setVolume(0,0); will set the volume to maximum on both channels, and MP3player.setVolume(254,0); will set the left channel to be silent, with the right channel at maximum volume. This can go anywhere in the code, provided that it is AFTER the MP3player.begin(); line.
Don’t forget to upload the modified code to the board in order to see the changes.
For the technically minded, the volume units are -0.5dB per count, so a value of 40 sets the volume to -20dB (with respect to maximum).