the buzzer came with an Arduino kit, and it's just called "passive buzzer". It's a centimeter in radius.
I'm looking for a way to boost the sound of it because when I connected the two pins from my headphone cable with the two pins of the speaker, it made a very quiet but good quality sound.
I want the headphone cable to be plugged into some breadboard-built amplifier and then send the amplified sound to the speaker.
code could take the very complicated but small sound wave, and make it bigger, maybe using the map() function.
You'll have to increase the voltage, which means you need a higher voltage power supply and transistor, MOSFET, or audio amplifier.
The regular Arduino puts-out 5V pulses or square waves. The tone() function puts-out a square wave. Piezo transducers are usually most-efficient at about 2kHz and your hearing is also most-sensitive at about 2kHz so a 2kHz tone is as loud as you can get with 5V.
Piezos can't put-out low frequencies (bass).
The Arduino can't put out 5V into a regular 4 or 8-Ohm speaker because it can't supply the current (Ohm's Law) and you can burn-up the Arduino by trying. Again, some kind of driver or amplifier is required but 5V might be enough.
Problem... The regular Arduino doesn't have a true-analog output. (1)
That could work If you had a digital-analog converter, and if the input is less than 2.5V (since you can only get 5V out). Multiplication is exactly-how digital amplification works, but it's normally used to adjust volume or as a volume control, not to replace an analog amplifier.
BTW - Doubling the voltage (or the digital value) is an increase of +5
6dB.)
An analog amplifier is a LOT easier to build and you can EASILY get better quality than with an Arduino.
I don't know if this applies to what you're doing, but the Audacity Website has a little tutorial about how digital audio works. (It's mostly about sampling. They don't talk about amplification.)
(1) To some extent analog can be "faked" with PWM, such as analogWrite(), but the PWM frequency has to be increased because standard PWM is in the lower part of the audio range (about 500Hz) so you can hear the PWM itself and it can't reproduce high frequency sounds. There is a library called tmrPCM that can "fake" analog audio from an Arduino.
well paul, I live in a country where you can either buy a module for a toilet bowl or import anything and everything from America, at the price of two times the product cost itself. (just joking)