Music Box / Wavetable Synthesizer / DDS

A place to document your own projects.

Music Box / Wavetable Synthesizer / DDS

Postby Markus Gritsch » Mon Jan 16, 2012 8:18 am

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
User avatar
Markus Gritsch
Sr. Member
Sr. Member
 
Posts: 271
Joined: Tue Feb 09, 2010 6:54 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Markus Gritsch » Mon Jan 16, 2012 8:18 am

As promised, here is the source code.
Attachments
music_box_2012-01-15.zip
(178.22 KiB) Downloaded 1511 times
User avatar
Markus Gritsch
Sr. Member
Sr. Member
 
Posts: 271
Joined: Tue Feb 09, 2010 6:54 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Sjaak » Mon Jan 16, 2012 9:16 am

1337 soldering skills ;)
User avatar
Sjaak
Fellow
Fellow
 
Posts: 3039
Joined: Sun Jan 03, 2010 2:45 pm
Location: Hiero

Re: Music Box / Wavetable Synthesizer / DDS

Postby ian » Mon Jan 16, 2012 10:48 am

Amazing work as always. The source is pretty simple, it looks like most work went into the audio conversion scripts.
User avatar
ian
Crew
Crew
 
Posts: 10578
Joined: Mon Jul 06, 2009 6:14 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Markus Gritsch » Mon Jan 16, 2012 10:59 am

@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 ;)
User avatar
Markus Gritsch
Sr. Member
Sr. Member
 
Posts: 271
Joined: Tue Feb 09, 2010 6:54 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby sqkybeaver » Mon Jan 16, 2012 11:06 am

dedbug lives!
User avatar
sqkybeaver
Hero Member
Hero Member
 
Posts: 1095
Joined: Tue Dec 07, 2010 8:50 am
Location: New Hampshire, USA

Re: Music Box / Wavetable Synthesizer / DDS

Postby Gianni » Mon Jan 16, 2012 11:20 am

Great! How can write other tunes?
Gianni
Newbie
Newbie
 
Posts: 11
Joined: Wed Jun 01, 2011 1:09 am
Location: Italy

Re: Music Box / Wavetable Synthesizer / DDS

Postby Sjaak » Mon Jan 16, 2012 11:21 am

Markus Gritsch wrote:@Sjaak: Thanks. It's not close to your QFN soldering skills, but sufficient for this basic stuff :)


Haha also thanks ;)
User avatar
Sjaak
Fellow
Fellow
 
Posts: 3039
Joined: Sun Jan 03, 2010 2:45 pm
Location: Hiero

Re: Music Box / Wavetable Synthesizer / DDS

Postby Markus Gritsch » Mon Jan 16, 2012 2:53 pm

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.
User avatar
Markus Gritsch
Sr. Member
Sr. Member
 
Posts: 271
Joined: Tue Feb 09, 2010 6:54 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Gianni » Mon Jan 16, 2012 3:32 pm

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.
Gianni
Newbie
Newbie
 
Posts: 11
Joined: Wed Jun 01, 2011 1:09 am
Location: Italy

Re: Music Box / Wavetable Synthesizer / DDS

Postby Gianni » Thu Jan 19, 2012 2:09 pm

I don't understand why the music on my prototype is played slower than the video... Schematic and code are the same...
Gianni
Newbie
Newbie
 
Posts: 11
Joined: Wed Jun 01, 2011 1:09 am
Location: Italy

Re: Music Box / Wavetable Synthesizer / DDS

Postby voidptr » Thu Jan 19, 2012 2:25 pm

@Markus
awsome project !!!
and it sounds pretty good too !
:-)
voidptr
Full Member
Full Member
 
Posts: 244
Joined: Fri Oct 08, 2010 5:58 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Markus Gritsch » Thu Jan 19, 2012 2:33 pm

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?
User avatar
Markus Gritsch
Sr. Member
Sr. Member
 
Posts: 271
Joined: Tue Feb 09, 2010 6:54 am

Re: Music Box / Wavetable Synthesizer / DDS

Postby Gianni » Thu Jan 19, 2012 2:46 pm

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.
Gianni
Newbie
Newbie
 
Posts: 11
Joined: Wed Jun 01, 2011 1:09 am
Location: Italy

Re: Music Box / Wavetable Synthesizer / DDS

Postby Gianni » Thu Jan 19, 2012 2:48 pm

Sorry!! Doesn't work exactly the same!!
I've Just put the optimization level to 1 and now works great!
Gianni
Newbie
Newbie
 
Posts: 11
Joined: Wed Jun 01, 2011 1:09 am
Location: Italy

Next

Return to Project logs