using flash storage with the Tone() function

SouthernAtHeart:
...I'm trying to move my tone data to flash memory...

The FLASH_TABLE macro creates a _FLASH_TABLE object that you can use as a function argument (to play the tunes).

Problem number 1 (not really a problem, but it's presents a "learning experience" for some):
_FLASH_TABLE is a template class. Since your tables are integer arrays, the specific object will be _FLASH_ARRAY

Problem number 2: A "minor" shortcoming of the current version of the Arduino environment is that it will not automatically create function prototypes for functions that have the object of a template class as an argument. You have to do it yourself.

Here's an example that just prints out values from your arrays. Obviously, your function would play each tone for the specified duration instead of just printing the integer values:

//
// testTunes.pde
//
// Demonstration of getting values from a _FLASH_TABLE
//
//  davekw7x
//
#include <Flash.h>
#include <Tone.h>

FLASH_TABLE(int, Tune1, 5, /* Number of notes in the tune */
    {NOTE_C6, NOTE_D6, NOTE_C6, NOTE_B5, NOTE_C6},
    {20,20,4,10,4});

FLASH_TABLE(int, Tune2, 3, /* Number of notes in the tune */
    {NOTE_C6, NOTE_B5, NOTE_A5},
    {20,8,4});

// Arduino will not automatically create prototypes for function templates,
// so you have to put it in before the function is invoked.
//
void printTuneTable(const _FLASH_TABLE<int> & ft);

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    Serial.println("Calling printTuneTable(Tune1)");
    printTuneTable(Tune1);
    Serial.println("Calling printTuneTable(Tune2)");
    printTuneTable(Tune2);
    delay(10000);
}

void printTuneTable(const _FLASH_TABLE<int> & ft)
{
    for (int i = 0; i < ft.cols(); i++) {
        Serial.print("Note ");Serial.print(i);
        Serial.print(": Tone = ");Serial.print(ft[0][i]);
        Serial.print(", duration = ");Serial.println(ft[1][i]);
    }
    Serial.println();
}

Output:


Calling printTuneTable(Tune1)
Note 0: Tone = 1047, duration = 20
Note 1: Tone = 1175, duration = 20
Note 2: Tone = 1047, duration = 4
Note 3: Tone = 988, duration = 10
Note 4: Tone = 1047, duration = 4

Calling printTuneTable(Tune2)
Note 0: Tone = 1047, duration = 20
Note 1: Tone = 988, duration = 8
Note 2: Tone = 880, duration = 4

Regards,

Dave

Footnote:
Instead of having a 2-D array and having to make sure the sequence of tones matches the sequences of durations, I might just use a 1-D array (FLASH_ARRAY instead of FLASH_TABLE) with pairs of entries (tone and duration) for each note. The array could be declared something like this:

FLASH_ARRAY(int, Tune3,
            NOTE_C6, 20,
            NOTE_D6, 20,
            NOTE_C6, 4,
            NOTE_B5, 10,
            NOTE_C6, 4)

And the function to access the tones could be something like this:

void printTuneArray(const _FLASH_ARRAY<int> & fa)
{
    for (int i = 0; i < fa.count()-1; i += 2) {
        Serial.print("Note ");Serial.print(i);
        Serial.print(": Tone = ");Serial.print(fa[i]);
        Serial.print(", duration = ");Serial.println(fa[i+1]);
    }
    Serial.println();
}

It might make for easier tune entry and debugging.