How to convert 8-bit information containing MIDI note, to square wave signal using basic chips and components? [closed]

Using basic electronic components (capacitors, transistors, etc) and/or chips (555, 74 series, etc) how do I convert from:

Input: 8-bits containing the binary representation of a MIDI number "m", example: 0b1001000 (72) for the note C5

Output: A square wave with frequency corresponding to that note "f", example: 523Hz for the note C5

I'm intending to build this on a breadboard to connect to a basic computer also on a breadboard.

My initial approach was for the output to come from a 555 chip configured in an astable state, with the input somehow manipulating the capacitance/resistance of the components used with the 555. The part in particular I'm struggling with is the fact that f is proportional to 2^(m/12) and I can't think of a way to combine the input in a non-linear way to get this exponential behaviour.

Edit: Clarification on the nature of the connected computer and the project: I've been following along with Ben Eater's 8-bit breadboard computer series on youtube, so the computing capabalities are very primitive (I can load/store 8-bit values, and add and subtract them).

As an extension of this project, I had the idea to store MIDI value notes in memory, and output them to some module that will create a square wave that makes a peizo/buzzer produce the note. The goal of the project in general is not to "cheat" by using chips that I don't fully understand the inner workings of, so limiting myself to basic chips. In some cases the project uses more complicated chips where the underlying principle is understood but would be laborious to implement (e.g. using a whole chip is a register, when I already understand and know how to build flip-flops; or programming and using a CMOS SRAM chip for the 7-segment decoder etc).

closed as too broad by Chris Stratton, Voltage Spike, Finbarr, RoyC, Warren HillMar 27 at 19:13

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• You can get from a linear resistor network to an exponential function by using a diode in forward direction. An op-amp will be helpful doing this. – Janka Mar 24 at 23:41
• Just curious, but if you have a basic computer also on [the] breadboard then why not generate the frequency with software? I'm not sure I understand the need for additional external parts. – jonk Mar 25 at 0:06
• You cannot. Period. You need a computational element to do this, realistically one which runs software. That likely need be nothing more physically than a modern MCU, but it is a far cry from your 555, 74xx, and discretes. – Chris Stratton Mar 25 at 6:36

The MIDI note number (0 to 127) denotes a note on a 12-tone scale, with note #69 representing the A above middle C at 440 Hz.

Therefore, the exact fundamental frequency of any note number N is

$$F_{note} = 440\text{ Hz} \cdot 2^{\frac{N-69}{12}}$$

Manipulating the resistance and/or capacitance around a 555 timer to get these frequencies is probably not the right way to go about this. I suppose you could build a big decoder and drive a long string of adjustable resistors to get the different notes. Tuning such a beast would be an exercise in frustration!

In the analog synthesizer world, you would feed the note number to a digital-to-analog converter to create a (linear) control voltage (usually in the range of 0 to 10 V), and then feed that voltage to a VCO that has been designed to produce the correct (exponential) frequency for the given voltage. The design of such VCOs is far from trivial, but you can purchase them from several sources.

A much more practical approach, especially if you have a "basic computer" (whatever that means) at your disposal is to use "direct digital synthesis" to produce aribtrary frequencies.

Let's suppose your computer can process interrupts at a rate of 10,000 per second. On each interrupt, you add a "delta" value to a 24-bit accumulator, and output the MSB of the accumulator as your signal.

If the "delta" value is 1, the accumulator will require 224 interrupts to overflow, and the output signal will cycle at a rate of $$\\frac{10000}{2^{24}} = 0.000596\text{ Hz}\$$. If the "delta" value is 2, the output signal will cycle at twice that rate, or 0.001192 Hz, and so on.

If you use a delta of $$\440\cdot\frac{2^{24}}{10000} = 738198\$$, you'll get an output frequency of 440.000296 Hz, which is close enough for most purposes. The point is, if you plug the frequencies from the first equation into this last expression, you can directly synthesize the square waves you're looking for. If you don't want to do the math on the fly, just use a lookup table to produce the correct "delta" value for each MIDI note number.

Receiving MIDI is typically handled by an UART, and many microcontrollers have UARTs built-in. Receiving serial data with 74 series logic chips is not impossible but I don't see the point as it would be the hardest part. If done with a mkcrocontroller it can also generate the square waves with enough precision to be in tune. MIDI messages are not simply 8-bit note data, there is a command byte which will tell what command is sent on which MIDI channel, and Note On and Note Off commands have two parameters, the 7-bit note number you described but also velocity how fast that key was actuated. Also Note On with zero velocity means Note Off. And the command byte is not always sent if it was same as previously (running status). So this is why microcontroller is typically used to receive and decode MIDI messages.

You should research some DIY synthesizer and analog and Eurorack synth solutions, even if it's just to see how those communities are doing it. Some post their schematics online or also as open source.

Here's a basic overview: MIDI note data is received by a "module" or block of components (usually some type of microcontroller is involved) that converts that note into a CV (control voltage) signal. That CV signal then can control, among other things, a VCO (voltage controlled oscillator) to the desired pitch.

Then there are the different standards that different manufacturers use for their VCOs.

• Volts per Octave: Each volt equals 1 octave. If 2V=A2, 3V=A3, 4V=A4, etc. This scheme was popularized by Moog in the ’60s. Today it is probably the most popular scheme, and is used in most modern modular synths.

• Hertz per Volt: Each octave equals a doubling or halving of the voltage. If 2V=A2, 4V=A3, 8V=A4, etc. This scheme is mostly found in Yamaha and Korg synths.

• And there are others out there, too.

It's a fairly complex subject but obviously, lots of people go about making projects/products using these methods. There are lots of resources on the web. Not sure what your real goal is, but maybe this will get you headed in the right direction.

Also, here are some examples of MIDI to CV converters: https://www.midi.org/articles-old/the-top-5-midi-to-cv-converters-in-2018