Close Encounters Door Bell

Hi All,

First post on these forums and new to the Arduino so please be kind.

I'm making a door bell as a simple first project that plays the notes from close encounters.

I've got it working functionally, but musically it sounds wrong.

Anyone willing to test out my code and tell me what I'm doing wrong?

/*
 *  Alternating switch
 */

int switchPin = 2;              // switch is connected to pin 2
int val;                        // variable for reading the pin status
int buttonState;                // variable to hold the last button state

 #include "pitches.h"

// notes in the melody:
int melody[] = {
  NOTE_G4, NOTE_A4,NOTE_F4, NOTE_F3, NOTE_C3};

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

void setup() {
  pinMode(switchPin, INPUT);    // Set the switch pin as input

  Serial.begin(9600);           // Set up serial communication at 9600bps
  buttonState = digitalRead(switchPin);   // read the initial state
}


void loop(){
  val = digitalRead(switchPin);      // read input value and store it in val

  if (val != buttonState) {          // the button state has changed!
    if (val == HIGH) {                // check if the button is pressed
      Serial.println("Button just pressed");
        for (int thisNote = 0; thisNote < 5; thisNote++) {
    
int noteDuration = 1000/noteDurations[thisNote];
int pauseBetweenNotes = noteDuration * 1.30;
    
    tone(8, melody[thisNote],noteDuration);
    delay(pauseBetweenNotes);
    noTone(8);
  }
    } else {                         // the button is -not- pressed...
      Serial.println("Button just released");
    }
  }

  buttonState = val;                 // save the new state in our variable
}

NOTE_G4, NOTE_A4,NOTE_F4, NOTE_F3, NOTE_C3

Those don't look like the right notes.

Google "close encounters theme" or similar to find the correct notes.
Find a clip of where the guy in charge is telling the guy on the keyboard what to play, I recall him saying "play (whatever the first note was, now up a major third, down a major fifth, down a major third, up 2 steps", something along those lines.

For example, this
http://www.musicnotes.com/sheetmusic/mtdFPE.asp?ppn=MN0017597
shows them as
A-B-G-G (octave lower) -D

Which sounds correct using this

or
http://www.play-piano.org/play_online_piano_piano.html
as examples.