Multiple measure note

Now I'm having a little issue programing here. There are times in songs I'm writing for the Arduino Uno to play that require multiple measures in 1 note. I've tried both .5 and 0.5 as note lengths, and it just freezes on the specific note. If I write it as 2 separate notes, there is a pause in between. I don't want to completely remove the pause because most of the notes I still want it there. Is there any way to write a note/rest to go multiple measures without a pause?

Change this:

int noteDurations[] = {4, 8, 8, 4, 4, 4, 4, 4 };

    // to calculate the note duration, take one second 
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);

To something like this:

#define eighth (1000/8)
#define quarter (1000/4)
#define half (1000/2)
#define whole (1000)
int noteDurations[] = {quarter, eighth, eighth, quarter, quarter, quarter, quarter, quarter};

    // Fetch the note duration in milliseconds
    int noteDuration = noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);

Then you can put any duration you like in. You can hold a note for 17 seconds (17000 milliseconds). You can write triplets: (1000eighth2/3).

Well could I also use the same code, except change "#define eighth" to "#define 8"? I'm used to the old coding numbers.

Anyway, thanks for the help. I'm new to programming and a lot of things don't make any sense to me.

If you used #define 8, you would replace all occurrences of the number 8 with (1000/8) - probably not what you want to do with your code.

koala44202:
Well could I also use the same code, except change "#define eighth" to "#define 8"

Unfortunately you can't. The 'define' only works on identifiers which can't start with a digit

You could use numbers and have special code to recognize special numbers:

int noteDuration;
if (noteDurations[thisNote] >= 1000)
    {
    noteDuration = noteDurations[thisNote];
    }
else
    {
    noteDuration = 1000/noteDurations[thisNote];
    }

For note values greater than 999 it would use the value directly rather that divide into 1000.

1000 = whole note (same as 1)
2000 = double whole note