

Setup a variable to hold the audio instance: AudioClass *theAudio

In this case, as with most filesystems, the Directory is just a special file on disk. You can only have one file open at a time. If (!entry.isDirectory() & entryName.endsWith(endTest) & !entryName.equals("init.mp3")) Read in the files and put them in an array for processing later: void getQuips(File dir, int numTabs) Open the root directory on the SD card" Serial.println("Reading available quips from the SD card.") Setup a variable to hold File information: File myDir
#MAGIC 8 BALL ANSWERS HOW TO#
Setup a variable that will understand how to access the SD card: SDClass theSD It didn't seem to matter what I had set for the sampling rate or channel type, the MP3s would not play correctly until used the bitrates as mentioned above. * Search for MP3 decoder in "/mnt/sd0/BIN" directoryĮrr = theAudio->initPlayer(AudioClass::Player0, AS_CODECTYPE_MP3, "/mnt/sd0/BIN", AS_SAMPLINGRATE_AUTO, AS_CHANNEL_MONO) Stream sample rate is set to "auto detect" Here is the line that does that initialization: /* I tried a large number of options, but these are the only ones that would work with initialization settings of the player on the Spresense. I believe you should be able to have a good number of bitrates. There should be a way not to have these requirements. The thing to remember on the recordings is that when you save them they need to be in the following format: I like using Audacity and give them a shout out every chance I get.These are my own recording, so no copyright issues should arise.I used the opensource tool Audacity to record all the audio in this project. PinMode(buttonPin, INPUT) // will watch this pin to detect the button press.ĪttachInterrupt(buttonPin, pinIsr, CHANGE) Ĭode up the interrupt handling routine: void pinIsr() PinMode(ledPin, OUTPUT) // will raise and lower this output to toggle the LED. Initialize the pins and the interrupt to handle the button state change: // setup the button and LED 2 is used to indicate there has not been an interrupt yet Setup a variable to track the state of the button: // Variables used in interrupt service routines and other parts of the program should be volatile You should now be ready to start coding the sketchĭefine the pins the button and its LED will use: const int buttonPin = 2 // Pin used to detect a button pressĬonst int ledPin = 13 // Pin for the highside of the button LED I used some bits of Velcro to keep it from moving around. Mount the Spresense in the bottom of the enclosure.Follow the directions on assembling the Google enclosure.Shouldn't really matter as all the audio output is set to MONO for this project.

Make the black the outside(ground), and the red the very middle connection.
