My Thoughts and Know-how |
Displaying entries tagged with 'music'. Show all | |
Monosynth |
23 Feb 2012 |
Monosynth is a MIDI controlled monophonic synthesizer. The buttons change the menu and the slider inputs the parameter values Software
Block diagram
There are 2 concurrent threads of execution: a control thread for computationally intensive tasks, such as envelope updates and the user interface, and a fast sample generating thread that preempts everything else. MIDI messages are received by the serial interface interrupt handler and are quickly queued for parsing by the control thread. |
|
music electronics | Comment |
Sound Distorter |
06 Oct 2011 |
Sound Distorter runs mostly in software - a tool chain preprocesses a midi file so that it can be efficiently stored and played on the 8-bit Atmega168 microcontroller. After loading the chiptune midi file, sconv runs a series of filters to compact it and to preprocess operations to save cycles on the microcontroller. For example, instead of storing the tone (such as C#4), it could store the frequency. To be more efficient, it actually stores the wavetable offsets in samples per sample. Thus, playing a tone becomes a matter of just incrementing the wave-table index. The optimized file format I call .sad, short for sound distorter and the reminiscence of the C64 .sid should be obvious :) Finally, the .sad file gets converted to an assembly listing because the only way it can fit into the Atmega168 is in the text segment as program instructions.
The synth runs in 2 threads - a heavy-duty control thread that schedules events (such as note on, pitch-bend change, volume, etc.) and a fast, sample generating thread. The sample generator has real-time constraints and may preempt the control thread. To guarantee fairness, if overrun occurs and the control thread doesn't get to run, the synth drops (but does not delay) a sample. The sound generators use 2 shape wave-table - a sinusoid and a sharp, noisy wave. Besides the volume envelope, there is a blend envelope that linearly mixes the two shapes so that the sound changes in time. For example, during attack, primarily the noisy shape can be used, eventually resolving to a sinusoidal soft tone to mimic a plucking sound. Initially, I implemented FM modulation, but since the two wave shapes actually produce similar sound quality computationally much faster, I dropped it. There is also per channel pan mask to produce simple stereo effects.
The generated wave is then converted to an analog signal using 2 of the on-chip pulse-width modulators. To filter out the pulses and the bit flipping, the signals go through second order Sallen-Key low-pass filters. The circuit board. I feel I've made the project fairly easy to understand - code, schematic, mp3 and more pics. A secret prize goes to the one who figures out what the 3rd chip is for :) |
|
music electronics | Comment |
Home Top |