[Microbit-Python] More musical silliness

David Whale david at thinkingbinaries.com
Fri Oct 16 07:31:00 CEST 2015


I have a relatively cheap (£10) powered bluetooth speaker plugged directly
into my micro:bit and using the Touch Develop pins->analog write() method,
I get *really loud* tones from it.

David


___________________________________________________________
David Whale, B.Sc (Hons), MIET
*Software Engineer and IET Schools Liaison Officer, Essex*

email:  dwhale at theiet.org
twitter: @whaleygeek
blog:  blog.whaleygeek.co.uk

Co-author of the new book "Adventures in Minecraft" <http://amzn.to/ZGfxZG>
- lets get kids coding!


On 16 October 2015 at 00:27, Damien George <damien.p.george at gmail.com>
wrote:

> Given more time, it would be possible to double the loudness of the
> current music output.  It can be done by connecting the speaker to
> pin0 and pin1 (instead of pin0 and gnd) and driving pin1 opposite to
> pin0 (so pin0 high would have pin1 low, and vice versa).  This gives
> double the voltage swing on the speaker.
>
> The nRF chip is capable of doing this.  It just requires some coding.
>
> On Thu, Oct 15, 2015 at 11:59 PM, Michael <sparks.m at gmail.com> wrote:
> > Yep, the catastrophone (and sorting hat) required a basic low pass filter
> > and single transistor amplifier circuit - which is a bit of a barrier.
> > Leaving the door open though is good.
> >
> > (The cat piano/catastrophene came out of my daughter seeing this  Jools
> > Holland's Hootenanny : https://www.youtube.com/watch?v=fkZp_uTbIKk abd
> > asking me if I could make her one...)
> >
> > Getting it loud enough for a public performance is harder than you might
> > expect, so the approach taken at present is really cool.
> >
> >
> > Michael.
> >
> > On 15 October 2015 at 23:35, Damien George <damien.p.george at gmail.com>
> > wrote:
> >>
> >> Wow, that TI-82 tracker is beautiful!
> >>
> >> I actually did try to play proper audio samples using the microbit
> >> right at the start of all this music module stuff (as Michael says,
> >> it's entirely possible).  But, the problem is you need an external low
> >> pass filter and amplifier for it work.  You use PWM at a very high
> >> frequency (say 1MHz) and then change the duty cycle to match the
> >> current sample, samples which are output at the sampling rate, say
> >> 8kHz.  Coupled with an external low pass filter, this gives a proper
> >> analog output.  So that means you can play an arbitrary sound.
> >>
> >> You can use a capacitor and resistor to make a low pass filter.  But
> >> then there isn't enough power left to drive a speaker, so you need an
> >> active amplifier (or use headphones).
> >>
> >> Since this scheme required more external hardware than most students
> >> would be comfortable with, I abandoned the idea.
> >>
> >> I think currently the music stuff is pretty cool, and accessible: any
> >> old speaker will work and give you a decent volume.
> >>
> >> But, of course, always room for improvement!
> >>
> >>
> >> On Thu, Oct 15, 2015 at 11:10 PM, Michael <sparks.m at gmail.com> wrote:
> >> > It's possible. The micro:bit as it stands now is much more capable
> than
> >> > the
> >> > prototype device that I built. However the prototype I built was built
> >> > around the Atmel 32u4 for the simple reason that it's a very similar
> to
> >> > the
> >> > Atmel 328P. The reason I mention that is because for that I created a
> >> > singing "cat piano" for my daughter a few years ago. That used PCM
> >> > encoded
> >> > WAV files - one per key, hard coded in program data. The wav files
> were
> >> > 8Khz
> >> > 8bit mono files, which then output to a speaker.
> >> >
> >> > I reused the same technique to make a Harry Potter sorting hat for a
> >> > Harry
> >> > Potter themed birthday party later the same year. Videos of these
> things
> >> > aren't online for personal reasons.
> >> >
> >> > I don't have the time at this instant to rewrite these for micro:bit,
> >> > and
> >> > haven't raised these previously because I didn't want to derail the
> >> > really
> >> > cool stuff going on here.
> >> >
> >> > (This list will go public at some point, so I don't really want to
> post
> >> > a
> >> > link to the video for the cat piano here, but happy to send it
> directly
> >> > to
> >> > those curious)
> >> >
> >> > In case it's useful to anyone, I've pushed the code for the cat piano
> >> > here:
> >> >
> >> > https://github.com/sparkslabs/catastrophene
> >> >
> >> > The code for the harry potter sorting hat is here:
> >> >
> >> > https://github.com/sparkslabs/sortinghat
> >> >
> >> > If useful, cool. If useful just as inspiration for *later* (and I
> really
> >> > would suggest *later* :o), that's cool.
> >> >
> >> > It's worth noting that it should be possible to directly drive a
> >> > composite
> >> > video display as well, since that's possible to do with the Atmel 32C4
> >> > which
> >> > is again lower power than we have available for the micro:bit.
> >> >
> >> > All that said though, on the Computing At School forums I saw the
> >> > following
> >> > query today:
> >> >
> >> >> The game could do with having sound effects. Anyone know
> >> >> of an easy way to attach a small speaker to a Micro:bit and
> >> >> generate sound effects? The only thing I’ve seen so far is the
> >> >> Kitronik “Don’t Steal My Micro:bit Alarm” project which uses a
> >> >> buzzer with simple ‘on’ or ‘off’ control.
> >> >
> >> > When micropython gets out there, people are going to be excited by
> >> > what's
> >> > already working here. (I know I am :-) )
> >> >
> >> > We don't need to make it perfect immediately, just leave the door open
> >> > to
> >> > the possible.
> >> >
> >> > For example, in Star Trek 2, when just before Spock goes into the
> engine
> >> > room, Leonard Nimoy was asked by the director Nick Meyer to say
> >> > "Remember"
> >> > in a mind meld fashion to DeForest Kelley (McCoy). (I'm carefully
> >> > avoiding
> >> > spoilers for those who haven't seen these things :-) )
> >> >
> >> > That wasn't actually in the script, but Nick Meyer had done enough TV
> to
> >> > understand how to add a place where a wedge could be placed to open
> new
> >> > doors. Likewise, I don't think we need to worry about bit banging wav
> >> > files
> >> > at this stage or implementing polyphony, but leaving the door open,
> >> > that's
> >> > cool.
> >> >
> >> >
> >> > Michael.
> >> >
> >> > On 15 October 2015 at 22:03, Nicholas H.Tollervey <ntoll at ntoll.org>
> >> > wrote:
> >> >>
> >> >> On 15/10/15 20:02, Larry Hastings wrote:
> >> >> >
> >> >> >
> >> >> > This guy wrote a simple MOD tracker for the TI 82 calculator:
> >> >> >
> >> >> >     https://www.youtube.com/watch?v=I6G0CnBSWVk
> >> >> >
> >> >> > I'll save you a trip to Wikipedia: that's got a 6Mhz Z80, an 8-bit
> >> >> > processor.  And he's getting /four/ voices out of it, not to
> mention
> >> >> > effects.
> >> >> >
> >> >> > Gentlemen, our monophonic bleeping and blooping just got TOLD.
> >> >> >
> >> >> >
> >> >> > Anybody know an audio rendering specialist?
> >> >> >
> >> >>
> >> >> That thud you heard in the distance... that was my jaw hitting the
> >> >> floor.
> >> >>
> >> >> ZOMG etc... :-)
> >> >>
> >> >> Nice find Larry, nice find..! I wonder if/how this is possible on the
> >> >> micro:bit...
> >> >>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> Microbit mailing list
> >> >> Microbit at python.org
> >> >> https://mail.python.org/mailman/listinfo/microbit
> >> >>
> >> >
> >> >
> >> > _______________________________________________
> >> > Microbit mailing list
> >> > Microbit at python.org
> >> > https://mail.python.org/mailman/listinfo/microbit
> >> >
> >> _______________________________________________
> >> Microbit mailing list
> >> Microbit at python.org
> >> https://mail.python.org/mailman/listinfo/microbit
> >
> >
> >
> > _______________________________________________
> > Microbit mailing list
> > Microbit at python.org
> > https://mail.python.org/mailman/listinfo/microbit
> >
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/mailman/private/microbit/attachments/20151016/24b2ccd2/attachment.html>


More information about the Microbit mailing list