Skip to main content
Topic: Music Box / Wavetable Synthesizer / DDS (Read 37186 times) previous topic - next topic

Music Box / Wavetable Synthesizer / DDS

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:

[attachment=5]
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:

[attachment=4]
Since I wanted to fit everything inside the speaker-case, the soldered circuit is quite minimalistic:

[attachment=3]
[attachment=2]
Here the inside of the case can be seen without and with my circuit installed:

[attachment=1]
[attachment=0]
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

Reply #1
As promised, here is the source code.

Re: Music Box / Wavetable Synthesizer / DDS

Reply #2
1337 soldering skills ;)

Re: Music Box / Wavetable Synthesizer / DDS

Reply #3
Amazing work as always. The source is pretty simple, it looks like most work went into the audio conversion scripts.
Got a question? Please ask in the forum for the fastest answers.

Re: Music Box / Wavetable Synthesizer / DDS

Reply #4
@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

Reply #5
dedbug lives!

Re: Music Box / Wavetable Synthesizer / DDS

Reply #6
Great! How can write other tunes?

Re: Music Box / Wavetable Synthesizer / DDS

Reply #7
[quote author="Markus Gritsch"]@Sjaak: Thanks.  It's not close to your QFN soldering skills, but sufficient for this basic stuff :)
[/quote]

Haha also thanks ;)

Re: Music Box / Wavetable Synthesizer / DDS

Reply #8
[quote author="Gianni"]Great! How can write other tunes?[/quote]
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

Reply #9
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

Reply #10
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

Reply #11
@Markus
awsome project !!! 
and it sounds pretty good too !
:-)

Re: Music Box / Wavetable Synthesizer / DDS

Reply #12
[quote author="Gianni"]I don't understand why the music on my prototype is played slower than the video... Schematic and code are the same...[/quote]
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

Reply #13
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

Reply #14
Sorry!! Doesn't work exactly the same!!
I've Just put the optimization level to 1 and now works great!