Thursday, March 21, 2019

Saving OTAs--One Chip at a Time--a Simple Hack

Quick background: what the heck is an OTA anyway?

It's a type of IC. For audio and especially synthDIY you see Operational Transconductance Amplifiers (OTA) all over. These chips form the heart of some good audio VCOs, VCF's and a lot of VCA designs for instance.

The idea: It's like an op amp, but current goes out, not voltage; and, there is a "BIAS" pin to determine how much current goes out. A resistor can be used to turn this output current back into a voltage. So: simply put, OTA chips are good for voltage control of whatever.

The problem with OTAs: These chips are fragile!  If you put too much current into the bias control pin you fry the chip. No warning, no buzz, no hum--the chip is dead!

The upper limit is 2ma. You probably want to stay well below that.

Blowing up a CA3080's or LM13700s, which are still pretty easy to find, is frustrating, but may not be game over--especially now that Coolaudio is making OTAs again! However, for something harder to find, like a LM13600, you really don't want this! The chip is becoming too rare.....

OK how to make sure your OTA is OT-A-OK in your new DIY audio creation?  You can get a current meter and test pins before dropping the chip into your circuit. But I'm too lazy.  Here's a simpler method:

First, build one or two of these:




So you are soldering a medium size LED to a diode in series. For this example I am using a red LED but any medium sized normal LED will do.

OK that took about 5 seconds.....

My finished doodad looks like this:


Next build your entire circuit, up to the point of dropping in the OTA chip.

Solder a socket in where your OTA goes (so: to the PCB, stripboard, perfboard, whatever) and drop your 2 part masterpiece in like this:

For 13600-13700 you want to test both bias pins. The test rig goes between bias in and V--
Different OTAs have different pinouts, but 3080-13700-13600 is most common so that's what you get here.

OK now sweep your CV (from a voltage generator?  From another module?)  Whatever.

For me, 0V cv should look like this: LED is off!

'
As you sweep up the control voltage the LED turns on until, until!! at 5V, it glows faintly:


If the LED doesn't lite at all, you probably have something wrong with your control circuitry.  You won't blow your OTA IC up, but it's a fair bet your circuit won't work.

If the LED glows bright blazing red, you are probably going to blow up your OTA. Don't put your OTA chip into the socket yet! Instead put a current meter where the LED was and check--but my bet is that it will read more than 2mA. Bummer, but at least your expensive Ebay 13600 IC lives to fight another day.  Fix your circuit until the meter reads 1.5mA or less.

I use this trick to test any OTA circuit I've been building, modding, or repairing; I have saved quite a few chips!

OK That's it. OTAs live! yeh baby!


Monday, March 18, 2019

Balanced Modulator Part II: Nothing like a good B-M!

Potty humor aside, I finished the Electronotes AD533 based ring modulator last week, and I am happy with how it turned out.

Decal front panel for this came out OK but not perfect.  An decals for audio DIY howto is here.


I was after a balanced modulator where the X and Y signals didn't leak into the output, like the good old PAIA 1492 based design I grew up with, and an Electronotes "Preferred Circuits" design seemed like it would get the job done.

Good news: it does! Very quiet, clear sounding module. Not much (if any) cross talk, cross-tweeze, bleed, high end roll off, low end humpty-humps and the other things that make some B-M's sound, pun intended, crappy.

I am yet to go wrong with any EN Preferred Circuits--the ones I've built are all winners. If you are into reading about how the old stuff works, the publication is recommended--USD $39 for tons of great circuits is most definitely worth the dough; get it here.

You can read part I of this post here where I build the reasonably stable and possibly unnecessary +/- 10V reference for this balanced modulator out of surplus parts.

And--sound clip warning!!--hear the finished module here. For your listening pleasure (?) I tried to capture all the usual BM stuff: birds chirping, laser scifi sounds, gongs, bells, dumb Dr Who aliens, even a balanced modulated redux of a previous audiodiwhy sound clip.

Go A's!

You can get the Eagle files, PDFs, BOMs etc. from my website, if you want to make your own or modify this one.


ABOUT THE BOARD:

