Music box...


hamster

Recommended Posts

I've finally got my 'Synth' project to the point that it can act as an OK sounding music box:

http://www.hamsterwo.../Synth_Envelope

http://youtu.be/XRITkbgBR4c

It plays Brahms Lullaby in monophonic glory! One pair of switches changes between a Sine wave and a richer waveform I made in a spreadsheet. Other pairs control the envelope (Attack, decay and release rates). I'm thinking of using the ADC on the LogicStart to give me analogue control inputs...

It only 'does stuff' one clock cycle in 666 of the 32MHz clock, so there is plenty of scope to move to direct digital synthesis or massive polyphony.

Buried on the related pages are the C utilities to convert arrays to either 9 or 18 bit BRAM VHDL instances...

This post has been promoted to an article

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Just FYI that posted bit file doesn't work on the P1-500K as the name suggests. I grabbed the code from the link and noticed it's set in the .ucf to use the 250K. Changed that and was able to build it for the 500K no problem and it works. Neat!

 

Now to figure out how to make some different tunes.

Link to comment
Share on other sites

  • 3 weeks later...

I was annoyed by the very long pause between looping the short melody so I added this (in bold):

 

process(clk32)
  begin
    if rising_edge(clk32) then
      if count = 666 then
          score_counter <= score_counter + 4;
           count         <= (others => '0');

              if score_counter = 8192000 then
               score_counter <= (others => '0');
              end if; 
 

 

All this does is reset score_counter when it reaches 8,192,000 rather than wait for it to hit 16,777,215 and wrap around. A much cleaner solution would be to place some sort of "end of tune" marker in the RAM that stores the melody and reset score_counter at that, but this was a quick and easy addition while I was playing with counters.

 

Now what we need is a brief tutorial on creating new melodies. It would also be cool to be able to connect some sort of input device to play notes manually.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.