MidiVOX organ: Tables.h

//
// MIDI and waveform look-up tables
//

// Author:  P.J. Drongowski
// Date:    6 May 2015
// Version: 1.0
//
// Copyright (c) 2015 Paul J. Drongowski

// This is indexed by MIDI note number (0 to 127). Each entry contains
// two 4-bit packed values:
//     Low nibble:  Waveform step size (by octave) encoded
//         0 -> 1 step
//         1 -> 2 steps     Software must add one to the encoded value
//         3 -> 4 steps     to obtain the correct step size. The encoding lets
//         7 -> 8 steps     us fit the range [1:16] into 4 bits.
//        15 -> 16 steps
//     High nibble: Pitch waveform index
//         C  0    E  4    Ab  8
//         Db 1    F  5    A   9
//         D  2    Gb 6    Bb 10
//         Eb 3    G  7    B  11

#define N(n,s) ((n<<4)|s)

prog_uchar PROGMEM MidiNotes[] = {
  N(0,0),N(1,0),N(2,0),N(3,0),N(4,0),N(5,0),     // 0:11
  N(6,0),N(7,0),N(8,0),N(9,0),N(10,0),N(11,0),

  N(0,0),N(1,0),N(2,0),N(3,0),N(4,0),N(5,0),     // 12:23  C0:B0
  N(6,0),N(7,0),N(8,0),N(9,0),N(10,0),N(11,0),

  N(0,0),N(1,0),N(2,0),N(3,0),N(4,0),N(5,0),     // 24:35  C1:B1
  N(6,0),N(7,0),N(8,0),N(9,0),N(10,0),N(11,0),

  N(0,0),N(1,0),N(2,0),N(3,0),N(4,0),N(5,0),     // 36:47  C2:B2
  N(6,0),N(7,0),N(8,0),N(9,0),N(10,0),N(11,0),

  N(0,0),N(1,0),N(2,0),N(3,0),N(4,0),N(5,0),     // 48:59  C3:B3
  N(6,0),N(7,0),N(8,0),N(9,0),N(10,0),N(11,0),

  N(0,1),N(1,1),N(2,1),N(3,1),N(4,1),N(5,1),     // 60:71  C4:B4
  N(6,1),N(7,1),N(8,1),N(9,1),N(10,1),N(11,1),

  N(0,3),N(1,3),N(2,3),N(3,3),N(4,3),N(5,3),     // 72:83  C5:B5
  N(6,3),N(7,3),N(8,3),N(9,3),N(10,3),N(11,3),

  N(0,7),N(1,7),N(2,7),N(3,7),N(4,7),N(5,7),     // 84:95  C6:B6
  N(6,7),N(7,7),N(8,7),N(9,7),N(10,7),N(11,7),

  N(0,15),N(1,15),N(2,15),N(3,15),N(4,15),N(5,15),     // 96:107  C7:B7
  N(6,15),N(7,15),N(8,15),N(9,15),N(10,15),N(11,15),

  N(0,15),N(1,15),N(2,15),N(3,15),N(4,15),N(5,15),     // 108:119  C8:B8
  N(6,15),N(7,15),N(8,15),N(9,15),N(10,15),N(11,15),

  N(0,15),N(1,15),N(2,15),N(3,15),N(4,15),N(5,15),     // 120:127  C9:B9
  N(6,15),N(7,15)
} ;

//    C  0    E  4    Ab  8
//    Db 1    F  5    A   9
//    D  2    Gb 6    Bb 10
//    Eb 3    G  7    B  11

//
// Farfisa-type single cycle wave information tables
//
// Number of samples in each waveform
prog_int16_t PROGMEM FarfNumOfSamples[] = {
  Farf_C3_Num, 
  Farf_Db3_Num,
  Farf_D3_Num, 
  Farf_Eb3_Num,
  Farf_E3_Num, 
  Farf_F3_Num, 
  Farf_Gb3_Num,
  Farf_G3_Num, 
  Farf_Ab3_Num,
  Farf_A3_Num, 
  Farf_Bb3_Num,
  Farf_B3_Num, 
} ;

// Base address of each waveform
PROGMEM const prog_int16_t* FarfWaves[] = {
  Farf_C3, 
  Farf_Db3,
  Farf_D3, 
  Farf_Eb3,
  Farf_E3, 
  Farf_F3, 
  Farf_Gb3,
  Farf_G3, 
  Farf_Ab3,
  Farf_A3, 
  Farf_Bb3,
  Farf_B3, 
} ;

//
// Vox-type single cycle wave information tables
//
// Number of samples in each waveform
prog_int16_t PROGMEM VoxNumOfSamples[] = {
  Vox_C3_Num, 
  Vox_Db3_Num,
  Vox_D3_Num, 
  Vox_Eb3_Num,
  Vox_E3_Num, 
  Vox_F3_Num, 
  Vox_Gb3_Num,
  Vox_G3_Num, 
  Vox_Ab3_Num,
  Vox_A3_Num, 
  Vox_Bb3_Num,
  Vox_B3_Num, 
} ;

// Base address of each waveform
PROGMEM const prog_int16_t* VoxWaves[] = {
  Vox_C3, 
  Vox_Db3,
  Vox_D3, 
  Vox_Eb3,
  Vox_E3, 
  Vox_F3, 
  Vox_Gb3,
  Vox_G3, 
  Vox_Ab3,
  Vox_A3, 
  Vox_Bb3,
  Vox_B3, 
} ;