On Fri, May 26, 2023 at 11:34 AM Oleg wrote:
> Hi, Tomek.
> Yeah, I know how drivers in NuttX works. I already could play beeps, tones
> and melodies using the tone driver available in Nuttx. I understand that I
> could correct a driver for special needs.

Aaah there is a code for playing melodies in /dev/toneN already sorry
I thought you want to create one as an exercise :-)

You may like FM-Synthesized sound, like AdLib did in the good old days :-)

https://en.wikipedia.org/wiki/Frequency_modulation_synthesis

https://en.wikipedia.org/wiki/Ad_Lib,_Inc.

Here is the absolute masterpiece, Dune videogame soundtrack by Stéphane Picq :-)

https://www.youtube.com/watch?v=FjHon6yg-r8


> But currently I just wondered is there a possibility using current note
> language to make a single constant beep with highest volume (that is the
> same as if just set and keep HIGH to pin of the buzzer).

It depends on what and how the audio device is attached to the port..
usually this is done by setting PWM duty cycle 10..90% but if you
provide constant current you may smoke the device beware :-)

https://electronics.stackexchange.com/questions/239442/audio-using-pwm-what-is-the-principle-behind-it

Usually you want to have something in between the port and the speaker
that will amplify the volume. Take a look at this trick with PNP
transistor, it usually works well for the small piezo as it "doubles
the voltage":

https://electronics.stackexchange.com/questions/299998/how-to-make-a-piezoelectric-transducer-buzz-louder

Note that there is a difference between piezo and the speaker: they
have different equivalent circuits, and piezo has usually its own
resonant frequency (i.e. 1kHZ) that you will hear much better than the
others, while speaker is designed to have wider band (i.e. audio
20..20000Hz).

Also note that some piezo buzzers (especially the black ones) have
built in generator (although they may look exactly the same as the
ones without a generator), so you only provide DC voltage and it will
beep on its own.

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Reply via email to