Make a directory inside your “tessel-code” folder called “audio”, change directory into that folder, and initialize a tessel project:
mkdir audio; cd audio; t2 init
Download this mp3 into the “audio” directory, this will be the audio file we manipulate.
In order to include static, non-require-dependency resources in your deployment, you’ll need to explicitly inform Tessel’s CLI. To do this, create a
.tesselinclude file in your
audio directory. In that file, type the name of the static asset that should be deployed with the project. For this project, your
.tesselinclude will have at least the following in it:
(Learn more about Tessel CLI deployment tips and tricks in the docs)
Plug Tessel into your computer via USB, then plug the audio module into either of Tessel’s USB ports. You will also need some kind of speaker output, headphones or desk speakers will do the trick.
Install by typing
npm install tessel-av into the command line.
Rename “index.js” to “audio.js” and replace the file’s contents with the following:
Save the file.
In your command line,
t2 run audio.js
Hooray! You should hear the mp3 playing in a loop!
Bonus: Try connecting buttons to your Tessel 2 and use them to control playback. Hint: it may help to look for the NPM module
Extra bonus: Load many mp3s onto a USB storage drive and playback from that source. Hint: check out the “storage” tutorial on the left sidebar.
To see what else you can do with the USB audio module, read the tessel-av documentation.