Big Mouth Billy Bass player that takes raw wavefiles and decision list text files from an SD card

Dependencies:   SDFileSystem mbed BillyBass

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.hpp Source File

config.hpp

00001 #ifndef __included_config_hpp
00002 #define __included_config_hpp
00003 
00004 // configuration for Billy Bass
00005 #define MAX_FISH 2
00006 
00007 // SD card layout: all files in BASS_DIRECTORY ("/sd/SD_Files/")
00008 //
00009 // Each pair of files in that directory are named like:
00010 //      "<seqnum>_<fishnum>_filename.raw"   (16-bit mono raw little-endian samples, sample rate=SAMPLE_RATE_HZ)
00011 // and
00012 //      "<seqnum>_<fishnum>_filename.txt"   (tab-separated text file with starttime,endtime,<mouth|head|body|tail>
00013 // text files are as exported from Audacity's label tracks
00014 //
00015 #define SD_NAME "sd"
00016 #define SD_ROOT "/" SD_NAME
00017 #define BASS_DIRECTORY SD_ROOT "/SD_Files"
00018 // length of BASS_DIRECTORY without NUL
00019 #define BASS_DIRECTORY_LENGTH 12
00020 #define MAX_BASENAME_LENGTH 30
00021 #define MAX_PATH_LEN \
00022         BASS_DIRECTORY_LENGTH + 1 \
00023         + MAX_BASENAME_LENGTH + 1
00024 
00025 // limits of .txt files
00026 #define MAX_ACTIONS_LINES_PER_SONG 60
00027 #define MAX_ACTIONS_PER_SONG MAX_ACTIONS_LINES_PER_SONG*2
00028 #define MAX_TEXT_FILE_LENGTH 2048
00029 
00030 // define this to 1 to make start times earlier and
00031 // enforce minimum on times
00032 #define FIX_TIMES 0
00033 
00034 // Sample configuration
00035 typedef int16_t Sample_t;   // 16-bit raw, LE samples
00036 const float SAMPLE_RATE_HZ = 8000.0;
00037 const unsigned SAMPLE_PERIOD_USEC = (unsigned)(1.0e6/SAMPLE_RATE_HZ);
00038 
00039 // Player configuration
00040 const size_t BUFFER_SIZE = 512;
00041 const size_t SAMPLES_PER_BUFFER = BUFFER_SIZE / sizeof(Sample_t);
00042 const float SECONDS_PER_CHUNK = SAMPLES_PER_BUFFER / SAMPLE_RATE_HZ;
00043 
00044 #define SERIAL_BAUD 115200
00045 #define ANALOG_OUTPUT_BIAS  0x8000
00046 
00047 #define BODY_ON_DELAY 0.65
00048 #define BODY_OFF_DELAY 0.65
00049 
00050 #define TAIL_ON_DELAY 0.40
00051 #define TAIL_OFF_DELAY 0.40
00052 
00053 #define MOUTH_ON_DELAY 0.10
00054 #define MOUTH_OFF_DELAY 0.10
00055 #define MOUTH_MIN_ON_TIME 0.05
00056 
00057 // Power:
00058 // Power GND  J9/14
00059 // Vin (6V)   J9/16
00060 
00061 // I/O configuration
00062 #define BASS1_TAIL  PTB0   /* J10/2 */
00063 #define BASS1_MOUTH PTB1   /* J10/4 */
00064 #define BASS1_BODY  PTB2   /* J10/6 */
00065 #define BASS1_BUTTON PTD5  /* J2/4 */
00066 
00067 #define BASS2_TAIL  PTB3  /* J10/8 */
00068 #define BASS2_MOUTH PTC2  /* J10/10 */
00069 #define BASS2_BODY  PTC1  /* J10/12 */
00070 #define BASS2_BUTTON PTA13 /* J3/2 */
00071 
00072 // SD Card (3.3V)
00073 // PTD0 J2/6 D10 - Used for CS of SPI
00074 // PTD2 J2/8 D11 - Used for MOSI of SPI
00075 // PTD3 J2/10 D12 - Used for MISO of SPI
00076 // PTC5 J1/9  Used for SCLK of SPI (must solder if using shield)
00077 #define SD_MOSI PTD2
00078 #define SD_MISO PTD3
00079 #define SD_SCLK PTC5
00080 #define SD_CS   PTD0
00081 
00082 #endif