Snippet - Rttl to Tunes.Melody

I just posted Rttl to Tunes.Melody on Codeshare. Feel free to discuss and make suggestions here.

3 Likes

Very cool! Thanks for sharing.

Really nice! Is there a way to modify the volume?

@ RoSchmi - thanks - mmm I didn’t write the Tunes module, just something to generate Tunes for it, youll have to ask GHI about volume, but since its just a pin going up and down, I doubt it

Very nice!

Thanks for sharing the code…

I have a Cerbuino Bee and a tunes module and had to make a small change:

tunes.Play( melody ); ----> tunes.Play( melody.toMelody() );

Now it works fine. Thank you very much for your example.

I tried this example with Cerberus and I get exception. (Always after x seconds playing).
The exception is:

[quote]A first chance exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.PWM.dll
An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.PWM.dll
Uncaught exception
The thread ‘’ (0x7) has exited with code 0 (0x0).[/quote]

I figure it out if I remove al ,p from demo, it plays well.
“BarbieGirl:d=4,o=5,b=125:8g#,8e,8g#,8c#6,a,p,8f#,8d#,8f#,8b,g#,8f#,8e,p,8e,8c#,f#,c#,p,8f#,8e,g#,f#”;

@ Makla - Have you tried more than one RTTL sequence?

I found (on a Spider, IIRC) that some sequences worked OK for me, while others would throw an exception. I haven’t had time to troubleshoot, so I’ve no idea why some work and others don’t.

I’m betting it’s something simple, though, so I’d you can find an RTTL sequence that works for you, you might be able to compare the two and figure out what’s different.