electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Mixed Control Oscillator
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [17 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sat Apr 21, 2012 9:44 am    Post subject: Mixed Control Oscillator
Subject description: ATtiny84-based DCO with analog modulation
Reply with quote  Mark this post and the followings unread

Hello all,

I'm working on a hybrid analog/digital oscillator, based on an AVR microcontroller (ATtiny 84) for computing the pitch and a classic sawtooth core for generating the waveform.

It's starting to take a good shape, I have posted some schematics and I will probably shoot a video of the live sawtooth when I'm finished working on the prototype. Very Happy

Posted Image, might have been reduced in size. Click Image to view fullscreen.
(calculation for the sawtooth core in EveryCircuit)

Here is the history:

About a year ago, when I was working for Arturia with Yves Usson (Yusynth) on the MiniBrute prototype, he taught me a lot of things about his sawtooth core VCO and the Lin/Exp converter, on how to compensate the temperature drift and how to tune it to have a good tracking over 10 octaves.

Immediately, I started imagining something bigger, a polyphonic 8 voice synth, but that would still need to be retuned from time to time (all the full analog polys have this problem).

As more recent polys use DCOs, I read Tom Wiltshire's explanation of the Juno DCO operation, with a master clock and dividers. It seemed the way to go, but the technologies used are a bit outdated, with the Arduinos/FPGAs/other cool digital stuff widely available these days.

So a few points came to my mind to make a better DCO. It had to be:

  • ANALOG! (well, at least the generated waveform, no DAC to generate it).
  • ready to use as soon as it is powered up, no warm-up time.
  • completely independent from ambient temperature changes.
  • precise in frequency.
  • capable of generating not only semitones, but also all the cents in between two semitones (continuous range).
  • easily controllable from a microcontroller (digital control).
  • compatible with a 1V/Oct input CV (analog control).
  • range covering (at least) all the MIDI notes.


Here is how it works:

The idea is to replace the clock divider from the Juno DCO by an independent microcontroller (no master clock needed, hence no phase problem across oscillators). Most AVRs have a 16 bit timer that performs like a charm for this purpose. It generates the reset pulse for the integrating capacitor generating the saw.

Unlike a VCO, that uses the slope (driven by the lin/exp converter) to determine the frequency, the operation is reversed: the frequency is defined by the reset pulse, and the slope needs adjusting to provide constant output level.

So the chip provides another signal, an analog one (using PWM) to set up the slope for output level compensation.

To control the pitch, I wanted both an analog and digital interface (hence the name Mixed Control). This way the synth's master controller can precisely ask the oscillators for a static note while analog modulation can be supplied from LFOs/EGs.

The SPI interface used for programming the chip is handling digital control, and it only needs 3 + N wires (where N is the number of oscillators to control). I could have used I2C, but an addressing system would not have been as easy to put together (and it might have been slower).

The AVRs all have a 10 bit ADC, that is used for analog modulation, as the pitch is computed in the chip (whereas in the Juno, it had to be the master controller to compute the pitch for each oscillator).

Sound samples are available here.

Plot of the spectrum (square output), continuous frequency sweep:
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Plot of the spectrum (square output), discrete frequency sweep (only semitones):
Posted Image, might have been reduced in size. Click Image to view fullscreen.


More to come soon! Wink

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
reflex



Joined: Mar 04, 2011
Posts: 11
Location: Canada
Audio files: 1

PostPosted: Mon Apr 23, 2012 6:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Very cool. I'm definitely interested in hearing and seeing more of this as it progresses. It looks like a nice way to get a nice analog waveform without the tradeoffs of vcos.
Back to top
View user's profile Send private message
yusynth



Joined: Nov 24, 2005
Posts: 1214
Location: France

PostPosted: Tue Apr 24, 2012 3:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi Franky

I see you are progressing ! I look forward to see your finished project.

_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
Sebo



Joined: Apr 27, 2007
Posts: 525
Location: Argentina

PostPosted: Tue Apr 24, 2012 3:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

Great project!!!
I dreamed of something like this for long time...

_________________
Sebo
---------------------------------------
My Music:
www.cosaquitosenglobo.com.ar
www.myspace.com/cosaquitosenglobo
Back to top
View user's profile Send private message
Tim Servo



Joined: Jul 16, 2006
Posts: 924
Location: Silicon Valley
Audio files: 11

PostPosted: Wed Apr 25, 2012 2:45 pm    Post subject: Mixed Control Oscillator Reply with quote  Mark this post and the followings unread

Very cool! It would be neat to see a relatively simple way of putting together a polyphonic set of sawtooth VCOs. Definitely looking forward to seeing how this works out.

Tim (I thought Sawtooth was a James Bond villain) Servo
Back to top
View user's profile Send private message
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sat Apr 28, 2012 10:34 am    Post subject: Reply with quote  Mark this post and the followings unread

@yusynth: Yes, you'll be one of the first to hear it when it's done Wink (Potard already had a snapshot of the uncompensated saw).

Maybe I'm not going to bother with a lin/exp converter for the slope compensation after all. This is tricky to set up, and it might be enough to roughly output a PWM signal with an exponential response directly on the 8 bit DAC (it would cover 120 notes over the 128 of MIDI, and would be more precise on the high end). I have to try to see how it goes.

@Tim: Yeah, that's the idea! Smile Basically, this could be used in a modern synth (ie: microcontroller-controlled), without much effort (DAC calibration and tuning).

The Sawtooth waveform I've got is not perfect yet, there are still some non-linearities at the end of the discharge (meaning the slope is "too long"), but it actually sounds nice on a saw! Pity it would mis-shape the other waveforms though.. With most VCOs, you can directly do maths operations of the curves, since they are almost perfectly generated (amplitude and shape). But then I guess that's the difference between how you want it to sound and what you want to do with it.

I have some other (older) projects to finish these days, but I'll be back on this soon. I'll keep you guys posted Wink

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
reve



Joined: Feb 23, 2008
Posts: 147
Location: USA

PostPosted: Sun Apr 29, 2012 11:16 am    Post subject: Re: Mixed Control Oscillator
Subject description: ATtiny84-based DCO with analog modulation
Reply with quote  Mark this post and the followings unread

[quote="Franky"]
capable of generating not only semitones, but also all the cents in between two semitones (continuous range).
/quote]

