// Code originally created by Erik Kringen (https://blog.mycontraption.com/?s=sound+effects) // Used with permission of the author by Nublert @ mehackit.org void beep (int speakerPin, float noteFrequency, long noteDuration) { int x; // Convert the frequency to microseconds float microsecondsPerWave = 1000000/noteFrequency; // Calculate how many HIGH/LOW cycles there are per millisecond float millisecondsPerCycle = 1000/(microsecondsPerWave * 2); // Multiply noteDuration * number or cycles per millisecond float loopTime = noteDuration * millisecondsPerCycle; // Play the note for the calculated loopTime. for (x=0;x1000; i=i*.95) { beep(speakerPin,i,10); } for (int i=1000; i<3000; i=i*1.05) { beep(speakerPin,i,10); } delay(100); for (int i=2000; i>1000; i=i*.95) { beep(speakerPin,i,10); } for (int i=1000; i<3000; i=i*1.05) { beep(speakerPin,i,10); } delay(100); for (int i=2000; i>1000; i=i*.95) { beep(speakerPin,i,10); } for (int i=1000; i<3000; i=i*1.05) { beep(speakerPin,i,10); } delay(100); for (int i=2000; i>1000; i=i*.95) { beep(speakerPin,i,10); } } void catcall() { for (int i=1000; i<5000; i=i*1.05) { beep(speakerPin,i,10); } delay(300); for (int i=1000; i<3000; i=i*1.03) { beep(speakerPin,i,10); } for (int i=3000; i>1000; i=i*.97) { beep(speakerPin,i,10); } } void ohhh() { for (int i=1000; i<2000; i=i*1.02) { beep(speakerPin,i,10); } for (int i=2000; i>1000; i=i*.98) { beep(speakerPin,i,10); } } void uhoh() { for (int i=1000; i<1244; i=i*1.01) { beep(speakerPin,i,30); } delay(200); for (int i=1244; i>1108; i=i*.99) { beep(speakerPin,i,30); } } void laugh() { for (int i=1000; i<2000; i=i*1.10) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i>500; i=i*.90) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i<2000; i=i*1.10) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i>500; i=i*.90) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i<2000; i=i*1.10) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i>500; i=i*.90) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i<2000; i=i*1.10) { beep(speakerPin,i,10); } delay(50); for (int i=1000; i>500; i=i*.90) { beep(speakerPin,i,10); } delay(50); }