Don't stop believing playing on my arduino.

I want to play don’t stop believing, the journey on my arduino. I used the code from the tut here.
It is one of my first projects.
Only problem is after the 5th note (+/-), it stops playing. could anyone help me out?

 #include "pitches.h"

// notes in the melody:
int melody[] = {
  NOTE_A3, NOTE_F2,NOTE_G2, NOTE_G2, NOTE_A3, NOTE_D2, NOTE_F2, NOTE_F2, NOTE_F2, NOTE_F2,NOTE_C3, NOTE_C3, NOTE_A3, NOTE_G2};
 // just a small town girl, livin in a lonely world.

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  8, 8, 8, 4, 2, 8, 8, 8, 8, 4, 4, 4, 4, };

void setup() {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    // 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 distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(20);
  }
}

void loop() {
  // no need to repeat the melody.
}

I can’t find the problem by myself.
If someone else already have this song please help me out for the long typing.
thanks!

The for loop plays eight notes and stops. Change it to this:

  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < sizeof(melody)/2; thisNote++) {

Pete

el_supremo has you on the right track, but a safer and more portable way is to use:

#define ARRAYELEMENTCOUNT(x)  (sizeof(x) / sizeof(x[0]))

// Your normal code...

 // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < ARRAYELEMENTCOUNT(melody); thisNote++) {

The logic is the same: take the number of bytes allocated to the entire array and divide it by the number of bytes required for a single element. Pete simply had you divide by the 2 bytes required for each int. However, the macro allows you to get the element count for any type of array and will also work in environments where identical data types are different. For example, a double is 4 bytes on an Uno but 8 bytes on a Due. The macro works in either environment without source code change.

Thanks for the help guys! (or girls :P)