Spark Logic

4 channel polyphonic tone generator (blue pill)

Hi,

just for fun:

(the real sound is much better than on the video :mrgreen: )

It is exclusively timer based, so all 4 timers are reserved, configurable channel for each timer in part.
Accurate timing taken from systick.

Source available here: https://github.com/stevstrong/STM32-Tim … ree/master

Replies14

Sat Nov 11, 2017 8:41 pm

Thanks Steve..

Can you post a link to the speakers… It looks like they are piezo , but are much bigger than I have.

BTW.

I had a crazy idea because I have Indian Myna birds, in the garden , which are a pest and are noisy.
https://en.wikipedia.org/wiki/Common_myna

They mimic the sounds of other birds, so… I thought perhaps if I put BluePills in the trees, which play some simple tune, then perhaps rather than making the sounds of other birds, they may start makimg the sound of these tunes.

The Wallace and Grommit theme tune was going to be the song I use, e.g. just the first 8 notes

It would be a laugh if all the birds started to sing that at as one of their songs ;-)

Sat Nov 11, 2017 9:01 pm

Thanks for the link.

PS. did you use resistors in series with the speakers?

Sat Nov 11, 2017 9:05 pm

nope, the chip is heating up a bit during playing, but it is still working. 8-)
indestructible…

Sat Nov 11, 2017 10:18 pm

[stevestrong – Sat Nov 11, 2017 9:05 pm] –
nope, the chip is heating up a bit during playing, but it is still working. 8-)
indestructible…

LOL

Sat Nov 11, 2017 11:52 pm

Nice… but if you want it a little louder, fire the output(s) though a small transistor
2n2222_amp.jpeg
2n2222_amp.jpeg (25.01 KiB) Viewed 987 times

Sun Nov 12, 2017 2:09 pm

The sound level is OK, just that the camera mic could not reproduce it appropriately.

Anyway, I forgot to mention that the sw I posted needs this patch: https://github.com/stevstrong/Arduino_S … 77705acec9
This clears the IRQ flag before enabling the respective IRQ for a timer channel.

Sun Nov 12, 2017 4:56 pm

Nice :D

Did you try this one.
It’s a five channel synth ;-)

Mon Nov 13, 2017 8:31 am

No, I did not try it.
But does it have only 1 output?
How does it the 5 channel synth?

Mon Nov 13, 2017 9:38 pm

>But does it have only 1 output?

Yes, the signals are “analog” like waveforms and are added internally.

It is done here ( line 277 ).

Tue Nov 14, 2017 10:28 am

Uhmmm….. streaming.h is missing.
sketch\TimerTone.h:3:23: fatal error: Streaming.h: No such file or directory

Tue Nov 14, 2017 10:54 am

Sorry, I should have mention it, it is about ArduinoStreaming lib, you can get it from here
https://github.com/geneReeves/ArduinoSt … treaming.h
or here (first attachment) http://stm32duino.com/viewtopic.php?f=9&t=2425

Funny, I don’t get any warning/error. Are you using the TonePlayer example from the example folder of the lib?
Did you unpack the files under Arduino/libraries ?
How old is your repo? You should update it, I always update it at least once weekly.

Maybe update the IDE to 1.8.5.

Tue Nov 14, 2017 11:14 am

Your streaming.h is a little newer than mine but, after updating core (I found it was very old, March 2017!), I got it compiled.
Anyway I updated streaming.h.

Now I have to search for the hardware!

Thanks!

Tue Nov 14, 2017 6:18 pm

Well done Steve, I like it !

Post a reply

Optional · up to 10 MiB