Author |
Message |
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Wed Jan 07, 2015 9:17 am Post subject:
A CMOS based ADSR |
|
|
So I don't know if this is strictly Lunetta but it is entirely CMOS based so it seems like this would be the right place to ask.
I an a neophyte when it comes to all of this but I've been thinking about how to do a ADSR circuit without using Opamps or transistors or other things that I don't understand and I think I roughly have it and want to see what people think.
At it's most basic level you have an oscillator outputting at the audio frequency you want which will act as the gate/switch on a 4066, the signal being lat through the gate would be the output from the ADSR.
The ADSR would be created by using an up/down counter with an enable pin. 4 flip flops to store what state we are in, some magic to set the sustain level , a bunch of basic gates to wire them together, some oscillators to set the rate of the A,D&R phases, and a push button to trigger the envelope.
On pressing the button the Attack FlipFlop would set and all other FlipFlops would reset, and the counter would be enabled and start counting up using the Attack Oscillator as the clock source. When it hits max that resets the Attack Flip Flop and sets the Decay Flip Flop, which starts the counter counting down using the decay clock source. Once the counter hits the sustain value (which has been set by magic - maybe a set of switches, or a potentiometer fed into a ADC or something the magic is messy but not important) that resets the Decay Flip-Flop, sets the Sustain Flip-Flop which disables the counter keeping the output at the same level.
At anytime, when the switch is released that resets all flip-flops and sets the Release flip-flop to high which starts the counter counting down to zero using the Release oscillator as its clock.
Does this sound reasonable and non-stupid?
I was thinking the counter outputs (which is the output of the ADSR envelope) would be fed into a priority encoder to give a curve to the rise and fall so it wouldn't be strictly linear. |
|
Back to top
|
|
|
synaesthesia
Joined: May 27, 2014 Posts: 291 Location: Germany
Audio files: 85
|
Posted: Wed Jan 07, 2015 11:18 am Post subject:
|
|
|
Hi Alistair, if it is fun, makes sound, and contains CMOS it can be considered Lunetta What you describe makes sense and probably could be done. But I don't think that it is the easiest approach.
First, you need some "vent" to control the output level. A 4066 analog switch is either on or off. You cannot control what goes through it easily. You could drive it with a high frequency in PWM mode, but you would need to filter the result later. See Figure 11 - Conceptual PWM VCA at http://sound.westhost.com/articles/vca-techniques.html
Second, the ADSR curves. Unless you are looking for ultimate precision, I believe that it will be much easier to generate the curves in an analog way rather than using digital counters. Typically you will see the load/unload process of a capacitor being used for that. Those curves aren't strictly linear by nature.
If you want a simple design, I suggest that you look for ADSR generators using a 555 timer in this forum and on the net. For example, this AD/AR envelope generator here http://electro-music.com/forum/topic-57015.html&postorder=asc&highlight=envelope&start=25
Don't let my opinion discourage you to try it your way. It can be done in a digital way, and I already did it using an FPGA, but only because I couldn't add analog parts. The "analog" way isn't that difficult and I guess much easier in this case. |
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5581 Location: Moon Base
Audio files: 705
|
Posted: Wed Jan 07, 2015 2:28 pm Post subject:
|
|
|
One thing that's not fully clear is how it creates the ADSR voltage. Do you want to add a DAC/resistor network to the priority encoder ?
synaesthesia wrote: | First, you need some "vent" to control the output level. A 4066 analog switch is either on or off. You cannot control what goes through it easily. |
I think the idea is to use it in reverse so to speak. Instead of having the audio level controlled by the switch you're controlling
the switch with the audio. a varying voltage on the input of the switch will create the audio signal with that voltage as amplitude at the output.
It's a similar approach to using a single diode and resistor to create a VCA. _________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
|
synaesthesia
Joined: May 27, 2014 Posts: 291 Location: Germany
Audio files: 85
|
Posted: Wed Jan 07, 2015 2:55 pm Post subject:
|
|
|
Right, didn't see the idea to run it in reverse. Wouldn't much of the signal be lost then? If you happen to have one, an example circuit for this concept would help. |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Wed Jan 07, 2015 3:04 pm Post subject:
|
|
|
PHOBoS wrote: |
One thing that's not fully clear is how it creates the ADSR voltage. Do you want to add a DAC/resistor network to the priority encoder ?
|
Not completely decided on that yet. I do have a DAC coming in my chip order which I could use (somehow that seems like cheating to me though) or a resistor network connected to a 4051 kind of like the envelope generator in the fun with sea moss page ( http://milkcrate.com.au/_other/sea-moss/#amp ). So I'd only be getting 8 volume levels but that is good enough for me.
PHOBoS wrote: |
synaesthesia wrote: | First, you need some "vent" to control the output level. A 4066 analog switch is either on or off. You cannot control what goes through it easily. |
I think the idea is to use it in reverse so to speak. Instead of having the audio level controlled by the switch you're controlling
the switch with the audio. a varying voltage on the input of the switch will create the audio signal with that voltage as amplitude at the output.
It's a similar approach to using a single diode and resistor to create a VCA. |
Yeah, exactly the switch is controlled by the digital audio signal and the analogue output from the ADSR is what is being switched on and off which will give an amplitude to a square wave coming out of the 4066.
On another thought about ADC and DAC, what kind of tolerances do the cheap ADC/DAC chips have? would there be muchf play in feeding the result of a DAC into a ADC and then back to the DAC, would it cause the outputs to jump around in an intersting fashion? |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Wed Jan 07, 2015 3:12 pm Post subject:
|
|
|
synaesthesia wrote: | Right, didn't see the idea to run it in reverse. Wouldn't much of the signal be lost then?
|
Probably, as I said I am a total beginner when it comes to circuit design, I have forgotten all of my analogue electronic classes from 18 years ago.
synaesthesia wrote: |
If you happen to have one, an example circuit for this concept would help. |
First I'll need to buy the chips! What is the software that people use to draw he nice diagrams? I could at least lay out what I am thinking to make it clear. |
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5581 Location: Moon Base
Audio files: 705
|
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5581 Location: Moon Base
Audio files: 705
|
Posted: Wed Jan 07, 2015 3:35 pm Post subject:
|
|
|
AlistairJHutton wrote: | On another thought about ADC and DAC, what kind of tolerances do the cheap ADC/DAC chips have? would there be muchf play in feeding the result of a DAC into a ADC and then back to the DAC, would it cause the outputs to jump around in an intersting fashion? |
just connecting them doesn't cause much interesting effects no idea about creating a feedback loop that might be fun.
But you can change the sample rate, the bit depth and randomize bits or insert random bits.
I was planning on doing something like that but I used the ADC I had for a random generator. _________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
|
commathe
Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Wed Jan 07, 2015 9:24 pm Post subject:
|
|
|
Hey Alistair, I have nothing constructive to add except that I'm from Edinburgh too! Auld Reekie represent! |
|
Back to top
|
|
|
brock
Joined: May 26, 2011 Posts: 112 Location: Canada
|
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Thu Jan 08, 2015 10:40 am Post subject:
|
|
|
PHOBoS wrote: | AlistairJHutton wrote: | On another thought about ADC and DAC, what kind of tolerances do the cheap ADC/DAC chips have? would there be muchf play in feeding the result of a DAC into a ADC and then back to the DAC, would it cause the outputs to jump around in an intersting fashion? |
just connecting them doesn't cause much interesting effects no idea about creating a feedback loop that might be fun.
But you can change the sample rate, the bit depth and randomize bits or insert random bits.
I was planning on doing something like that but I used the ADC I had for a random generator. |
Thinking about ADC a bit more, I've only been considering parallel output ADC chips - but the serial out chips - like this one http://www.farnell.com/datasheets/1836396.pdf - are considerably cheaper and it's output (for a given fixed analogue input) would be a nice stream of repeating 8 steps. All the fun of an 8 step sequencer with just 1 chip and a pot. Err and a clock for the ADC chip as well I suppose ut if you already have an oscillator to synch beats elsewhere it can go int the ADC anyways. |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Fri Jan 09, 2015 12:17 pm Post subject:
|
|
|
Well, I've put in my order for the chips so hopefully we'll be able to hear how it sounds soon. |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Mon Jan 12, 2015 6:33 am Post subject:
|
|
|
Parcel has arrived. |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Tue Jan 13, 2015 4:39 am Post subject:
|
|
|
I have made a LED blink at 0.83333 Hz. Nothing blew up. I think I've got the hang of this. |
|
Back to top
|
|
|
AlistairJHutton
Joined: Jan 07, 2015 Posts: 8 Location: Edinburgh
|
Posted: Wed Jan 14, 2015 5:35 am Post subject:
|
|
|
And now I have sound coming out of a speaker. This is fun. Although I need ot get a lot better at reading resistor values. |
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5581 Location: Moon Base
Audio files: 705
|
|
Back to top
|
|
|
|