Simple DIY Electronic Music Projects<p><strong>Minimalist Lo-Fi Minimalism</strong></p><p>Whilst I’m not an ardent fan of Philip Glass, (more like an amateur enthusiast), there are certain pieces of his that I do really quite like. The violin concerto goes without saying – some parts of that are wonderful. And I quite like the Low Symphony based on the music of David Bowie.</p><p>But the piece I like the most, but really have to be in the right mind for, is his opera <a href="https://en.wikipedia.org/wiki/Einstein_on_the_Beach" rel="nofollow noopener" target="_blank">Einstein on the Beach</a>. The last time I saw through the whole thing was when it was <a href="https://www.elbphilharmonie.de/en/mediatheque/philip-glass-einstein-on-the-beach/803" rel="nofollow noopener" target="_blank">live-streamed by Elbphilharmonie</a> back in 2023 with the narrative poems read by Suzanne Vega. It was quite something.</p><p>But when you think about it, minimalist music actually ought to go quite well with microcontrollers, so this is a short experiment into programmatic minimalism by attempt to capture the essence of one of the movements of Einstein on the Beach – the Knee Play 1.</p><p><a href="https://makertube.net/w/5TiaDYBYDfRTp7XKq86ZLH" rel="nofollow noopener" target="_blank">https://makertube.net/w/5TiaDYBYDfRTp7XKq86ZLH</a></p><p><em><strong>Warning!</strong> I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!</em></p><p>If you are new to Arduino, see the <a href="https://diyelectromusic.wordpress.com/getting-started/" rel="nofollow noopener" target="_blank">Getting Started</a> pages.</p><p><strong>Parts list</strong></p><ul><li><a href="https://diyelectromusic.com/2022/03/14/pi-day-midi-sequencer/" rel="nofollow noopener" target="_blank">Pi Day MIDI Sequencer</a></li><li>MIDI Synth Module configured as follows:<ul><li>Channel 1 – organ</li><li>Channel 2 – lower voices</li><li>Channel 3 – higher voices</li></ul></li></ul><p><strong>The Circuit</strong></p><p>I’ve used the circuit from my <a href="https://diyelectromusic.com/2022/03/14/pi-day-midi-sequencer/" rel="nofollow noopener" target="_blank">Pi Day MIDI Sequencer</a> which is a I2C connected 4-digit seven segment display and a MIDI interface.</p><p><strong>The Code</strong></p><p>The seven segment display code was well covered in my previous projects so I won’t repeat that here now.</p><p>The code supports four tracks of music as follows:</p><ul><li>Ostinato, sustained bass in the organ part.</li><li>Two voice parts. These would ordinarily sing the numbers but I’m just having them “ooh” and “aah”.</li><li>A numbers part. This will actually display the numbers to match the notes being “sung”.</li></ul><p>There is an array the top of the sketch with the main detail for a single full pass through the three bars of the main phrase. The three bars have 4, 6, and 8 beats in them and this pattern repeats in various different ways throughout the movement.</p><p>Musically there are three passes through this phrase with the bass only. Then there are two instances where the voices join in. From that point onwards the score shows a missing note at the start of one of the bars for the voices – different missing notes create variations of the music.</p><p>This is where I’ve gone more programmatic with the code in that I’m not encoding the entire score as written, but instead have a random number generator which picks a random number between 0 and 3 and depending on the result will skip the first beat of bar 1, 2 or 3, or if the result was 0 then it will play all bars fully. One of the benefits of my approach of course is that the music could go on indefinitely.</p><p>As the music has a steady pulse to it, I’ve encoded the 18 beats as a step sequencer with 36 steps. This allows me to have some silence between each sung note. The sequencer works as follows:</p><ul><li>For voices, store a MIDI note number; 0 for a rest; or -1 to continue the previous note.</li><li>For numbers, store the number; 0 for blank (0 is not used in the music); or -1 to continue the previous state.</li><li>For the bass/organ – same as for the voices.</li></ul><p>Here is the entire sequence for all four parts.</p><pre>#define STEPS 36<br>uint8_t bass[STEPS] = {<br>45,-1,-1,-1,-1,-1,-1,-1,43,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1<br>};<br>uint8_t ten[STEPS] = {<br>57,0,57,0,57,0,57,0,55,0,55,0,55,0,55,0,55,0,55,0,48,0,48,0,48,0,48,0,48,0,48,0,48,0,48,0<br>};<br>uint8_t sop[STEPS] = {<br>60,0,60,0,60,0,60,0,62,0,62,0,62,0,62,0,62,0,62,0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64,0<br>};<br>uint8_t num[STEPS] = {<br>1,-1,2,-1,3,-1,4,-1,1,-1,2,-1,3,-1,4,-1,5,-1,6,-1,1,-1,2,-1,3,-1,4,-1,5,-1,6,-1,7,-1,8,-1<br>};</pre><p>I have to keep track of the current bass or voice note playing per channel so I can send an appropriate MIDI NoteOff message when required.</p><p>The general logic for playing a step for the bass or voice parts is as follows:</p><pre>void doBass (int i) {<br> if (bass[i] == 0) {<br> // Rest<br> if (lastbass != 0) {<br> MIDI.sendNoteOff(lastbass, 0, MIDI_CHANNEL_BASS);<br> }<br> lastbass = 0;<br> } else if (bass[i] < 128) {<br> // New note<br> if (lastbass != 0) {<br> MIDI.sendNoteOff(lastbass, 0, MIDI_CHANNEL_BASS);<br> }<br> MIDI.sendNoteOn(bass[i], 64, MIDI_CHANNEL_BASS);<br> lastbass = bass[i];<br> } else {<br> // do nothing<br> }<br>}</pre><p>This is the logic for playing one step of the bass part. It is repeated for the voices too.</p><p>Sequence wise, I have several routines that decide which parts of the piece is being performed. There are three main sections:</p><ul><li>Introduction – three times through the bass phrase only.</li><li>Two full passes of bass and voices (and numbers).</li><li>Introduce the randomness to start skipping the first beat of certain bars.</li></ul><p>And then I essentially repeat the last step ad infinitum.</p><p><a href="https://github.com/diyelectromusic/sdemp/tree/main/src/SDEMP/PhilipGlassKnee1" rel="nofollow noopener" target="_blank">Find it on GitHub here</a>.</p><p><strong>Closing Thoughts</strong></p><p>My initial thought was to use three Arduino tones to perform the piece, then I wondered about just building a “MIDI to numbers” device and adding it to my Lo-Fi Orchestra.</p><p>Finally, I settled on using MIDI generated from the Arduino as part of its scheduling of the numbers to display. I think that was the right choice and is a nice balance of useful timbres, suitably minimalist programming, and something vaguely reminiscent of the original.</p><p>It also has the advantage that, in true minimalist style, this short sketch could keep playing for as long as I want. Certainly, for as long as the entire opera and much longer if required.</p><p>Kevin</p><p></p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/arduino-uno/" target="_blank">#arduinoUno</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/define/" target="_blank">#define</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/ht16k33/" target="_blank">#ht16k33</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/loficlassical/" target="_blank">#loficlassical</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/midi/" target="_blank">#midi</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/minimalism/" target="_blank">#Minimalism</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/philip-glass/" target="_blank">#PhilipGlass</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/seven-segment-display/" target="_blank">#sevenSegmentDisplay</a></p>