Creating an Airhorn with Tone

Good Day All :slight_smile: ,

Long story short: I need to make a Siren Airhorn Tone.

Big Newbie to Arduino.

I am busy with a hobby lights and siren project.

After a bit of work I have successfully accomplished the following tones:

-Wail
-Yelp
-Hyper Yelp
-Piercer
-Hi Lo

All are sounding amazing, however, I can't for the life of me work out how I am to do the airhorn, does anyone have any tips or advice?

I am currently using the Tone(); function for everything. The siren tones essentially sweep freq from 400hz up to 2000hz with Hi Low being two static tones. No static tones come close to anything air horn. I thought of oscillating two static tones rapidly but have not tried that yet.

04:49 You can hear an example

No static tones come close to anything air horn.

Correct. This is because the tone function only produces a rectangular wave and so the number of harmonics is limited and by and large fixed.

The timbre of a sound depends on a mix of changing harmonics. So you can not approximate this with a simple rectangular wave sequence. A rectangular wave contains only odd harmonics, so no even ones. Plus the "air" sound of it is random noise, and you can't duplicate that with the Tone function.

The simplest way is to get a sample of the sound and play it back. This is one system that will help with this:-

Very short samples ( < 3 seconds ) may be stored in program memory flash instead of an SD card.

@obe3 It would be awesome if you would post your code for the mentioned sounds you already implemented. Thanks in advance