YAMB yet another music box

Keep a log of a project build here. Be sure to include pictures and as much documentation as possible.

YAMB yet another music box

Postby semicolo » October 31st, 2012, 3:12 pm

Hi there, I was trying to make a music box with a microcontroller as already seen on had and found I had trouble understanding the source code. Long story short it didn't work, so I made some experiments on my computer instead of the micro, it's easier to debug and it's faster to tinker with the parameters.
Here's the result, I kept the python scripts from the other project, changed the tune for Amelie Poulain's waltz.
The code is now easier to adapt and understand (IMOO), you can easily change the sample rate and envelope duration.

I generated an ogg file but had won't allow me to attach it.

You'll need sox to convert the raw signed 8 bit generated file to wav.

Next step is to try it on an arduino or my freshly received launchpad.
Attachments
yamb.zip
(32.75 KiB) Downloaded 62 times
User avatar
semicolo
 
Posts: 268
Joined: December 13th, 2011, 3:32 pm

Re: YAMB yet another music box

Postby semicolo » October 31st, 2012, 3:13 pm

Stupid me, just need to zip the sound file to go around the site's limitation.
Attachments
tune.zip
(1 MiB) Downloaded 58 times
User avatar
semicolo
 
Posts: 268
Joined: December 13th, 2011, 3:32 pm

Re: YAMB yet another music box

Postby semicolo » November 27th, 2012, 8:00 pm

Well, it looks like I suck at optimizing c code on microcontrollers, I had to decrease the output sample rate to 6250Hz on the arduino for 6 channels and down to 7812Hz on the launchpad and use fixed point numbers with 4 bits after the point, sound is not good enough to my taste.
Here are the projects if someone wants them.

I had an unused 8MB sd and the arduino can easily play 8bits sound at 31250Hz while reading from it, so that's what I'll be using, sounds a lot better that way.
Attachments
yamb-launchpad.zip
(91.82 KiB) Downloaded 56 times
musicbox-arduino.zip
(12.04 KiB) Downloaded 51 times
User avatar
semicolo
 
Posts: 268
Joined: December 13th, 2011, 3:32 pm

Re: YAMB yet another music box

Postby semicolo » December 28th, 2012, 12:47 pm

Here are some pictures of the finished project, the final board uses a TI MSP430g2452 and an Atmel AT25DF32 SPI flash memory that holds the 8bits unsigned samples played by the CPU at 31250Hz using a 62500Hz pwm.
Everything's hidden in the side of a homemade wooden box. Mains voltage is held off by the switch unless the top of the box is open.

yamb1.JPG
yamb1.JPG (222.65 KiB) Viewed 1411 times


yamb2.JPG
yamb2.JPG (210.14 KiB) Viewed 1411 times
User avatar
semicolo
 
Posts: 268
Joined: December 13th, 2011, 3:32 pm

Re: YAMB yet another music box

Postby semicolo » June 22nd, 2013, 1:25 pm

Finally got a video of the box playing and a photo of the finished box, I've put together a description of the project on the hackster.io website:
http://beta.hackster.io/projects/31-YAMB
User avatar
semicolo
 
Posts: 268
Joined: December 13th, 2011, 3:32 pm


Return to Project Logs

Who is online

Users browsing this forum: No registered users and 1 guest