Is this possible with a ten bit ADC? Seems like you'd be looking at a minimum of like 5 or 6 cents, even if you were limiting to 5 octaves...

I am super totally jazzed on this project.Smile

_________________
- r. mosquito
SynthDIY Synthpop -> http://www.reverbnation.com/photovoltaik
Back to top
View user's profile Send private message
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sun Apr 29, 2012 2:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

Indeed, with 10 bit resolution on the analog input I have to sacrifice precision if I want to have the whole range available, or I can choose to scan only a smaller section around the digitally set frequency for analog modulation, with higher precision.

This part still requires some work, I've seen techniques on the Atmel application notes to oversample the ADC to achieve 16 bit resolution, which would be quite better.

I also have some FM noise when I sample a simple pot between 0 and the chip's 5V supply, but maybe with an external "clean" CV it might be better.

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
reflex



Joined: Mar 04, 2011
Posts: 11
Location: Canada
Audio files: 1

PostPosted: Sun Apr 29, 2012 3:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have some experience with this.

Using 16X oversampling, you can squeeze 12-bit resolution out of the ADC circuit on an ATMega/Tiny and still end up with a sampling rate of around 500Hz (doesn't sound high, but it's more than adequate for sampling a cv input).

Going beyond 12 bits just isn't worth it -- each bit will require 4X the oversampling.
Back to top
View user's profile Send private message
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sun Apr 29, 2012 4:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks reflex! Very Happy

Well there is also the frequency calculation in the main loop that's taking some CPU time, so it should be lower than that in the end, but FM is not really what I had in mind with this.

The original idea was to control it with the digital interface to set the "stable/precise" note, and use analog input for modulations like a LFO or envelope.

BTW, the code for the ATtiny 84 is available on github.

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
cappy2112



Joined: Dec 24, 2004
Posts: 2191
Location: San Jose, California
Audio files: 2
G2 patch files: 1

PostPosted: Mon Apr 30, 2012 10:16 pm    Post subject: Re: Mixed Control Oscillator
Subject description: ATtiny84-based DCO with analog modulation
Reply with quote  Mark this post and the followings unread

