So I've been working with AVR 1-bit stuff over the last year as part of my PhD. I knocked up this incredibly basic 1-bit MIDI synthesizer in C a few months ago for a live performance. I've uploaded the code / schematics here if it's of any use. It uses the Arduino MIDI Library.

Example output here.

All of this is incredibly rough and originally made for my own benefit / reference. If you're using an Arduino you can ignore most of the schematic as this section below is basically the Arduino MIDI shield. You can build it yourself for like £5 (if not less).

MIDI IN circuit

The audio output circuit is rough, with no isolation, DC offset correction or lowpassing. Basically, just be aware that, while you can probably run a line in to most stuff, this is not 100% reliable or safe. If in doubt, headphones will do you absolutely fine. Also I personally love hearing the crackly 'brightness' of the upper harmonics, but add RC filter to taste.

Like I said, I knocked this up quickly so the code isn't commented, efficient or organised particularly sensibly. If there's interest in this I don't mind going through and commenting, but, Shiru, I think you've got a waaaaay better tone generation system in your other routines, so you could probably just slot it in (keeping aware of timer conflicts with the MIDI library, if you choose to use it). Additionally, I don't mind uploading better schematics, STLs for the 3D printed case etc.

Feel free to amend. At some point I was going to add pitch bend support, ADSR enveloping, vibrato and more effects, but it wasn't needed for the original project.

I'm a total n00b at all this, so any suggestions / pointers would also be very much appreciated.

EDIT -
If you fancy playing around with the synth, CC#1 is decay / sustain (it was originally two separate controls, but the difference between the two wasn't great enough) and CC#2 is 'volume', where the pin-pulse output is interleaved with silence. Channel 1 is pulse waves, channel 2 is PWM drums.

ANOTHER EDIT -
I know the Teensy can appear as a USB MIDI device, so you could ditch the outboard MIDI gear entirely.

2

(4 replies, posted in Other Platforms)

Thought I'd drop by to say that I'm damn impressed by your recent conversions, Shiru. Very cool indeed. Been playing about with them today. They're pretty elegantly ported to C and very accessible to beginners and AVR C programmers.

Like it man.

Naw it's cool. I'm bored anyway.

Okay, number 1...

idea

Number 2...

idea

Or something else?

Okay, here's another.

idea

And another.

idea

idea

Yeah, I get you. What about this?

idea

What about something like this, with a monochrome, tiled triangle pattern as the bg?

Yeah sure, if it'll help anyone I'll post some code at some point. It's nothing fancy whatsoever, just wrapping my head around the usual tricks in a relatively simple environment. (Cheers utz for the incredible documentation.)

I GET IT. Spent some quality time deciphering your tutorial (not ASM fluent, even with the pseudo-code it took time). I got PFM working pretty easily, but it was only when I stumbled upon something you'd said on worldofspectrum.org that pulse interleaving finally clicked:

utz wrote:

What you do is alternate the outputs of ch1 and ch2 quickly, about every 20 ms or so.

THAT'S how you avoid interaction between the waveforms. It's so bloody simple (but brilliant), I'd been completely overcomplicating it.

Thanks for pointing me in the right direction. Going to try and implement some of your other tricks now. ;D

Firstly, hey 1-bit music forum. First post, long-time lurker.

Okay, so I'm trying to combine a bunch of software timers, generating variable width pulse functions, into a single output pin. I've posted the topic here because I'm currently using an ATMega128, but the question's probably hardware agnostic.

I can easily bit bang multiple pins and combine the output electronically (in the subsequent analog domain), just, it's a bit inelegant and I'm stumped as to combining them in software (without using PWM to emulate an analog waveform, which is cheating). The problem is, when I get multiple channels to flip the pin, I usually get a resultant single pitch with unwanted duty cycle modulation, which sounds cool but not really what I'm after. This is minimised with simple frequency ratios such as 2:1 or 3:2, but even 5:4 or 6:5 will fail to create polyphony.

How is this done on other 1bit platforms? Is there a solution? I personally cannot see how discrete pitches can be preserved when each interacts with the other, especially when I only have two states. The vital high-time of one wave is flipped to low for another, affecting the perceived pitch. I also have no idea how pulse and noise could be run simultaneously on a single pin without only noise audible.

Would XORing the channels help? Perhaps using pin pulse modulation to minimise duty cycle interaction?

Any thoughts would be much appreciated.