Show Posts
Pages: [1]
1  Using Arduino / Audio / Re: How to make audible sound wave on piezzo buzzer? on: September 16, 2012, 04:59:52 pm
So after I looked up modulation as it pertains to audio I understand now smiley-grin

My new code:(It makes a sin wave but also modulates the pitch really fast up and down.)
Code:
void loop() {
 b=b+1; //for the sine wave
 a=a+mod; //for the pitch modulation
 if(a>40){mod=-mod;}
 if(a<1){mod=-mod;}  //these loop modulation back and forth
 c=75*sin(.004*b)+1600+a*5;  //all the numbers added up.
 tone(13,c);
}
2  Using Arduino / Audio / How to make audible sound wave on piezzo buzzer? on: September 16, 2012, 02:17:32 pm
Hello, I am new here but I have already made a few projects on the arduino.  I am on the hunt currently on how to make a specific sound on an arduino with a piezzo buzzer.

Here is what I have:
Code:
void loop() {
  a=a+1;
  tone(13,sin(a)*50+2000);
  delay(60);
  tone(13,0);
  delay(10);
}

Here is what I want:
http://downloads.bbc.co.uk/doctorwho/sounds/sonicscrewdriver.mp3

My code generates something similar in terms of pitch and timing... but it is very harsh when compared to the link above.  Is there an easy way to modulate a tone or make it softer?
Pages: [1]