Tuesday, April 23, 2019

Conbrio Gate Generator. The Sounds of Nature?

Good news....I finally finished a project I started last year.

Goes like this:

I was watching a PBS show about fractals, and thought, if fractals are everywhere in nature, how about in audio?  Not entirely sure that makes sense, but it's not hard to emulate: create a looped sequence (DAW, sequencer, or whatever) and then speed it up faster and faster.

Tried that. Not much point really. Sounds like the very end of "Karn Evil 9" I guess.  Been done!

It's always good to go back to being 15 again, digging ELP, but at a certain point sped up gates  smash all the audio everything together. Not my personal favorite.

OK now what? I put the idea on the shelf for awhile but then one beautiful California spring day had another thought: semi-random-ish, increasing tempo sound patterns are indeed common in nature: birdsong for instance, body functions (sorry!), the pitch of a cry or wail, laughter.
Insects?  Water coming out a a faucet?  It's there.

Q: in an analog world, how to emulate it?

OK my attempt at solving this resulted in this module:

Yep it's the "Con Brio" pattern generator.

It's a cross between a gate generator where the output gate signal speeds up and slow down and a random gate pattern generator.  For whatever reason, it came out pretty....sped up/slowed down and not quite random. I can get interesting patterns out of it, but seem to never be able to get the same pattern twice.

Not what I expected, but musically pretty useful, I think.

About the design: In general, Conbrio gate patterns start slow and get faster, start fast and get slower, or do things sort of in between.  Incoming gates (0-5V) and CV (0-5V) control everything although there are two 5V pots normalled to each CV in, something I always try to include.  Output is 0V-5V gate and a 0V to -5V gate invert.

More history: The project started last year on my trusty Radioshack not so state of the art breadboard and proving ground.

This configuration tested the basic idea of fractal gates and audio. It took a lot fair number of evenings tweaking Sketch code to get something I liked, and at this stage I was just flashing a LED.

About a month in I had to make some decisions about how I wanted this to work so here's what I came up with:
  • Gates only appear at output when the input gate is high--"Gate" logic input
  • "SpeedCV" will be used control the distance between gates at the beginning of a cycle.
  • "CV" sets the overall starting wavelength for the generated gates (which can, at the start of a cycle, be very short to very long)
  • The gate speeds up or slows down, based on logic present at the "REV" 
OK...after I had the code somewhat working on the RS breadboard thing I created this rough schematic:

Then (very quickly, between work meetings) drew this board:

Off to China for fab--got it back--stuffed that puppy.

That's where the problems started! I rushed the hardware design for this and had to do a lot of fixes.You can read more about where I went awry in this post, but in a nutshell I tried to have the op amp do too much of the buffering for logic, used incorrect power rails for the op amp, and other stupid things.

However, I managed to kluge this module into something that worked and to my surprise I guess? And I've been happy with how it turned out.

You can find PDF's, Eagle files, etc etc., on my website, here. The code used (both sketch and Pure C, I wrote the conbrio code in both but used the former since to my ears it sounded better) is zipped and is at the bottom of the web page.

Updated version of Conbrio board, untested to date, is also on my website.

UPDATE 7-28-20: I slightly revised the untested conbrio v2 pcb above, which is somewhere in my huge box of PCBs but who knows where, into V3 and have sent V3 off for fab. I will build up V3 when i get the PCB back and report--I want a second con brio in my rack so I might as well see if V3 works.

On the same web page you can find a newer version of the board and schematic, that I might actually test someday, since having 2 of these in my rack might be interesting.  The newer design fixes the many doh moments in the 1-1-19 board.

The obligatory and somewhat useless bench photo.

Hey! It works!

How it sounds: You be the judge? You can hear a sound sample here.

For the demo, what you hear were made without using samplers or samples of any kind. This is all analog or Arduinoized DIY synth, fellow audio nerds. The birdsong, baby crying, wood sawing, fart noises, etc. is ConBrio going to AR, VCO mod, bandpass filters, etc., old skool sound generating stuff. Only the conbrio has anything digital in it.

Some of the patches were complex, but for the most part, really not all that bad, as usual and I came up with all of them as well as the sound clip pretty fast.

Once I  record 'em and pull the patch cords the sounds are impossible to recreate, but in a repeatable digital world, that's OK by me. Best thing perhaps, I can pretty much never get this module to act the same way twice, even with the same inputs and CV! We are all looking for our own source of uncertainty eh?

OK next up is, maybe a Russian VCF?  More work on the Reverselandfill project from a couple of posts ago? Haven't decided. Until then don't breathe the fumes.

Saturday, April 13, 2019

Arduino Logic--when Op Amps become (N)op(e)-Amps

There has to be a pun in there somewhere? Just got a new Arduino based synth module working, which I call "Con Brio Gate". It makes gate patterns that speed up or slow down.

