Go Down

Topic: Adding Envelope to an Output? (Read 10037 times) previous topic - next topic

WilliamK Govinda

I was wondering on this simple thing: get the output of a PWM signal and apply an Envelope to it by using yet another PWM output. But I have no idea on how to do this.

First I would need to convert the PWM into a Voltage, then use it in an Voltage Controlled Envelope, also know as ADSR->VCA (Atack Decay Sustain Release Envelope to Voltage Controlled Amplifier)

If anyone has any idea on a simple way to do this, as the idea is to do on multiple voices, not just one, so a complex system won't work.

I could do the envelope in the digital world, but since we are using 8 to 10 bits, it sounds terrible. Having it in the Analog side would make things much smoother.

Wk

WilliamK Govinda

Forgot to mention this great site, on how to convert PWM into Voltage:

http://provideyourown.com/2011/analogwrite-convert-pwm-to-voltage/

Wk

WilliamK Govinda

Oh, multiplying DAC, great idea, I will check the options out. But from the price point, it will get expensive and hard to handle.

What I would love to do is, for instance, use an Arduino Mega multiple PWM outputs instead, as the external filter is much cheaper than a single DAC per channel.

Imagine this, right now, BeatVox uses 1x 16-bit timers to generate two outputs a 0 to near 800 value, that's over 9 bits and near 10 bits, and it sounds pretty nice.

Now, the Arduino Mega has 4x 16-bit timers that can drive up to 12 outputs like that. (at least in theory) Imagine now that you have 6 outputs and 6 envelope-outputs. The code will handle, as right now we are already getting 6 voices on the BeatVox on a single ATmega328 (Arduino Uno/Duemilinove) board at 16Mhz.

http://ruggedcircuits.com/html/beatvox.html

But I'm just a big dreamer!!! ;-)

Wk

WilliamK Govinda

Here's an interesting DAC I found on eBay. Any hints on this one?

http://www.ebay.com/itm/DAC8803-Quad-14-bit-Multiplying-DAC-10MHz-Ref-BW-SPI-x2-/170671810019?pt=LH_DefaultDomain_0&hash=item27bcd525e3

Wk

WilliamK Govinda

Interesting page on some VCA modules:

http://hem.bredband.net/bersyn/VCA/vca_shootout.htm

Wk

Magician

#5
Sep 20, 2011, 09:01 pm Last Edit: Sep 20, 2011, 09:36 pm by Magician Reason: 1
Why not create multiplying DAC inside of the arduino itself? Instead of PWM output, you need 8 digital pins with R2R leader.  Tone's amplitude would be multiply by envelope and send to resistors network / filter. That shouldn't be a problem with Mega board to build  6 voices with unique envelope for each of them ( 6 x 8 = 48 ).  Two tones for other smaller boards, that have at least 16 pins.

  Edited: Just realized, probably it would sound awful  with 8 original bits scaled down to even less... But idea would still be practical with 16 bit or 24 bit R2R. Only less outputs 'd be available

WilliamK Govinda

Edited: Just realized, probably it would sound awful  with 8 original bits scaled down to even less... But idea would still be practical with 16 bit or 24 bit R2R. Only less outputs 'd be available


Yup, that's the whole problem. That's why I want to do something in analog-domain. ;-)

I did some testing with OP-Amps, but since I have on clue on what I'm doing, it did sound good, until the volume lowered, then it didn't sound that good anymore. So I guess its a bit more complex to handle this out. Those VCA schemes I posted above are nice, but still a bit complicated, if I want to add 6 or 8 times those circuits, to get multiple voices.  :smiley-eek:

Take, for instance, the Beat707 SY LE project I did: https://github.com/Beat707/Beat707-SY-LE

If I could add at least 4 x 8 bit PWM outputs as the Envelope CV, that would be great. It would end up with at least 4 voices with 2 Square Osc each, not bad, all in a single chip design. Now add another ATmega328 or even run it at 20 Mhz, and improve even better the system. Then I could, later, find a way to add analog filters to it, also in simple terms.

I was hoping to get that with transistors or simple op-amps. But I don't know, it seems it would be more complicated than that. I will experiment some more another time.

The idea is to keep the whole thing as simple as possible. I know I could do all this in code, like the MidiVox did, but it only does one voice and I didn't like the sound...

Wk

Grumpy_Mike

Just apply the envelope to a voltage controlled amplifier. This is what the Moog was based on back in the day, it is a very simple circuit.

WilliamK Govinda

Dude, read above, I even posted a link to some VCA schematics above.  ^_^

What I'm trying to figure out is the simplest circuit possible, as the ones I found are still a bit "complex".  :smiley-mr-green:

Wk

amacmullen14

#9
Sep 21, 2011, 03:11 am Last Edit: Sep 21, 2011, 03:22 am by sciguy Reason: 1
How bout a 1 transistor VCA?

It was used in the 808 drummachine (heh, a subtle tribute to the line of drummachines that I'm assuming was the inspiration for the beat707 name) but it can only do 1 polarity voltage.

But hey, the arduino only does positive voltages!  How convenient!

Here's the page it's from:
DIY 808 circuits

Here's the actual VCA:

Not sure what the values should be.

Edit:
I found direct schematics for the 808:
808 schematics

Attached is a screenshot of part of the circuit that uses the transistor VCA, in the open hihat generator.
The left is coming from the envelope generator.  Below this part would be the signal source.  And it would be outputted to something on the right.

WilliamK Govinda

Oh! Oh! Oh! Thank you so much! I'm impressed I missed that one out!  :smiley-red: Thanks again.

Tomorrow I will check which parts I need, I don't have many transistors here, so I have to check which would do the job. Here's the list of what I got already:

Code: [Select]
Transistors

12 x 2N5087 PNP
20 x PN2222 NPN
25 x 2N3904
25 x 2N3906


Wk

WilliamK Govinda

BTW: Beat707 was named after the TR707 I had for a while, it was actually my cousin's, had to return to him...

Wk

WilliamK Govinda

Some interesting posts here: http://electro-music.com/forum/topic-33190.html

Wk

amacmullen14

Glad I could help

It seems that one of the main thoughts on that forum is that the transistor VCA is not good for say, a mixer.  Too lofi.
but the lofi-ness shouldn't be a problem for the arduino, you're not looking for the best sound quality in a synth ever.

D4p0up

#14
Sep 21, 2011, 02:48 pm Last Edit: Sep 21, 2011, 02:50 pm by D4p0up Reason: 1
I've been looking for a while during the last month to find a cheap and simple way to do a VCA, spent a whole day trying to do some tweakings with a BF245 and playing with its variable resistor polarisation, and eventually happen into a 4 Fet schematic with a lot of resistors...

Digging into the schematics of my old Synths like the paia Fatman showed a good tradeoff, but still costly according to your needs :/
Try a look at this : http://www.paia.com/manuals/docs/9308-fatman-manual.pdf

it's a kind of tradeoff, I chose the simpler way to do it : in digital world, using an 8bit LUT, one multiplication and a 8 bit shift for scaling. It's very efficient though.
Blog, DIY Electronics & Stuff - http://www.banson.fr

Go Up