Franky wrote:
Hello all,

The SPI interface used for programming the chip is handling digital control, and it only needs 3 + N wires (where N is the number of oscillators to control). I could have used I2C, but an addressing system would not have been as easy to put together (and it might have been slower).



Neat project Franky!

Why do you think the I2C addressing would have been a problem?
I agree the bandwidth may be too slow though.

_________________
Free Tibet. Release the Panchen Lama from prison. Let the Dalai Lama return to his home.
Back to top
View user's profile Send private message
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Mon Apr 30, 2012 11:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well the i2c would have required a way to setup the addresses for each oscillator, which is usually done with IO pins, and there are not a lot available (although the SPI originally uses more pins, setting 8 MCOs would have needed 3 dedicated address pins). And it's slower.

Plus, with SPI, I can have two (or more) oscillators listening to the same message (eg: I can set the global detune for all MCOs with only one message), as this is handled by a Listening pin that can be toggled on/off independently for each MCO.

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sat Jun 09, 2012 2:23 am    Post subject: Reply with quote  Mark this post and the followings unread

Some news on the project:

I changed the structure of the Saw generator, it's now using an OpAmp integrator instead of a transistor as a current source, much more predictable, stable etc..

The structure is almost the same as the Juno's DCO, for what can be decrypted from the service manual (as the sawtooth generator is potted into the MC5534 voice chip). By the way, I never found a schematic for this chip, I've seen clones pictures with a few transistors and what could be opamps, do you guys know if such a thing is available?

Now that the saw is looking good, I'm working on the amplitude compensation. This is done by sending more voltage to the input of the integrator when the frequency increases, with an exponential response (freq * 2 => amplitude * 2).

To minimise the number of components used in the process, I'm using the AVR to compute the exponential response.
There should be no drift at all this way, apart from the capacitor's own thermal drift. I guess this can also be minimised with a good material for the cap, but so far this is less of my concern than getting a clean output across all range.

The PWM controlling the amount of slope to inject to the saw is only 8 bit, so to properly cover the whole 10 octave range I'll have to split it in two, and increase the integrator's resistance above the middle of the range.

I'll post a draft of the schematic soon, when I cleaned it up according to the latest experiments.

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
reflex



Joined: Mar 04, 2011
Posts: 11
Location: Canada
Audio files: 1

PostPosted: Sat Jun 09, 2012 3:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

You could use the same approach I did when designing the MeeBlip. I sent a 16-bit word into two weighted 8-bit DAC channels - one channel as high byte, one as low byte. It works surprisingly well.

Here's a fragment of a circuit that I have been working on. It is a digitally controlled VCO which outputs triangle and variable pulse. An ATMega is used to generate the slope of the waveform using 2 summed PWM channels and the SYNC pulses.

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message
inlifeindeath



Joined: Apr 02, 2010
Posts: 309
Location: Albuquerque, NM

PostPosted: Sat Jun 09, 2012 11:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

really interested in seeing what you come up with Franky!
_________________
http://www.youtube.com/user/borisandfef
Back to top
View user's profile Send private message Visit poster's website
Franky



Joined: Dec 09, 2007
Posts: 57
Location: Grenoble - France

PostPosted: Sun Jun 10, 2012 1:45 am    Post subject: Reply with quote  Mark this post and the followings unread

@reflex: Interesting, I was thinking of this technique for another project, it did not cross my mind to apply it for this one Very Happy

Well I'll have to cheat a little bit to output the second PWM wave on the last free pin on the tiny84, but I guess that would save me a few components as well..

Cheers! Very Happy

BTW, I did not know about your MeeBlip, it looks very good!

_________________
Forty Seven Effects
Back to top
View user's profile Send private message Visit poster's website
Potard



Joined: Jun 16, 2009
Posts: 5
Location: France

PostPosted: Tue Jun 12, 2012 1:40 am    Post subject:   Reply with quote  Mark this post and the followings unread

I just ordered an LPCXpresso board (LPC1769), alongside various other experiments I will try to implement your concept on this platform, at least for study purpose.
Let's keep in touch. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [17 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
emSynth

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use