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 SoundTask::task() {
    while(true) {
        Tone tone;
        if(xQueueReceive(_tones, &tone, portMAX_DELAY) == pdTRUE) {
            tone.play();
        }
    }
}
Exemplo n.º 3
0
//*********************************************************************************************************
void beep()
{
#ifdef _USE_ARDUINO_TONE
	tone(SPEAKER_PIN2, NOTE_C8, 200);
#else
	// beep after reset;
	noiseMaker.play(NOTE_C8, 200);
#endif
}
Exemplo n.º 4
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
Exemplo n.º 5
0
void loop() {
    note_raw = analogRead(NOTE_PIN);
    beat_raw = analogRead(BEAT_PIN);
    
//    note = dist2note[distance(note_raw)];
//    if (beat_raw > BEAT_TH) {
//        if (note != last_note) {
//            last_note = note;
//            tn.play(notes[note]);
//        }
//    } else {
//        tn.stop()
//    }

    for (int i = 0; i < 89; i++) {
        tn.play(all_notes[i]); 
        if (DELAY) {
            delay(DELAY);
        }
    }
}
Exemplo n.º 6
0
void loop() {
    for (int i; i < 12; i++) {
        tone.play(note[i]);
        delay(1000);
    }
}