Page 1 of 3

Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 8:18 am
by Markus Gritsch
Hi,

being inspired by another project of ChaN [1] I decided to build my own music box. The theory is described in detail on ChaN's page, so I won't repeat it here. Instead of an ATtiny, mine uses a PIC32 and has therefore enough processing power to play up to 64 notes simultaneously:

schematic.jpg

As a case I used a pair of cheap active speakers for the very competitive price of 3.50 €. They can be seen here together with the breadboarded circuit:

IMG_6330.JPG

Since I wanted to fit everything inside the speaker-case, the soldered circuit is quite minimalistic:

IMG_6337.JPG

IMG_6338.JPG

Here the inside of the case can be seen without and with my circuit installed:

IMG_6342.JPG

IMG_6344.JPG

A video of the device in action is available on YouTube: http://youtu.be/dt3rpgWyKno

Please find the source code attached to the next post, as there seems to be a limit of 6 attachments per posting.

Have fun,
Markus

[1] http://elm-chan.org/works/mxb/report.html

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 8:18 am
by Markus Gritsch
As promised, here is the source code.

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 9:16 am
by Sjaak
1337 soldering skills ;)

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 10:48 am
by ian
Amazing work as always. The source is pretty simple, it looks like most work went into the audio conversion scripts.

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 10:59 am
by Markus Gritsch
@Sjaak: Thanks. It's not close to your QFN soldering skills, but sufficient for this basic stuff :)

@ian: It's always just a matter of getting the numbers right ;)

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 11:06 am
by sqkybeaver
dedbug lives!

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 11:20 am
by Gianni
Great! How can write other tunes?

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 11:21 am
by Sjaak
Markus Gritsch wrote:@Sjaak: Thanks. It's not close to your QFN soldering skills, but sufficient for this basic stuff :)


Haha also thanks ;)

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 2:53 pm
by Markus Gritsch
Gianni wrote:Great! How can write other tunes?

By taking a look into the source code :) In the 'dds' folder you can find a script called 'midi2h.py'. Prepare a nice MIDI file (stripping the percussion track for exampe is a good idea), and use the script to generate the data which you can put into the tune header file.

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Mon Jan 16, 2012 3:32 pm
by Gianni
Yes, I'm just looking at it now.. I'm new to python scripting.
I've tried to run midi2h.py with the still_alive.mid tune but the numbers script gave me are very different from those in the source code.

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Thu Jan 19, 2012 2:09 pm
by Gianni
I don't understand why the music on my prototype is played slower than the video... Schematic and code are the same...

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Thu Jan 19, 2012 2:25 pm
by voidptr
@Markus
awsome project !!!
and it sounds pretty good too !
:-)

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Thu Jan 19, 2012 2:33 pm
by Markus Gritsch
Gianni wrote:I don't understand why the music on my prototype is played slower than the video... Schematic and code are the same...

Is it only slower or also deeper? How much slower? Twice as slow? Are you using the exact same MCU? Different MCU and different config bits for generating the clock? Further: are you using the provided MPLAB X project, or have you created your own project? It must be compiled with -O1 to get 64 oscillators. What happens if you reduce to e.g. 32?

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Thu Jan 19, 2012 2:46 pm
by Gianni
Twice as slow, and deeper. yes. I've created a new project using MPLAB IDE 8.80, MCU is the same.
If I use "OSCILLATOR_COUNT 32" works same as yours.

Re: Music Box / Wavetable Synthesizer / DDS

PostPosted: Thu Jan 19, 2012 2:48 pm
by Gianni
Sorry!! Doesn't work exactly the same!!
I've Just put the optimization level to 1 and now works great!