VS1053  1.03.00
Arduino Library for VS10xx shield
Macros | Functions | Variables
vs1053_SdFat.cpp File Reference
#include <vs1053_SdFat.h>
#include "SPI.h"
#include <avr/pgmspace.h>
Include dependency graph for vs1053_SdFat.cpp:

Go to the source code of this file.

Macros

#define MIDI_NOTE_ON   9
 
#define MIDI_NOTE_OFF   8
 
#define MIDI_HDR_CHUNK_ID   0x4D, 0x54, 0x68, 0x64
 
#define MIDI_CHUNKSIZE   0, 0, 0, 6
 
#define MIDI_FORMAT   0, 0
 
#define MIDI_NUMBER_OF_TRACKS   0, 1
 
#define MIDI_TIME_DIVISION   0, 96
 
#define MIDI_TRACK_CHUNK_ID   0x4D, 0x54, 0x72, 0x6B
 
#define MIDI_CHUNK_SIZE   0, 0, 0, sizeof(MIDI_EVENT_NOTE_ON) + sizeof(MIDI_EVENT_NOTE_OFF) + sizeof(MIDI_END_OF_TRACK)
 
#define MIDI_EVENT_NOTE_ON   0, (MIDI_NOTE_ON<<4) + MIDI_CHANNEL, MIDI_NOTE_NUMBER, MIDI_INTENSITY
 
#define MIDI_EVENT_NOTE_OFF   MIDI_NOTE_DURATION, (MIDI_NOTE_OFF<<4) + MIDI_CHANNEL, MIDI_NOTE_NUMBER, MIDI_INTENSITY
 
#define MIDI_END_OF_TRACK   0, 0xFF, 0x2F, 0
 

Functions

char * strip_nonalpha_inplace (char *s)
 chomp non printable characters out of string. More...
 
bool isFnMusic (char *filename)
 is the filename music More...
 

Variables

static const uint16_t bitrate_table [15][6] PROGMEM
 bitrate lookup table More...
 
PROGMEM const uint8_t SingleMIDInoteFile [] = {MIDI_HDR_CHUNK_ID, MIDI_CHUNKSIZE, MIDI_FORMAT, MIDI_NUMBER_OF_TRACKS, MIDI_TIME_DIVISION, MIDI_TRACK_CHUNK_ID, MIDI_CHUNK_SIZE, MIDI_EVENT_NOTE_ON, MIDI_EVENT_NOTE_OFF, MIDI_END_OF_TRACK}
 a MIDI File of one Note More...
 

Macro Definition Documentation

◆ MIDI_CHUNK_SIZE

#define MIDI_CHUNK_SIZE   0, 0, 0, sizeof(MIDI_EVENT_NOTE_ON) + sizeof(MIDI_EVENT_NOTE_OFF) + sizeof(MIDI_END_OF_TRACK)

Definition at line 59 of file vs1053_SdFat.cpp.

◆ MIDI_CHUNKSIZE

#define MIDI_CHUNKSIZE   0, 0, 0, 6

Definition at line 53 of file vs1053_SdFat.cpp.

◆ MIDI_END_OF_TRACK

#define MIDI_END_OF_TRACK   0, 0xFF, 0x2F, 0

Definition at line 64 of file vs1053_SdFat.cpp.

◆ MIDI_EVENT_NOTE_OFF

#define MIDI_EVENT_NOTE_OFF   MIDI_NOTE_DURATION, (MIDI_NOTE_OFF<<4) + MIDI_CHANNEL, MIDI_NOTE_NUMBER, MIDI_INTENSITY

Definition at line 62 of file vs1053_SdFat.cpp.

◆ MIDI_EVENT_NOTE_ON

#define MIDI_EVENT_NOTE_ON   0, (MIDI_NOTE_ON<<4) + MIDI_CHANNEL, MIDI_NOTE_NUMBER, MIDI_INTENSITY

Definition at line 61 of file vs1053_SdFat.cpp.

◆ MIDI_FORMAT

#define MIDI_FORMAT   0, 0

Definition at line 54 of file vs1053_SdFat.cpp.

◆ MIDI_HDR_CHUNK_ID

#define MIDI_HDR_CHUNK_ID   0x4D, 0x54, 0x68, 0x64

Definition at line 52 of file vs1053_SdFat.cpp.

◆ MIDI_NOTE_OFF

#define MIDI_NOTE_OFF   8

Definition at line 48 of file vs1053_SdFat.cpp.

◆ MIDI_NOTE_ON

#define MIDI_NOTE_ON   9

Definition at line 47 of file vs1053_SdFat.cpp.

◆ MIDI_NUMBER_OF_TRACKS

#define MIDI_NUMBER_OF_TRACKS   0, 1

Definition at line 55 of file vs1053_SdFat.cpp.

◆ MIDI_TIME_DIVISION

#define MIDI_TIME_DIVISION   0, 96

Definition at line 56 of file vs1053_SdFat.cpp.

◆ MIDI_TRACK_CHUNK_ID

#define MIDI_TRACK_CHUNK_ID   0x4D, 0x54, 0x72, 0x6B

Definition at line 58 of file vs1053_SdFat.cpp.

Function Documentation

◆ isFnMusic()

bool isFnMusic ( char *  filename)

is the filename music

Parameters
[in]filenameinspects the end of the filename to be of the extension types that VS10xx can decode.
Returns
boolean true indicating that it is music

Definition at line 2291 of file vs1053_SdFat.cpp.

◆ strip_nonalpha_inplace()

char* strip_nonalpha_inplace ( char *  s)

chomp non printable characters out of string.

Parameters
[out]spointer of a char array (aka string)
Returns
char array (aka string) with out whitespaces

Definition at line 2269 of file vs1053_SdFat.cpp.

Variable Documentation

◆ PROGMEM

const uint16_t bitrate_table [15][6] PROGMEM
static
Initial value:
= {
{ 0, 0, 0, 0, 0, 0},
{ 32, 32, 32, 32, 8, 8},
{ 64, 48, 40, 48, 16, 16},
{ 96, 56, 48, 56, 24, 24},
{128, 64, 56, 64, 32, 32},
{160, 80, 64, 80, 40, 40},
{192, 96, 80, 96, 48, 48},
{224,112, 96,112, 56, 56},
{256,128,112,128, 64, 64},
{288,160,128,144, 80, 80},
{320,192,160,160, 96, 69},
{352,224,192,176,112,112},
{384,256,224,192,128,128},
{416,320,256,224,144,144},
{448,384,320,256,160,160}
}

bitrate lookup table

This is a table to decode the bitrate as per the MP3 file format, as read by the SdCard

www.mp3-tech.org

Note
PROGMEM macro forces to Flash space.
Warning
This consums 190 bytes of flash

Definition at line 25 of file vs1053_SdFat.cpp.

◆ SingleMIDInoteFile

a MIDI File of one Note

This is string containing a complete MIDI format 0 file of one Note ON and then Off.

Description of MIDI file parsing

Note
PROGMEM macro forces to Flash space.
Warning
This should consume 34 bytes of flash

An inline equation $ e^{\pi i}+1 = 0 $

A displayed equation:

\[ e^{\pi i}+1 = 0 \]

Definition at line 82 of file vs1053_SdFat.cpp.