Here is the PCB, it's small....



The hard to get part is the AD533, which hasn't been made for a few years, but I found them for sale in China via Ebay. The cans I bught ($2 each USD--cheap!) took a long time to get shipped to the US, but once here they worked fine. So the AD533 isn't unobtanium yet.

I see them for sale from Europe or US for more like $30 each, but look around, you might be able to find them cheaper.

Building both the reference board and the B-M itself was pretty easy, no trace cuts or whatever needed.  Got 'em right the first time!

Nothing like a good sounding B-M using a can.....

I had to create a modified Eagle Linear library to accommodate this part; I modified the Eagle10 pin can for this application, and I figure I got it right, because it worked.

For the .0001% of the readers out there who might want an Eagle lbr file for an AD533 I can help.....If you want a copy of the lbr comment below and I'll get you one.



Frac me up Scotty! As usual I had to mess with the boards to get them to sit behind a 1U Frak. The solution: the BM board is located behind the 10V reference on 1/4" 4-40 standoffs.

If you want to come up with a smaller 10V reference (which wouldn't be that hard to do) this could be a very small board indeed and be ready for Euro where the knobs are tiny and reading glasses are often needed.

If you want to save more space the 3x op amp IC's could be combined into a surface mount TL084.

Can the trim: The preferred notes went through a couple of paragraphs re: how to trim out the AD533 balanced modulator, but not feeling like digging out the book and reading it again I put a 2K sine wave through X and trimmed the Y trimmer until I couldn't hear the tone at output, then did the same for Y and X.  I am not sure what DCTRIM does, so I put it at midnight and ignored it. Ha! Worked fine--no bleed. I am happy.

Always a lot of wires, but wires makes modding a lot easier.

Another way to simplify this is to use a currently stocked 10V reference like the LT1012. You'd have to figure out a way to derive -10V from the 10V but that shouldn't be too hard.

OK another one in the bag!  Good to have a good sounding traditional balanced modulator in my rig.  I'm ready for scifi sound design!

One day I'd like to recreate the original PAIA build and see if it sounds as good as I remember, but, on to other things.

Next up: working on an old Tom Gamble diode filter.  Got it to work once; try 2 (new PCB) was a complete failure.  Working on try #3 with PCB #3 now.  Update: got it to work!  Dumb mistake on the PCB!

Until then don't breathe the fumes!


Tuesday, February 26, 2019

Electronotes Balanced Modulator Part I: the 10V reference

I've been back at this audioDIY for a few years now and I am still looking for a really good balanced modulator.

A strange sentence right?

This is partially sentimental, since my brother and I built a 1492 based PAIA 4710 Balanced modulator when we were very young indeed (12 and 14?).

Long Live PAIA!
I remember with a great deal of fondness how much I liked that module. The damn thing, I remember, sounded frigging great! Metal klangs! Space gun laser sounds! Impress your friends! Baffle the girls!

Looking back, many of the modules in the PAIA 2700-4700 series sounded--well, bad, but not this one. Maybe my mind is playing tricks on me but the 4710 sounded better than anything I have in my rig now.

So just rip off the 4710 schematic?  Maybe...but 1492 IC's are hard to come by and hard to design around I think. The power (+18V, +/- 9V) isn't even close to what I use in my rig. Whatever.

I've tried recreating the good old days with AD633's as well as a Thomas Henry designed 3080 RM from his 3080 book but neither sound all that good.  Also I fabbed up this Korg MS20 style RingMod which is cool but is pretty choosy about the incoming waveforms (ramp works best?).  You can see my ring mod page here.

Hunting around more I found a AD533 based Balanced Modulator in Electronotes Preferred Circuits and thought this one might sound good.

A lot of energy for the EN circuit is spent getting rid of the bleed through which seems to be the stumbling block of the latest B-M's I've tried to create.

But, for better or worse, the EN circuit requires an Analog devices 10V reference IC which is no longer made.  But! wait a minute, I already put together a working +/- 10V reference for a log converter I was working on several months ago. You can see that here.  Let's use that!

10V Precision Reference, finished, tests working


The circuit is simple.  It uses an LM397 zener at its core. The idea is that you can heat up the 397 zener and nevertheless it stays pretty close to spec. So we have e-z super simple temperature compensation here, always a tough part of a voltage reference design. Plug the Zener into the ADJ of a 317 and 337 v-reg, some glue trimmers and resistors, and the requisite coupling caps, and ahoy, you get a decently steady voltage source.....



I got the LM329s surplus but you can still find 'em out there.

Can you make a more stable reference that you can put under a heat gun and have it stay steadier?  I'm sure you can.  But for a 1980's era Balance Modulator, I figure this is good enough.

More next time: when I actually see if I can hook this to the EN Balanced modulator and make some sound. We'll see. Until then, don't breathe the fumes.

Monday, February 18, 2019

Korg MS20 Filter--the Why in AudioDIWHY.....

OK this one drove me crazy. 

This should have been easy, we know that Rene Schmitz stuff sounds good (I have already built his "FEITW" ADSR) and I thought, let's try his MS20 filter.




So: Did the Eagle design based on what's on Rene's site, put together a board layout, and sent off for fab. 


This is a pretty simple circuit and from a good looking schematic, from a smart synth DIY maven, why wouldn't it sound good?

You know how I sometimes post: worked first time?  This one most definitely didn't work first time. Neither filter worked for beans for at least 3 evenings--and the second one took me more like 5 evenings to get working. This got me to wonder, why not just buy someone else's filter design? Does a kit qualify as DIY (of course it does....but it's not enough torture for me?)

I used a 2x dual concentric pot PCB for filter #2 which I cut down from this PCB.

OK I built two and at first both builds passed audio but both filters sounded--wimpy. Almost like a cheap stereo tone control, not that nice fat MS20 sound with dirt when you crank up the "Peak". I know Rene's designs are high quality, and a skinny sounding filter must be on me.

Building Filter #2....

After probing around a lot with my scope I ended up tracing this to a stupid mistake: I copied the schematic wrong into Eagle!  I drew up a critical voltage divider incorrectly, which was causing a journey to 6db cutoff, wimp ass sounding low pass land. But the 8-28-18 PCB is still useful, although you have to do a trace cut and some kludge wiring to get it sounding MS20-like. 

But then again: what would DIY be without trace kludges?

With all that crappy advertising, you can get my PCB design (the one needing a trace cut, 8-28-18, and fixed yet untested version, 1-9-19) here.  My website includes BOM, wiring suggestions, and specifics about the trace fix.

MS20 filter #1 finished, no decals yet, (I think) it sounds Rene-errific

Great! we get that crunchy peak sound, fat lowpass and nice Korg growl!

Next I turned my attention to the second unit (two VCFs so I can HP + LP = band pass? Two on the original MS20 right?) But even with the trace fix, the second MS20 filter had a strange problem--when I cranked the CV up the audio output went completely dead.

Damn! It took me 2 more evenings of comparing the working VCF to the broken one to figure out problem! I suspected a parts placement error, but after checking twice, no, everything is OK.  Bad IC?  No; swapped everything and no change. Could I live with a VCF just not eating any CV above about 4V DC?  No, not really.  And besides, #1 worked, so #2 needs to work the same way.

Arrg!  Too much shotgunning! 

Ended up tracing this to a wiring problem with one of the grounds:

Filter #2, turns out, the normal is the fault--thanks to E-M GRUMBLE for the suggestion....

Goes like this: for an MS20 OTA filter: if you want high pass, stick audio into one end of a critical cap. If you want low pass, ground the same end of the same cap and put your signal into the circuit's main input:



Not having room for a switch in a 1U Frac, I used a normal to ground the cap, and the normal had a cold solder joint.  Yow! So when I put audio into the "LP" input, it would cut out at high CV.  If I put audio into the HP input, it wouldn't work at all. Not at all the way I would think this issue would manifest but there you go.



OK with all that sorted, I did a recorded the quickee demo, here.

Second MS20 filter works! Filter 2 has 2 mod inputs, I was going to use this as the primary filter of the two.

Five evening later, I have to wonder, was all of this worth it?  There are a ton of PCB's for MS20 filters already out there, did I really have to do my own PCB? I doubt it, really. Hell, I could have just bought one of those MS20 repops, and if it went south, bug Guitar Center for help right? Maybe not?

I think I just like to torture myself, building machines that I go crazy trying to fix over the course of 5-6 evenings. Welcome to the world of DIY.


Hey!  They work!


I realized something important: I hate, hate, hate haatteee it when things I build don't work. More than I should. So why DIY at all?  This is like being into sailing but hating water, right?

I'll have to ask my girlfriend, who is a mental health professional (really!) why this is, because really I have no idea. Was I dropped on my head at a young age?

Granted--too many fumes. I need a break.

Monday, February 4, 2019

ReneDSR: Fastest Envelope in the West, Finished; Sound file and Build Notes

Back Again!

I needed more ADSR's in my modular so I built some based on a very cool design from Rene Schmitz.....You may want to read part I of this post here., where I create the PCB, discuss what "Tau" means, show you useless bench build photos, and so on.

Left to right: finished modules: ReneDSR, Return of Son of ReneDSR, and Son of ReneDSR

Does capacitor size matter?  

That's the "rayson d'tre" for these builds, but?? From last time, the basic design of these sorts of ADSR's sends gate logic to an RC circuit.

Good news: 

 The size of the resistor and cap (the resistor being a pot and/or a resistor network) determine attack, decay, and release speed. So, should we build these with large caps and small pots?  Small pots and large caps? I think the jury is still out, because to me it all feels and sounds good. You can mix and match caps and pots here and have fun; the sun will still come up the next day.  And, set up right, either can provide mix-cutting, DJ boogeying, MDA popping sweaty bodies dancing w/ body-odor snappy synth decays.

I tried to create a very simple demo for these modules, and you can hear sound samples here.

About the sound sample--other than the WAV loops this is all my modular with ReneDSR:

00:00: multitracking 6 mono notes on a DAW (Ableton Live 10).  Attack time is set to minimum; release is set to max; it's a very fast attack (I didn't measure it on a scope, but you can hear, IMO anyway, it's a reasonably fast attack) with 23 second decay for VCA, and same for VCF.  I put a lot of rez on the filter to make the sweep more noticeable. You're hearing a 10uF cap and 2.2M audio taper decay pot creating the ever import tau (see the last post).

From this I get an MiniMoog's long release or maybe a Prophet 5-ish sound. I am happy.

00:33: Dual Osc bass line, maybe a bit of a Stevie Wonder? I always like that; Stevie and the late great George Duke are my all time favorite synth bass players. I remain happy.

00:55: Sequencer patterns. This is 2 sequences overlapped, making heavy use of ReneDSR's fast decay, without which the moving patterns sound mushy. I am not a big Gorgio Moroder sequencer guy but I know a lot of synth freaks out there are and for this the ReneDSR performs well.

01:44: Single Oscillator to VCF to VCA, with SonOfRene controlling the VCF and Return of Son of controlling the VCF cutoff.  In many mixes I find that a single OSC bass sounds sit better than dual or 3 osc basses. Maybe a bit Roland SH series sounding. Why not?


The Roland SH-5 has one of my all time favorite ADSRs.  From the shop manual, its a pretty simple design from those crazy and creative 70's Roland dudes, so a PCB maybe for a later build?

The Return of Son Of uses a 2.2uF cap and 3x dual gang 1M audio taper pots. Each switch selects very good control of a 1M audio taper pot; or, tap off the wiper of a 2M pot.  This allows for a good fast attack and decay with a longer release as needed.
Return of Son Of RenayDSR Switch Wiring.


Another build idea: In any Rene 2.2MB pot build, you might want to put the 2.2uF cap on a DPDT switch with say 10uF cap for longer decays and releases.  Or for 1MB pots, a 4.7uF and a 22uF.  You get the idea.




Front Panel didn't come out very well for ROSO, lumpy and bumpy, but it's good enough.

The other 2 units--ReneDSR and Son Of ReneDSR--are pretty much a straight builds of Rene's two design variations on his site.  The 1U device has 1MB audio taper pots for ADR and a 4.7 and 10uF cap on a DPDT switch with 100ohm resistors in series.  The second unit was featured in this post, and uses 2.2MB Audio taper pots, which can be a bit hard to find.

One more tidbit: Rene's design calls for CMOS 555 timer chips, I bought about 10, and couldn't get a single one to work in the 3 circuits you see here.  A standard 555 worked every time. So they may be something wrong with my PCB, or maybe I got a bad run of CMOS chips. Whatever--gotta move on.

Overall, a fun build, and more good sounding ADSRs were very much needed in my rig. 

So if you're looking around for an EZ ADSR that performs well, and is fun to build, this may be it. I have some extra PCBs from this project, if you want to do a board swap PM me via the electro-music forum, I am "cslammy" there.

And as always, don't breathe the fumes!

Saturday, January 19, 2019

Front Panels: The Technique So Far

Not only am I learning about electronics but also working with metal?

Here's a quick post about how I do this, hope I don't forget this in a couple of years. This technique (?) is good for drilling holes, reasonably accurately lined up, in flat metal prototype panels.

First: I get my aluminum blanks from PCBWAY in China ("Alubase PCB").  Personally I use FrakRac format for my Audiodiwhy craziness but this should work for 5U, Euro, a one-off front panel for a preamp, a 19" 2U panel for a power amp, or whatever.

Today I am building an modular synthesizer ADSR and need extra drills for SPDT switches and the PCB bracket's 4/40 screws....


Using Eagle (but any illustration program should work) I create a 1:1 drawing of the existing blank with existing holes, and add any extra holes that are needed.

Next I see if it all lines up--this one is getting close.



More alignment, but still not there.



Once aligned (or before) I can add pencil marks for anything else I want to drill. I am basically being lazy--it makes more sense to put this on the CAD drawing, but, oh well. Here, it's for the brackets to hold the PCB. A straightedge and ruler are friends for this.


In the words of my personal hero, Frank Zappa: here is the "crux of the biscuit": The glue on the left will attach the paper print out to the front of the panel, with enough stick to not come loose or tear during drilling. The solvent on the right will completely remove the paper template and any glue that doesn't come up when it's time to ditch the paper. Warning: the solvent stinks to high heaven, so wear gloves or whatever, work outdoors, and as a last resort, try not to breathe the fumes.

All can be purchased at amazon, craft stores, hobby stores and the like.


I use a very small hand drill to create the pilot holes. These can be found on line or in hobby shops--the model airplane folks apparently use them quite a bit for instance. I have found that punches and the like can distort the metal panel's shape.


I invested in a small drill press and put it in my garage. Highly recommended. But!! Caution: Use sharp bits, and always wear gloves and eye protection with this tool--seriously, I have had some close calls here.



Here's a mock up of how things ended up this time. Pretty good, but not perfect! The left hole for the PCB got screwed up; the drill press skittered because I didn't have the bit tightened down enough.  Damn! Glad I was wearing gloves!  This time, I am going against every fiber of my mild OCD; I am going to try to leave it as-is. It's good for me!


Final mock up. Not bad for a prototype, in spite of the screwed up goof on the left. Damn! Oh well. I need to finish the ADSR, and it's a 3 day weekend here in the US so maybe I will do some Lazertranning.

Moving on....happy drilling!

Friday, January 11, 2019

Programming Arduino in "Pure C": Now We're Playing with Power! First steps!!

Let's jump right into the why. 

I have been corresponding a bit with an audio DIY master: Grumble, from the electro-music DIY audio forum. Just when I think I've done something cool, I see what Grumble comes up with and shake my head: Wow, this guy's kung fu is unreal!


A lot of Grumble's projects (but not all) are digital in nature, using Atmel CPU's.

I was curious how some of his stuff works under the hood and Grumble was nice enough to send me some of his Atmel C code to study.

Hmm, not entirely what I expected. It seems his projects are too advanced to be easily crafted from Arduino's super friendly sketch programming language.  I started to dig in and found Grumble uses what professional microprocessor programmers call "pure C" instead.



Pure C: not a Citrus Product. I've also seen it called "raw C". So what's all this then? Arduino's sketch language is a library, written in C and C++, allowing us DIYers to do hard things quickly with user friendly code.

If you dig deeper into the C library for Arduino, you see a lot of code like Grumble's. That's because the Arduino sketch language itself is written in Pure C!  Here's the idea: let's cut Arduino's sugar coated, human friendly feel-good C library and instead use C in a stripped down, bare knuckle form.

Like it or not, Pure C's the way the big kids roll when programming MCUs.

OK, I need to roll up my sleeves and start learning. I'm a masochist for that.

Here's an example of Pure C. What the hell does this mean?

DDRD |= ( 1 < DDD4);  // answer: same as pinMode(4,OUTPUT);

Why read when there is YouTube? A really good (albeit lengthy) vid about "why to use pure C, what is pure C, how do I get Pure C, how do I make Pure C go, is here. For anyone with previous Arduino Sketch programming experience, I think the the vid is clear and easy to follow. Worth a look.



I watched the vid a couple of times and began to screw around with Pure C. here's what I've found so far:
  • You can code with the usual Arduino Sketch feel-good stuff in the Arduino IDE, and throw in dashes of Pure C as needed. It all works; the two can mix. UPDATE: not quite. I noticed to mix analogRead() statments into your pure C plus arduino library mixed masterpiece, you need to use void setup() for initialization, not int main() as shown in the code example below.
  • Does the usual SIM suspect, Tinkercad, work for Pure C development? Sort of. A vid showing Pure C on Tinkercad to get the immortal blinking LED to blink is here. But I could not get Tinkercad to work reliably beyond simple blink tests--for instance, using pure C to set up one of the simulated Atmel CPU's built in timers--all programmed in Pure C--caused the simulation to bog down in terms of performance to where I felt it wasn't useful.
  • Virtual Breadboard, as described in this post, works. Oddly, using the IDE to talk to an Amtel ATmega328P directly didn't, but using a Nano SIM, it did.  The developer told me a patch will be needed to have the Atmel SIM work but it's not available yet. Update: in version 6.08 of VBB I have verified that this is fixed.
  • I have found using a NANO V3, pure C programming experiments (which to date, for me, are mostly redos of the "blink the LED" sketch) work as expected. So I can take my existing breadboard setup, Jam-o a Nano, put Pure C code into Arduino IDE, compile, and upload. We're good!  

Took this picture between blinks, but the LED works....

Still with me?

If you want to play along at home: here's a rundown of some essentials I needed to get started with Pure C:

I needed the datasheet for the Atmel chip that constitutes the guts of the Arduino on my bench.  For me, it was an ATMEGA328P, data sheet for that is found here. Why? Pure C is all about finding bits in registers. These registers hold essential information like "is this pin an input or output?" "Do you want this pin high or low?" Flipping register bits is the key to making things work.

So, you need to understand what many registers and bits do.  No way around that. There are a whole ton of registers in all these Atmel CPUs.

I needed to see how my Arduino board is wired--really.  Pure C goes straight to the heart of an Arduino: the CPU itself. If a pin on the Atmel CPU isn't wired to the same pin on the Arduino PCB, or if the board has a different pin designation, your Pure C code may not work.

For the Nano I found the Nano Eagle schematic, here, which clearly shows which pin on the ATMEGA chip goes to which pin on the Arduino board. With that in hand I could successfully move LEDs around, change my pure C code, and still have them blink.

I needed a simple breadboard setup: Nano and an LED.



I needed to understand the strange statements you see over and over when reviewing pure C code. One we already saw:

DDRD |= ( 1 << DDD4);

This means, for register DDRD, put a 1 (high) into bit DDD4.  This specifically tells the Nano's CPU that pin D4 is going to be an Output.

Getting further into beginner's stuff:

You can OR these "bit shift" statements together:

DDRD =  ( 1 << DDD4) | ( 1 << DDD5) | ( 1 << DDD6) ;

Same idea, but we are putting a 1 in for bits 4, 5, and 6.  So D4, D5, D6 are outputs.

So how to make DDD4 a zero?  So DDD4 is an input? Use a NOT, also known as an XOR:

DDRD ^=(1 << DDD4); 

And another way to change DDD4 from 1 to a zero (so, flip things?)  This tests DDD4, if DDD4 already contains a 1, it makes DDD4 a zero. If it's a zero, make it a one.

DDRD &=~(1 << DDD4);

You also set the entire register--for instance, make every pin in the Pin Group D inputs. Here 0x00 means use hex (base 16) to set all the bits to zero.

DDRD = 0x00;

And this sets them all to one:

DDRD = 0xFF;

Tip (for me anyway?) Remember that even after you power cycle, the CPU chip "remembers" your register settings. Compiling and uploading code again won't change registry bits unless you specifically twiddle them.

Enough for now? Just with these few discoveries, I can already read small chunks of Grumbles code and maybe see what he's after. Go A's! To wrap up: Here is a Pure C program I wrote that compiles in Arduino IDE and flashes an LED. Works on my bench anyway. Remove comments, change 1's to 0's, etc., and have fun.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////



#include<avr/io.h>
#define F_CPU16000000UL
#define myPin DDD2 //change 2 to whatever D group in you are using
#include<util/delay.h>

/*
my expanded pure C blink demo.  
Nano V3,0, with LED tied to pin D4; 
1K resistor between LED cathode and ground so to not fry the LED.
uncomment stuff to experiment.
*/

int main()
  {   

/* all pins in D pin group are now input. For DDRD, 1 means output and 0 means input. */  
DDRD = B00000000;

/* we are putting a 1 into bit DD4 in the DDRD //register, making D4 on the nano an output. */  

DDRD |= (1<<myPin);  


/* make DDD4 (pin D4 on Nano) a zero, now it won't flash because it's an input.  So do the opposite of what I say. */
 // DDRD &=~(1 << myPin); 

/*test DDD4 to see if it's a one. If it's a zero, toggle the //bit to one.  If it's one, toggle to zero  */  
 // DDRD ^=(1 << myPin ); 


// BONUS COMMAND USING HEX vs. BIT TWIDDLING.

/* this will set all D pins but leave TX RX to output */
  //DDRD = DDRD | 0x00 ; 

/* this will set all D pins but TX RX to input */
  
  //DDRD = DDRD | 0xFF ; 

  /*Note: if you screw up TX and RX, 
   * which are part of the DDDx, DDRX, PINx" pin group mishpucha,
   * upload into your arduino a normal sketch with serial.begin().  this fixes it.
*/


/* WHILE(1) is the same as the main repeat forever loop you see on arduino  */
  
     while(1)
     {

 /*     PORTD=B11111111; 
//all port D pins (0-7) are now high.  
      _delay_ms(1000);  
      /* I put in 200 to make sure I'm not running the default "blink" sketch. */
/*
       PORTD=B00000000; //D2 is now low.  same exercise.
      _delay_ms(200);
*/

/* same way to do what we just did with 2 lines!  Go Pure C!
 */

PORTD ^=(1 << myPin ); 
     _delay_ms(1000); 
     }
  }

/* don't breathe the fumes */

Saturday, January 5, 2019

ReneDSR: Fastest Envelope in the West: Zen and the Art of Tau

Hello again, just finished a new module based on a custom PCB.  The original design seems pretty well known in the DIY synth audio community already: Rene Schmitz's "Fastest Envelope in the West".

Find his original page for this design here--scroll to the bottom of the page....

FADSRITW Prototype. No LazerTran front Panel Art yet, still testing it.

The Why in AudioDIWHY: I needed more ADSR's in my rig. What I have now works but doesn't always give me the super quick snappy decay I'd like.

I saw Rene's Fastest envelope schematic and thought "this will work!!"  Note that to me "fastest envelope" sounds postal; the acroymn is FEITW ("feeet-oo"?) is odorous, so I am calling it "fastest ADSR" or FADSRITW or even FDITW "Fastest Decay in the West". Whatever? For funk bass I like snappy filter decay and this will remind me to always tweak it down!!

I will use acronyms going forward, since I love acronyms.

 Here it is:

Eagle BRD and SCM files, wiring diagrams, PDFs used for my take on FADSRITW are available on my website, click here.

About the module: Rene describes a couple of variations of his design--one with 2.2M A,D,R pots, another with 1M pots. Increase the the cap value if you decrease the pot value. To me, with analog envelope devices, the size of the cap creating the "TAU" (which, my EE brother explained to me, is simply the R*C value used as the heart of the ADSR) matters.

Let's examine this phenomena:

Warning: Math zone ahead. Math?  Did I say math?  Yes, math.  As much as I'd like, I can't do electronics DIY and completely dismiss math. Maybe none of us can?

I was pretty good at math in college (when Madonna ruled the airwaves and dinosaurs roamed the earth) and have since forgotten most all of it, however the math here seems relatively easy: No imaginary numbers! Euler's number (I remembered that!!) Exponents, I remember those as well! like it that way.

OK for ReneADSR decay here's the formula to compute your decay control voltage:

V = S*(e^(-t/RC))

where:

V is the voltage at any given time--what we are after.
e is Eular's number (about 2.718), so, a constant
^ means "raised to a power of what follows", so, e raised to -t divided by R*C
-t is (time * -1).
RC is the resistance * capacitance.  That's TAU, baby!
S is the voltage at time = 0

If you plug this into a graphing program like this very cool one you get beautiful curves:


You take that voltage changing over time, and plug it into an appropriately designed VCA or VCF (such as this one, Matohiko Takeda's "Farm VCA") And: Aaaahhhh! The classic Moog/Roland analog synth sound awaits! That's what I am talking about!

I don't know about you, but a good sounding ADSR > VCF curve makes me very happy indeed.

Slight aside: TAU is a Greek Letter and looks like the PI symbol that is missing a leg or pi cut in half:



It  means something different in mathematics, or biology, or astrophysics, or whatever; ditch the RC crapola if you're not a physicist? Tau means way different things to different scientists! This confused the hell out of me for a bit. You learn something every day eh?

OK back to it: from the equation above, it shouldn't matter if R gets big as long as C gets small right? Within reason perhaps. That's basic math. But again, that's not how it sounds to me. So what sounds best, really?

Guess we'll find out.

I built my first FDITW using 2.2M pots I found on Ebay (linear taper). 2.2M pots are not at all easy to find, but I found 'em, they arrived via eBay from China and 5 minutes later were soldered into the prototype. Yep! Worked first time!

Honking big 2M2 pot. The US dime to left, for nonUSAers playing along at home, is approx. 17.9mm in diameter. 


obligatory on the bench shot.

Can't find the pots? In an ElectroMusic forum post, DIY mensch donpachi lays down a cool trick for getting 2M out of a dual gang 1M audio taper pot:



I put this on the bench, and it works, but, if there is a +/- 20% error on each pot you might have -40% error overall, giving you a < 2M pot not 2M, so choose your pots accordingly. I dug some 1M dual gang audio tapers out of my junk box and pachi'd them in, replacing the linear taper honkers. To me, the FADSRITW sounds more musical with audio taper pots for A, D and R. I also jammed in a switch to select 2.2uF and 10uF to switch-a-tau. Overall another very fun build. You can get the Eagle stuff, etc. here.

One more tid-bit: For some reason, I got the circuit to work w/ a standard 555 IC, but not a CMOS 7555. No idea why. I will build more of these and see if I can track that one down.

Going forward: I went online and bought some 1M audio taper pots from Small Bear. Waiting for those as I write this post.  I will build another FASDRITW with 1M, 100 ohm resistors vs. the 220's and maybe some other TAU-values (taulues?).  I'll also post some sound samples.  But no, no scope snaps. My eyes always confuse matters like these. The question: What sounds best, really? I figure the different RC combos will sound exactly the same but who knows. Until then, DBTF.  See ya.


Saving OTAs--One Chip at a Time--a Simple Hack

Quick background:  what the heck is an OTA anyway? It's a type of IC. For audio and especially synthDIY you see Operational Transcondu...