Markov Music Box

markov summary

Traditional music boxes play one or two tunes very well, but are not very interactive. Put differently, they have a high quality of synthesis, but a fixed-pattern note sequencer and fixed tonal quality. I wanted to build a device which would play an interesting music-like note sequence, which constantly changed and evolved, with settable timbre, tempo, and beat.Markov Music Box
To synthesize nice sounding musical notes you need to control spectral content of the note, the rise time (attack), fall time (decay), and the change in spectral content during attack and decay. Also it is nice to have at least two independent musical voices. And all of this has to be done using the modest arithmetic capability of an 8-bit microcontroller. We use Atmel atmega-series MCUs. The scheme used for the attack and decay envelope was to generate the product of two exponentials, a saturating rise exponential and an exponential decay. The process to convert this complicated sounding envelope into fixed point shifts and adds (and one integer multiply) will be covered below. The spectral content of the notes was enriched using FM modulation, which is widely used for musical and special effects. Since directly computing sine waveforms is also mathematically heavy, direct digital synthesis (DDS) was used to produce waveforms. The DDS scheme explained below is used to generate both the FM modulating sine wave signal and the fundamental sine wave for the musical note.
WINAVR GCC program. (Circuit Cellar version) For Markov music box running on atmega644 or atmega1284 at 16 MHz. Pin B.3 is the PWM output connected through a 10,000 radian/sec lowpass filter to amplified speakers. Port C is hooked to 8 pushbuttons which control transition matrix, tempo, beat pattern, and timbre for each voice.
Published in Circuit Cellar Magazine, #272, pp 28-32, March 2013  (Manuscript) Full algorithm details are in the manuscript.
Examples

References
Markov Music Box Examples and code:
http://people.ece.cornell.edu/land/courses/ece4760…Schematic Markov Music BoxFor more detail: Markov Music Box


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top