Go Down

Topic: toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc. (Read 17 times) previous topic - next topic

cr0sh


Example 2 : A whistling kettle with boiling water sound.


I don't have the code handy - but waaaay back when I was kid, I remember playing around on my TRS-80 Color Computer with the PLAY command; there was a way, via using certain values (I think random notes played with very, very short durations) with a rapidly decreasing volume level (the CoCo had a 6 bit DAC - so there were 64 volume levels) - you could make an "explosion" or "gun" sound of sort...

...care to try making something like that?

;)

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Krodal

Since the toneAC library is ideal for kids toys (extra loud, no nasty clicks, volume control), these kind of sounds came to my mind. But so far I could not make something that sounds right.

teckel


Since the toneAC library is ideal for kids toys (extra loud, no nasty clicks, volume control), these kind of sounds came to my mind. But so far I could not make something that sounds right.


If you'd like to post your sound effect sketches to the toneAC library page I believe I can arrange it.  You need a Gmail email address and let me know what it is and I'll try to set it up for you.  Never done it before, but it seems like it's possible.

Tim
Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Krodal

No need to set it up for me. I hope to add one or two more sounds with the library, and I will post them in this thread. I don't know if others want to contribute, and I also can't find a site with melodies and sounds that make use of the volume.

Krodal

Example 4: Random sound

This is just a random. To make it random to the human ear, the frequency is not linear.
It can be used as startup-sound or to simulate that device is totally confused.
Set the volume to your own need.

Code: [Select]

// Random sound
// public domain

int i, j, frequency, volume, duration;

for( i=0; i<1000; i++)
{
  j = random (5, 60);
  frequency = j * j;
  volume = random(6, 11);
  toneAC( frequency, volume, 0, true);
  j = random( 1, 12);
  duration = j * j;
  delay( duration);
}
noToneAC();
 
delay(2000);




Example 5 : misuse of the toneAC library

The next example is able to generate noise sounds.
Both random functions are part of the delay. The random change in volume is needed for the noise.

Code: [Select]

// example of noise sounds with toneAC library
// public domain
//
// The lower and higher frequency define the sound.
//     300, 1500 : noise
//     340, 345   : computer noise
//     600, 14500 : rain drops noise

#define FREQUENCY_LOWER   300
#define FREQUENCY_HIGHER   1500
 
int i, frequency, volume;

for( i=0; i<10000; i++)
{
  volume = random(6, 11);
  frequency = random( FREQUENCY_LOWER, FREQUENCY_HIGHER);
  toneAC( frequency, volume, 0, true);
  delay(1);
}
noToneAC();
 
delay(2000);

Go Up