I'll give out details about that gizmo in an upcoming post, (update! post is here) but I feel I learned an important lesson during fab which I wanted to share with ya'all. Maybe this post will help me remember next time?

Goes like this:

Don't try designing audio circuitry during the occasional 20 minutes between work meetings.You'll rush your design and end up getting a long, nasty visit from the kludge fairy. 

OK with that Epiphany out of the way, how about another tidbit, and the crux of today's biscuit:

Don't use op amps where transistor logic will work!


What I was trying to do: get incoming gate signals (for my setup, that's 0-5V DC) conditioned to feed Arduino I/O digital pins. I wanted to use a single TL084 for everything: buffering incoming analog CV (which is easy, and works--see the zener fragment below) but also use the same IC to condition incoming and outgoing logic (0V-5V, but nothing in between--and certainly nothing greater than 5V DC--see the I/O voltage limits for Arduino here).

Since I was trying to "just handling logic"--ons and offs--how hard could this be? Figured it'd be easy.

I used a LM324, the oldest/cheapest quad Op Amp I had in my junk box, of course.

First problem: most op amps don't go all the way to the low rail (0V in my case, which is logic LOW for my circuit) or all the way to the high rail (15V in my case; but I wanted 5V out--logic HIGH). In my initial design, I completely blew this detail out my, well, you know.

Right away, not going all the way down to 0V we have problems. We want to go from 0V to 5V, not 2V to 4V or whatever. The result was that ghd Arduino wouldn't "fire" on logic low.

Sooo....this op amp comparator in my conbrio design didn't work (obvious eh?)--what was I thinking?

For Arduino logic applications, I cannot recommend this fragment, at all, ever! 

Another problem with the above circuit fragment: the Arduino doesn't want to see 15V at any I/O pins--that sort of high V might fry something. As I draw it here, when the op amp, used as a comparator, flips "high" it goes closer to 15V than 5V and we don't want that.  Easily fixed with a voltage divider (200K/100K) but it was just dumb to not think through this with a bit more clarity.

Here's another link  that describes Arduino IO voltage and current limitations in case you missed the last one....

And for output buffering, the next fragment didn't work either! Again the voltages needed don't go down to 0V or up to 5V.  Same lack of clarity while reasoning this out. Very nice!

For me the output was between about 3.5V and 5V, not the 0V-5V needed.  Doh!

Using zeners and voltage dividers to clamp things is possible, but arguably adds complexity:

This works OK for analog signals, but to get to 0V you probably need a V- rail vs. ground.  I often use -15V for the V-- rail, 1K for the resistor on the right, and a 5V zener for analog.  Probably not worth the trouble for digital logic.

Transistors to the rescue! This simple NPN transistor fragment seems to always work, every time. Yes, you can use FETs for this, lots of variations, but I had a big bag of about 300+ 2N3904's so that's what I used.

This is easy jr. high school electronics! R1 and R2 form a simple voltage divider that will determine the voltage when current flows inward through the 10K resistor.  So, for for 5V at output when IN is LOW, and your rail is 15VDC try 200K and 100K for R1 and R2 respectively.

When you populate your fragment like that, the input signal can be pretty anything above about .7V relative to ground. Once you saturate the transistor you are good to go; the output will go from the voltage divider value to ground. Yeh!

This is true I/O: No problem if the input signal feeding the transistor base is the Arduino digital I/O pin, or if the output of this fragment feeds a digital input of your Arduino. Both configurations work and offer simple buffering and protection.

And yes, this fragment will invert the incoming signals' logic, but who cares?  You're writing the code, Elmo--HIGH and LOW can do whatever you want--so code accordingly!

Another benny: When this fragment is used to buffer an Arduino digital output signal, there is no 40mA current sourcing limitation you normally get with an Arduino pin. If you pick the wattage ratings of your R2 and R1 resistors correctly you can go hog wild--it's like you have the utility company working for you--since the Arduino is only sending its current through the transistor's base, and not to some current-hungry stage down the road, for almost every audio application, using this fragment, you're good to go.

OK I didn't follow this advice, trying to get clever with my single LM324. I didn't blow up my Arduino (good since it was soldered into my mistake-laden PCB), but I did get a long and nasty visit from Kristy Kludge, the kludge fairy, with his unshaven legs, bad hairdo, and wicked halitosis:

The tell tale signs of a visit from the Kludge Fairy: perf boards, ugly solder, dremel tool cuts, etc. Smells like kludge spirit!

As an old bandmate of mine always said, it was real, it was fun, but it wasn't real fun. Next time, I'll plan my design a bit more carefully.  I hope.

Preview: The ConBrio Gate design on my stale of the art (circa 1973) breadboard setup. Works--but no buffering yet!

OK that's it for now. Soon I'll reveal the Con Brio circuit, complete with its approx. 15 (?) kludge fixes. This one was so close to being tossed aside for a complete refab it's silly, but I made it through somehow. Update: done and works. Post is here.

And always remember: what doesn't kill you makes stronger, and also, more confused!  See ya!

Sunday, April 7, 2019

Reverselandfill.org Noise! Part I: Making Noise!

Welcome back! Last year I did a PCB swap with Martijn Verhallen from Reverselandfill.org. Fun!!

Martijn specializes in industrial electronic music and video synthesis and always has some very cool boards at his site.

Last year I built a module based on a reverselandfill design that Martijn calls "Aconitum Noise Mixer". Never being able to leave anything alone, I modified it using some C1406HA's, a oddball and somewhat obscure stereo panning SIP IC, which I put into play as a quad attenuator.

I am happy with how this DIY module came out--you can read part I of my Aconitum build here; part II is here.

This time I get started on the second PCB Martijn sent me. After sitting in my PCB box for many months I figured it was finally time to build his Noise! Oscillator design. Here we go!

Rev B of the board--Rev C is current--what I get for letting the board sit in my to build box to long!

About the Noise! Osc Board: You can see the schematic for it here; here's a basic flow chart of how his design works:

It's quite a different approach to noise creation compared to the "lifted leg transistor" upon which Martijn based his Aconitum design. Noise! is more of a random tone generator then part of the analog white/pink noise hegemony.

The noise osc board at its core relies on two popular CMOS ICs known to Lunetta enthusiasts everywhere: the 4093 CMOS Schmitt trigger and CMOS 4040 divider. As usual, Martijn has conjured up a creative and musical board!

An interesting feature of the board I've not seen before is what Martijn calls "starve". The idea is to crank down the DC voltage feeding the CMOS ICs. That will greatly change the sound of the device (and it does, I've tried it). 1001 uses? Interesting (and easy) thing to try on any CMOS audio creation perhaps.

