void playSection(int notes[],int bassNote,int repeat,int length){ // play notes 
   for(int j=0;j<repeat;j++){
      if(bassNote != 13){ 
        tone2.play(bass[bassNote],(length - 1 * 300)); // TODO: calculate how long to play bass
      }
     for(int i=0;i<=length-1;i++){

      tone1.play(notes[i]);
      delay(300);
      tone1.stop(); 
    }
   tone2.stop(); 
  }  
}
Exemplo n.º 2
0
void loop(){
  buttonState = digitalRead(buttonPin);

  if (buttonState == LOW){
    for(i = 0; i < 7; i = i + 1){
      mytone.play(songTones[i], 1000);
      delay(1000);
    }
  }
  else { //HERE I GO AGAIN RECORD MODE
    mytone.stop(); //silence
    for(i = 0; i < 7; i = i + 1){
      int inVar = analogRead(0); //read the varible resistor for a value
      // map the input to a frequency range between 200 and 2000 Hz
      int note = map(inVar, 0, 1023, 220, 2000);
      songTones[i] = note; //set value
      mytone.play(note, 1000);//play value, duration small
//      mytone.stop(); //silence
      delay(1000);
    }
    //end tone?
  }//end if/else
}//endloop