Bird Sounds with Arduino

Bird sound circuit with Arduino

Bird Sounds with Arduino

Here is an example of a bird’s voice generation using the Arduino Nano microcontroller (ATmega328)

The code is taken from http://120.107.171.121/~tywua/sub/ISAR/Chirp.ino, apparently from a professor’s website at National Changhua University of Education, Taiwan.

Arduino Bird Sound Generation
Arduino Bird Sound Generation

Here is an example of the resulting sound:

Here’s the signal form in the Audacity app for 1 set of tweets only:

Here’s the source code (from http://120.107.171.121/~tywua/sub/ISAR/Chirp.ino)

int piezopin = 11;  Select the PIN for the speaker
int angulo = 0;
int counter = 0;


void Setup () {
  pinMode (Piezopin, OUTPUT);
}
void Loop () {
  Angulo = random (10.50);
  Counter = random (2.6);

  highChirp (5, Angulo/10);
  Delay (100);
  lowChirp (Angulo * 4.2);
  Delay (100);
  Tweets (counter, 2);
}

void highChirp (int intensity, int chirpsNumber) {
  I.
  int x;
  for (int veces = 0; veces<=chirpsNumber; veces++){
    for (i = 100; i > 0; I--)
    {
      for (x = 0; x<intensity;  x++)
      {
        digitalWrite (Piezopin, HIGH);
        delayMicroseconds (i);
        digitalWrite (Piezopin, LOW);
        delayMicroseconds (i);
      }
    }
  }
}

void lowChirp (int intensity, int chirpsNumber) {
  I.
  int x;
  for (int veces = 0; veces<=chirpsNumber; veces++){
    for (i = 0; i<200; i++)
    {
      digitalWrite (Piezopin, HIGH);
      delayMicroseconds (i);
      digitalWrite (Piezopin, LOW);
      delayMicroseconds (i);
    } 
    for (i = 90; i > 80; I--)
    {
      for (x = 0; x<5;  x++)
      {
        digitalWrite (Piezopin, HIGH);
        delayMicroseconds (i);
        digitalWrite (Piezopin, LOW);
        delayMicroseconds (i);
      }
    }
  }
}

VOID tweet (int intensity, int chirpsNumber) {

I.
int x;
Normal chirpsNumber 3, normal intensity 5

for (int veces = 0; veces<chirpsNumber; veces++){
  for (int i = 80; i > 0; I--)
  {
   for (int x = 0; x<intensity;  x++)
   {
     digitalWrite (Piezopin, HIGH);
     delayMicroseconds (i);
     digitalWrite (Piezopin, LOW);
     delayMicroseconds (i);
   }
  }
}
Delay (1000);
}






Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.