For 9V use a jumper; for starve action, use a pot.  Interesting results!

For this post I will get the basic PCB working; down the road I will automate the board's patch bay for added voltage controlled craziness.

About the build: The Noise! Oscillator is well documented and uses easy to find parts, so stuffing the board was a breeze. I populated the board (it is sized for Eurorack; I use FracRak so some shoehorning will be in order) and created some 3.5mm audio I/O PCBs for testing. I've been using Switchcraft RAP2AV's more and more lately; they are reliable, solidly built, and perfect for slapping together something to mess with fast.  

For power (for now) I am using a 9V wall wart from my junk box. If everything works I will convert a 15V rail from my power supply to 9V.  More on that in an upcoming post.

Good news: I put in the chips and caps and whatnot and the Noise! Osc board worked first time. But of course I'm never happy with that (too easy right?), so I got out my rework station to try different cap values and different pots to see what would happen.

Sadly I sucked up a couple of traces when messing with the pots which took me a couple of hours to diagnose and fix. Damn! As I am writing this post I am still messing with the RC values for the oscillators.....I also tried adding vactrols instead of the pots (which didn't seem to work that well) and ended up settling on a single vactrol in parallel with the leftmost 100K pot. 

Ah!  Now we are ready to test. Each 4093 based oscillator has CV control; with my vactrol addition that's 5-count 'em! 5 different CV's for some very odd noises. 

OK, the basic build works and small pot and CV adjustments go a long way with this board.  I'm happy so far--I've never heard anything else like the noise! osc and it will be fun to create some audio samples when it's 100% done.  As usual, hats are off to Martijn. 

Coming up: I have designed and sent a gerber off for fab to automate a 4051/4066 CMOS based patch bay. I have no idea if that will work or how it will sound once it's in play. 

UPDATE: (5-11-19) OK it didn't work. The 4051 switch board for Martijn's board had a lot of the same design errors as the Con Brio Arduino board. However unlike ConBrio, the patch bay board for this sucked so bad I had to pitch it....I am going to redesign the patch bay board and try again.  

UPDATE: (8-17-19) Fiddlesticks! Still not happy with the 2nd gen MUX board. I know I can coax good craziness out of this board--I can hear it manually patching, but I want to audio-mate!!  I also think I ruined the PCB trying more vactrol mods and sucking up more traces. Crap!!!  But I will not be defeated! Stay tuned!

UPDATE (2-26-20) Part II of this post is here--still no mux, but i did incorporate CV controlled pots, and we have more crazy sounds!

UPDATE (4-5-20) Front panel for what you see here is done. Uses PCB material for the actual panel (post here) and "Mr Label" for the artwork (here).

So: lots more work still to do for this one. After about 8 hours work on this build today, it's time to stop breathing the fumes. Until next time--Aloha!

ProMicro HID Keyboard Emulator

Quick one this time. The Arduino ProMicro (examples here and here ) is based on an Atmel 16u4 MCU and has HID keyboard emulation ready to go...