[Microbit-Python] A sound related long shot...

Damien George damien.p.george at gmail.com
Fri Oct 16 15:48:26 CEST 2015


I have managed to get proper synthesised audio out of the microbit,
using a hand-written PWM loop.  As a proof of principle, it can play a
short recorded sample.

Attached is the firmware.  I won't tell you what the sample is, so see
if you can find out!  Here are instructions:

1. download firmware.hex to the microbit
2. attach a speaker to pin0 and pin1 (don't use ground)
3. load up the serial terminal
4. execute: synth_run(10, 31, 3)
5. listen in awe!

You can adjust the numbers passed to synth_run to muck about with the sample.

With this we can basically play any audio, from a mod tracker to a
speech synth.  The only caveat is that it can't run in the background.
The loop needs full control of the CPU to get the audio to play
properly.

To answer Nicholas' questions:

1. Could this be done? Yes.
2. Would we want to do it? It would be cool if it (speech synth, or a
mod tracker, or ...) was implemented.
3. What would need to happen? We need to find someone with the time to
implement it!  It's a fair bit of work (but there are no barriers
except time).

The SAM software would be ideal, if only it were properly licensed.
Otherwise there's a fair bit of work to record all the 49 phonemes,
etc.

Maybe we can just provide some prerecorded samples (eg "exterminate")
and provide functions to adjust the pitch, echo, etc, and combine
sounds, and then play them?

D.




On Fri, Oct 16, 2015 at 1:37 PM, Larry Hastings <larry at hastings.org> wrote:
>
>
> On 10/16/2015 05:23 AM, Nicholas H.Tollervey wrote:
>
> Hi Folks,
>
> So I was thinking about the amazing example Larry posted yesterday of
> the 20yo calculator turned into a multi-part sequencer with effects etc...
>
> Could we do something just as amazing... would we even want to try..?
>
> Then I remembered - as a child of the 1980s I had an original BBC B at
> home and one of the most amazing feats Superior Software pulled off was
> a 7.5k program called, simply, "Speech!". To give you an idea of what it
> was like I found this on YouTube:
>
> https://www.youtube.com/watch?v=t8wyUsaDAyI
>
>
> The equivalent for computers manufactured outside Britain was "Software
> Automatic Mouth", or "SAM", available for the Apple ][, Atari 400/800, and
> Commodore 64.
>
> Some enterprising hacker has taken the C=64 version, compiled the assembler
> into messy C, cleaned it up (some), and put it up on Github:
>
> https://github.com/s-macke/SAM
>
>
> He then used Emscript to translate that into Javascript, and behold: web
> page demo.
>
> http://simulationcorner.net/index.php?page=sam
>
>
> (Aside: cripes, modern computers are fast.  Just imagine how awful this code
> is, and what a Rube Goldberg machine its runtime must be like.  Yet it runs
> in the tiniest fraction of a second.)
>
> So, thoughts..? Is this even possible..? I imagine a very simple API
> such as this:
>
> import microbit
> microbit.say("Hello, World")
> microbit.say("Hello, World", pin=microbit.pin1)  # Lke music API
>
>
> Possible, yes.  But I don't know anything about voice synthesis, so I could
> hardly write one myself.  And even if SAM is "abandonware", legally somebody
> still owns the copyright, so I wouldn't ship that specific implementation.
>
>
> /arry
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firmware.hex
Type: application/octet-stream
Size: 474172 bytes
Desc: not available
URL: <https://mail.python.org/mailman/private/microbit/attachments/20151016/9e539879/attachment-0001.obj>


More information about the Microbit mailing list