PDA

View Full Version : Decaying sounds synthesis with PWM



amaze1
- 3rd August 2011, 22:29
Hello everyone

Anyone knows if is possible to emulate decaying sounds like gong, bells, music boxes (carillon) etc using only the PWM output ?

I know such sound are basically tones with exponentially decaying envelope and wondering if their spectrums can be somewhat emulated with appropriate modulation of frequency and/or duty cycle of a PWM output (say the PIC PWM module) without using an external Programmable Gain Amplifier for the envelope.

I can barely remember someone did it with an attiny15 or so ...

mackrackit
- 3rd August 2011, 23:39
I have not tried it with straight PWM, but take a look at the SOUND command. It should help you a bit with the freqs.

Normnet
- 3rd August 2011, 23:48
Hello everyone

Anyone knows if is possible to emulate decaying sounds like gong, bells, music boxes (carillon) etc using only the PWM output ?...

I have read wav files from an SD card and output using only PWM with excellent results.
From a pic only you may get a second or so.

Norm

HankMcSpank
- 6th August 2011, 11:09
Hello everyone

I know such sound are basically tones with exponentially decaying envelope and wondering if their spectrums can be somewhat emulated with appropriate modulation of frequency and/or duty cycle of a PWM output (say the PIC PWM module) without using an external Programmable Gain Amplifier for the envelope.



Constructing bell-esque sounds using synths normally involves several sine waves and complicated algorithms (eg think Yamaha DX7) ...I'd hazard a guess & say that reading/playing a sample would be the best way to achieve what you want (ie no recourse to external envelope shaping hw)

Jerson
- 6th August 2011, 13:56
I guess you can do this. I can hazard a way to do it. Use the Timer/CCP module to generate the frequency/ies you need. Another output is used as envelope control which snubs the output. So, you have frequency and amplitude modulation in effect. Never tried it, so, don't hold me to this. Just an idea that can work

ScaleRobotics
- 6th August 2011, 17:14
Some different ways to do sound here: http://www.picbasic.co.uk/forum/showthread.php?t=8113

rsocor01
- 6th August 2011, 20:13
Hello everyone

Anyone knows if is possible to emulate decaying sounds like gong, bells, music boxes (carillon) etc using only the PWM output ?

I know such sound are basically tones with exponentially decaying envelope and wondering if their spectrums can be somewhat emulated with appropriate modulation of frequency and/or duty cycle of a PWM output (say the PIC PWM module) without using an external Programmable Gain Amplifier for the envelope.

I can barely remember someone did it with an attiny15 or so ...

I use the SOUND command for my DINGs and DONGs :). It works ok for me.

manuespagne
- 20th August 2015, 10:54
Hello rsocor!
I am a new member living in France and working with PIC microcontroller. I search the hex , basic, c file for making a sound bell gong carillon with pic 16F family. Could you send me theses files and the electronic schematics?
Thank you very much

Best regard

Emmanuel from FRANCE

rsocor01
- 20th August 2015, 21:05
Hello rsocor!
I am a new member living in France and working with PIC microcontroller. I search the hex , basic, c file for making a sound bell gong carillon with pic 16F family. Could you send me theses files and the electronic schematics?
Thank you very much

Best regard

Emmanuel from FRANCE

Try this,

http://www.picbasic.co.uk/forum/showthread.php?t=15386&highlight=music

I tested it and it worked!

manuespagne
- 21st August 2015, 10:10
Thank you very much roscor for your answer

In fact, i want to simulate the sound of the old IC from SIEMENS SAB 0600, by using a PWM Output and a RC Filter. Can you join me a hex file for a pic and a file in basic or in C.
The melody of the old cartoon candy i don't have the compiler, can you send me the hex file for the PIC 12F675

Do you know, the IC SAB 0600, have you simulate it?

Thank you much for your answer
Have Good day

Emmanuel from FRANCE

Art
- 14th September 2015, 15:04
I don’t know if I ever posted it here, but I did polyphonic with the PBP freqout command.
The other chip on the board is a MAX232.

https://www.youtube.com/watch?v=eesq_N3pe10