# Star Trek Soundboard with NeoTrellis

## Overview

https://youtu.be/aYbfABlNyqo

This guide shows you how to build your own [soundboard](https://en.wikipedia.org/wiki/Soundboard_(computer_program)).&nbsp;A soundboard is a set of buttons that will play sounds or music clips when the corresponding button is pressed.

This project uses the&nbsp;[NeoTrellis M4](https://www.adafruit.com/product/3938) to create a soundboard capable of playing any 32 audio clips, and puts on a good light show at the same time too!

Soundboards are commonly used for sound effects or to select various pieces of dialog on command. They are sometimes used for pranks (as in this [famous example](https://www.hollywoodreporter.com/live-feed/romney-sons-conan-mitt-snl-schwarzenegger-340670)), or by DJs to interject prerecorded sounds.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/065/680/medium800thumb/circuitpython_color_wipe_720.2018-11-12_16_18_05.jpg?1542060877)

# About the NeoTrellis M4

The NeoTrellis M4 is an all-in-one Audio board, ready to become your next synth, soundboard, drum machine, keyboard, or any other invention you'd like to adapt it for. It’s powered by the SAMD51, a Cortex M4 core running at 120 MHz, featuring a roomy 512KB of flash and 192KB of SRAM. A separate flash chip provides a full 8MB of space for files and audio clips.

On the front side is a 4x8 grid of elastomer button pads with a NeoPixel nestled in the center of each one. You can read any/all button presses simultaneously thanks to the fully diode'd matrix, and also set each button color to any of 24-bit colors.

## Parts
### Adafruit NeoTrellis M4 with Enclosure and Buttons Kit Pack

[Adafruit NeoTrellis M4 with Enclosure and Buttons Kit Pack](https://www.adafruit.com/product/4020)
So you've got a cool/witty name for your band, a Soundcloud account,&nbsp;[a 3D-printed Daft Punk helmet](https://learn.adafruit.com/3d-printed-daft-punk-helmet-with-bluetooth)...&nbsp;so what could be missing from your road to stardom? The **NeoTrellis M4 Kit...**

Out of Stock
[Buy Now](https://www.adafruit.com/product/4020)
[Related Guides to the Product](https://learn.adafruit.com/products/4020/guides)
![Demo Video of Hands pressing buttons on lit up NeoTrellis M4.](https://cdn-shop.adafruit.com/product-videos/640x480/4020-00.jpg)

### Part: Micro USB cable
quantity: 1
Standard A to micro-B USB cable - 3ft
[Micro USB cable](https://www.adafruit.com/product/592)

### Part: USB Powered Speakers
quantity: 1
Add some extra boom to your audio project with these powered loudspeakers. 
[USB Powered Speakers](https://www.adafruit.com/product/1363)

### Part: 3.5mm Male/Male Stereo Cable 
quantity: 1
Seamlessly transmit high-quality stereo audio with this 3.5mm (otherwise known as "1/8 inch") stereo cable. 
[3.5mm Male/Male Stereo Cable ](https://www.adafruit.com/product/2698)

# Star Trek Soundboard with NeoTrellis

## Prepare Audio Files

This soundboard requires 32 different audio clips. In this project we will use clips from Star Trek (the original late 1960s TV series) to demonstrate how to work with .mp3 files, resulting in a nerd-tastic tool.&nbsp;

Star Trek sounds can be purchased online [here](https://www.amazon.com/Star-Trek-Effects-Original-Soundtrack/dp/B000001P04/)&nbsp;and/or [here](https://www.amazon.com/Star-Trek-Original-Sound-Effects/dp/B000QZX0XS/).

Other audio clips can also be downloaded from sites the specialize in [Star Trek fandom](http://www.trekcore.com/audio/)&nbsp;or [celebrity impersonations](http://www.realmofdarkness.net/pc/soundboards).&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/065/828/medium800/circuitpython_SVVT8340.jpg?1542214757)

Audio files can be gathered by any means you like, but they will all need to be formatted the same way to be recognized by the NeoTrellis M4.

[See this guide on how to convert audio files](https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion/check-your-files).&nbsp;

## No Mix & Match!

Make sure your audio files are exported as **16-bit PCM WAV** at **22,050 Hz** and they are **all Stereo** or **all Mono** -_no mixing and matching, please_!

# Star Trek Soundboard with NeoTrellis

## Soundboard Code and Troubleshooting

## Navigating the NeoTrellis

To get your NeoTrellis M4 set up to run the soundboard code, follow these steps:

1) Don't forget to update the [bootloader for NeoTrellis&nbsp;](https://learn.adafruit.com/adafruit-neotrellis-m4/update-bootloader)from the&nbsp;NeoTrellis M4 guide

2) Install the [latest CircuitPython for NeoTrellis&nbsp;](https://learn.adafruit.com/adafruit-neotrellis-m4/circuitpython)from the NeoTrellis M4 guide

3) Get the [latest library pack](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/), matching your version of CircuitPython, unzip it, and drag the&nbsp;libraries you need&nbsp;over into the **/lib** folder on **CIRCUITPY**. The latest library package includes support for NeoTrellis.  
[https://github.com/adafruit/Adafruit\_CircuitPython\_Bundle/releases/](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/)

![](https://cdn-learn.adafruit.com/assets/assets/000/065/504/medium800/circuitpython_Screen_Shot_2018-11-09_at_7.14.24_PM_copy.png?1541821022)

For this project you will need the following libraries:

- **adafruit\_trellism4.mpy**
- **adafruit\_fancyled** folder
- **neopixel.mpy**
- **adafruit\_matrixkeypad.mpy**

## Add Audio

Ensure your created sound clips are numbered 01.wav to 32.wav (don't forget those leading zeroes!). They all must be 16 Bit, 22KHz WAV files in **mono (single channel audio) or stereo (2 channel audio) and cannot be mixed mono & stereo.**

Warning: 

Connect your NeoTrellis to your computer via a known good USB cable. Your operating system will show a new "thumb drive" named&nbsp; **CIRCUITPY** is available. If you do not see this happening, visit the [NeoTrellis M4 introductory tutorial](https://learn.adafruit.com/adafruit-neotrellis-m4) to ensure CircuitPython has been loaded onto the device.

Next, in your file explorer/Finder, create a folder on the&nbsp; **CIRCUITPY** &nbsp;flash drive labeled `/startrek`. You can then drag and drop your audio files into that directory (ensuring the files are named from 01.wav through 32.wav). You can change the name of the folder later in the code if you want.

![](https://cdn-learn.adafruit.com/assets/assets/000/065/834/medium800/circuitpython_IMG_9332.jpg?1542218405)

## Soundboard Code

Onto the final step, the code itself!

Copy **code.py** from the link below and put it in **CIRCUITPY** &nbsp;root directory. You can work with this code in any text editing application, or open and save with [Mu](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor) if you prefer.&nbsp;

Also copy the linked **color\_names.py** file into **CIRCUITPY** &nbsp;root directory.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoTrellis/NeoTrellis_M4_Sound_Board/code.py

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoTrellis/NeoTrellis_M4_Sound_Board/color_names.py

Your **CIRCUITPY** &nbsp;flash drive should now include the following files:

1. **code.py** main program
2. **color\_names.py** color definition file
3. **/lib** directory containing the necessary CircuitPython 4.x libraries
4. **/startrek** directory with 32 wav file audio clips named 01.wav, 02.wav, . . ., 32.wav

![](https://cdn-learn.adafruit.com/assets/assets/000/065/830/medium800thumb/circuitpython_soundboard_boot_up.jpg?1542215782)

## Boot up: Color!

Once you have all your files set up, your board should reboot and start running your code automatically.

The boot-up sequence illuminates all neopixels in a rainbow pattern, then goes dark for a second before coming back on in an array of Star Trek-inspired colors.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/065/833/medium800/circuitpython_IMG_9295.jpg?1542218379)

## Making Changes

If you'd like to change the code, you can do so as follows:

The line&nbsp;`INTRO_SWIRL = [PINK, TEAL, YELLOW]` can be changed to be any three color names listed in `color_names.py`. You can even put more color values in that file and refer to them in your code.

In the definition of `SAMPLES` near the top of the code - it lists a file name and the color of the button. Feel free to color the buttons how you wish using the color names in **color\_names.py**.

While Star Trek used lots of primary colors (as an early color TV program), your other soundboards may be different. Say, different shades of green for Teenage Mutant Turtles, etc.

![](https://cdn-learn.adafruit.com/assets/assets/000/065/771/medium800/circuitpython_IMG_9302.jpg?1542147889 Images from Star Trek, copyright by the license holder, reproduced under fair use as outlined in 17 U.S.C. 107 Educational Use.)

## Troubleshooting

You can use the serial capability in [Mu](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor) or a serial terminal program to connect to the NeoTrellis M4 to interact with the CircuitPython prompt. You can see error messages, restart the program, etc. If you use a terminal program, set it to the COM port that appears when the device is plugged in. In Windows, Device Manager will show a keyboard when NeoTrellis is plugged in. Right click, Properties, Hardware will show the COM port. Connect at 9600 baud.

**Problem:** I don't see the **CIRCUITPY** drive when I plug the NeoTrellis M4 into my computer

**Solution:** Ensure CircuitPython is installed via [this guide](https://learn.adafruit.com/adafruit-neotrellis-m4) **.**

&nbsp;

**Problem:&nbsp;** The code does not run.

**Solution:** Check the files on the **CIRCUITPY** drive. /lib should have the latest CircuitPython 4.x libraries, **/startrek** holds the 32 sound files, **code.py** and **color\_names.py** should be in the main (root) directory.

&nbsp;

**Problem:** Not enough disk space for all the files.

**Solution:** You cannot use long stereo clips or songs for each button, there is not enough flash memory space. You can reduce the number of files below 32. You can trim your clips to make them shorter. Or you can ensure all your clips are mono instead of stereo. Advanced users can remove libraries in **/lib** &nbsp;for sensors that are not used by your device to free up small amounts of flash but please do not delete any libraries used by the program or low level input/output libraries.

&nbsp;

**Problem** : My board isn't booting up!

**Solution** : Make sure your **/lib** folder is set up with the libraries in the 4.0 latest release and includes trellism4.mpy in its contents.

&nbsp;

**Problem:** I'm not hearing any sounds!

**Solution:** Check that all your files are formatted as Stereo 16-bit, 22,050Hz, PCM

&nbsp;

**Problem:** Issues playing one of the files

**Solution:** All files must be stereo or mono, one or the other, not mixed mono+stereo. Get the offending file and change to the other format in a sound editor. It is a known limitation of this project.

&nbsp;

**Problem:**

> AttributeError: 'WaveFile' object has no attribute 'channel\_count'

**Solution:** You should&nbsp;update the NeoTrellis firmware as described in&nbsp;[https://learn.adafruit.com/adafruit-neotrellis-m4/circuitpython](https://learn.adafruit.com/adafruit-neotrellis-m4/circuitpython).

# Star Trek Soundboard with NeoTrellis

## Use It!

Your soundboard is now ready to make some noise! Have fun making music, or interjecting sound effects into conversation.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/065/829/medium800thumb/circuitpython_soundboard_presses.jpg?1542214880)

Some clips are noticeably longer than others, and you will notice that one button press is able to interrupt the audio clip that came before it, so you can press as messily as you like and the soundboard will keep up with you.

https://www.youtube.com/watch?v=aYbfABlNyqo

# Star Trek Soundboard with NeoTrellis

## Exploring Further

## Other Sound Sources

You can use any 32 sounds you want, so you are not limited to Star Trek. If you search the web for "Soundboard", you can find several sites that host groups of sound files.

You will most likely have to convert the files you do find to the WAV format as noted in the Prepare Audio Files section.

Some sounds may be Open Source (or Creative Commons unrestricted CC 0) and others may be commercial. If you want to use your soundboard in a commercial way or to record on Youtube, it is best you either use unrestricted sounds or buy a license for the material you use. This is the reason in this tutorial we state the Star Trek sounds may be purchased via CD or download.

Adafruit is collecting [unrestricted sounds on GitHub](https://github.com/adafruit/Adafruit-Sound-Samples) for Trellis use. There are also sites with unrestricted samples such as [freesound.org](https://freesound.org/) you may wish to look through.

## Recording Your Own Custom Sounds

If you'd like to create your own custom soundboard, you can use your phone to record audio clips and load those onto your NeoTrellis!

Any recording app will work to gather sound clips, and a portable microphone is nice as well (though not necessary!)

![](https://cdn-learn.adafruit.com/assets/assets/000/065/491/medium800/circuitpython_IMG_9149.jpg?1541799251)

## Custom Colors

You can change the soundboard to have any array of custom colors you want.

Do this by editing the `color_names.py` file to update or add colors, then updating the `code.py` file to assign colors to any of the 32 buttons in the array.


## Featured Products

### Adafruit NeoTrellis M4 with Enclosure and Buttons Kit Pack

[Adafruit NeoTrellis M4 with Enclosure and Buttons Kit Pack](https://www.adafruit.com/product/4020)
So you've got a cool/witty name for your band, a Soundcloud account,&nbsp;[a 3D-printed Daft Punk helmet](https://learn.adafruit.com/3d-printed-daft-punk-helmet-with-bluetooth)...&nbsp;so what could be missing from your road to stardom? The **NeoTrellis M4 Kit...**

Out of Stock
[Buy Now](https://www.adafruit.com/product/4020)
[Related Guides to the Product](https://learn.adafruit.com/products/4020/guides)
### Adafruit NeoTrellis M4 Mainboard - featuring SAMD51

[Adafruit NeoTrellis M4 Mainboard - featuring SAMD51](https://www.adafruit.com/product/3938)
We got a big ol' blender and tossed in an ItsyBitsy M4, two NeoTrellis boards and an electret mic amp - turned on the 'mix' button and out came the NeoTrellis M4 - a super fun dev board for anyone who likes to squish buttons, see pretty lights and maybe make a tune or...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3938)
[Related Guides to the Product](https://learn.adafruit.com/products/3938/guides)
### Silicone Elastomer 4x4 Button Keypad - for 3mm LEDs

[Silicone Elastomer 4x4 Button Keypad - for 3mm LEDs](https://www.adafruit.com/product/1611)
So squishy! These silicone elastomer keypads are just waiting for your fingers to press them. Go ahead, squish all you like! (They're durable and easy to clean, just wipe with mild soap and water) These are just like the light up rubber buttons you find on stuff like appliances and tools,...

In Stock
[Buy Now](https://www.adafruit.com/product/1611)
[Related Guides to the Product](https://learn.adafruit.com/products/1611/guides)
### NeoTrellis M4 Acrylic Enclosure Kit

[NeoTrellis M4 Acrylic Enclosure Kit](https://www.adafruit.com/product/3963)
So you've got your&nbsp;[Adafruit NeoTrellis M4](https://www.adafruit.com/product/3938), a cool/witty name for your band, a Soundcloud account,&nbsp;[a 3D-printed Daft Punk helmet](https://learn.adafruit.com/3d-printed-daft-punk-helmet-with-bluetooth)...&nbsp;so what...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3963)
[Related Guides to the Product](https://learn.adafruit.com/products/3963/guides)
### STEMMA Cable - 4 Pin JST-PH 2mm Cable–Female/Female

[STEMMA Cable - 4 Pin JST-PH 2mm Cable–Female/Female](https://www.adafruit.com/product/3568)
This 4-wire cable is a little over 150mm / 6" long and fitted with JST-PH female 4-pin connectors on each end. These types of JST cables are commonly found on small rechargeable battery packs, RC receivers and transmitters, tiny cameras, and other small electronic devices

We're...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3568)
[Related Guides to the Product](https://learn.adafruit.com/products/3568/guides)
### Analog Potentiometer Volume Adjustable TRRS Headset

[Analog Potentiometer Volume Adjustable TRRS Headset](https://www.adafruit.com/product/3959)
Most modern headphone sets are purely digital - with three volume control buttons in-line with the cable. These headphones are interesting in that they have an _analog_ volume control potentiometer. Perfect for use with electronic projects that don't have volume control, or for...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3959)
[Related Guides to the Product](https://learn.adafruit.com/products/3959/guides)
### Cell-phone TRRS Headset - Earbud Headphones w/ Microphone

[Cell-phone TRRS Headset - Earbud Headphones w/ Microphone](https://www.adafruit.com/product/1966)
These earbud headphones are the perfect accessory for your FONA - they've been tested to work with our modules - but can be used with any iOS or Android device that uses a TRRS pinout.&nbsp; The buds themselves are&nbsp;16mm in diameter with a nice 40" long. &nbsp;They come with a...

In Stock
[Buy Now](https://www.adafruit.com/product/1966)
[Related Guides to the Product](https://learn.adafruit.com/products/1966/guides)
### USB Powered Speakers

[USB Powered Speakers](https://www.adafruit.com/product/1363)
Add some extra boom to your audio project with these powered loudspeakers. We sampled half a dozen different models to find ones with a good frequency response, so you'll get quality audio output for music playback. Simply connect the standard 3.5mm stereo plug into your Raspberry Pi model...

In Stock
[Buy Now](https://www.adafruit.com/product/1363)
[Related Guides to the Product](https://learn.adafruit.com/products/1363/guides)

## Related Guides

- [Adafruit NeoTrellis M4 Express](https://learn.adafruit.com/adafruit-neotrellis-m4.md)
- [NeoTrellis MIDI Feedback Controller](https://learn.adafruit.com/neotrellis-midi-feedback-controller.md)
- [Neotrellis M4 Live Launcher](https://learn.adafruit.com/neotrellis-live-launcher.md)
- [FlappyBird Game for NeoTrellis M4 in CircuitPython](https://learn.adafruit.com/circuitpython-neotrellism4-flappybird.md)
- [Program CircuitPython USB Devices with iPhone & iPad](https://learn.adafruit.com/use-circuitpython-devices-with-iphone-ipad.md)
- [Mu Keyboard Shortcut Cheat Sheets](https://learn.adafruit.com/mu-keyboard-shortcut-cheat-sheets.md)
- [Ambient Color Control Pad](https://learn.adafruit.com/ambient-color-controller.md)
- [ABC Soundboards with NeoTrellis](https://learn.adafruit.com/abc-soundboards-with-neotrellis.md)
- [Christmas Soundboard with NeoTrellis M4](https://learn.adafruit.com/xmas-sound-board.md)
- [Trellis M4 Beat Sequencers](https://learn.adafruit.com/trellis-m4-beat-sequencer.md)
- [Trellis M4 Audio Filter Visualizer](https://learn.adafruit.com/trellis-m4-audio-visualizer-and-filter.md)
- [Launch Deck Trellis M4](https://learn.adafruit.com/launch-deck-trellis-m4.md)
- [iPad Pro Bumper](https://learn.adafruit.com/ipad-pro-bumper.md)
- [NeoTrellis Tabletop RPG Soundboard](https://learn.adafruit.com/neotrellis-dungeon-crawl-soundboard.md)
- [What is Web MIDI & BLE MIDI?](https://learn.adafruit.com/web-ble-midi.md)
- [Cartoon Character Clock](https://learn.adafruit.com/cartoon-character-clock.md)
