| Author |
Message |
cyberheater
Joined: Jun 03, 2008 Posts: 12 Location: Scotland
|
Posted: Thu Jun 12, 2008 7:46 am Post subject:
Has anyone had any success using a Pic as a VCO? |
 |
|
I've just started back into electronics and am wondering about the ability of a Pic microprocessor to output saw, pulse etc.. at standard audio frequencies.
I guess some sort of wavetable with a 8bit DAC. Is a pic fast enough for this application.
Any issues that I should be aware of.
Thanks. |
|
|
Back to top
|
|
 |
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Mon Jun 16, 2008 12:15 pm Post subject:
|
 |
|
Hi cyberheater,
PICs and AVRs seem to be able to do a pretty good job of acting as VCOs. You don't even really need to use a DAC--you can use the PWM outputs and filter them. I mostly use analog VCOs and VCFs and use microcontrollers for timing and other control functions, but I don't see any reason not to use them for waveform generation. You might take a look at the Fraktal Synth topic for a few PIC-generated samples.
Thanks,
Ole |
|
|
Back to top
|
|
 |
e45tg4t3

Joined: Nov 19, 2007 Posts: 13 Location: Germany
|
Posted: Mon Jun 16, 2008 3:33 pm Post subject:
|
 |
|
hi there,
maybe this could help you http://www.electricdruid.com/ her is a vclfo based on a pic but my assembler isn´t that good... maybe you can change the sourcecode of it to make an vco out of it....
Benny |
|
|
Back to top
|
|
 |
Franky

Joined: Dec 09, 2007 Posts: 57 Location: Grenoble - France
|
Posted: Wed Jun 18, 2008 2:37 am Post subject:
|
 |
|
Yeah, but you've got to check the PWM frequency to be sure it wouldn't be a problem at a high pitch.. At least 10x the highest frequency you want to reach is good. _________________ Forty Seven Effects |
|
|
Back to top
|
|
 |
cyberheater
Joined: Jun 03, 2008 Posts: 12 Location: Scotland
|
Posted: Thu Jun 19, 2008 5:01 am Post subject:
|
 |
|
Thanks guys.
e45tg4t3 and Franky. I've looked at that electric druid site before. It's good stuff and intend to use his designs for the envelope generators etc... but I think the Pics are too slow for good quality sawtooths etc...
okvern. I looked at that strange synth but I don't think it creates proper sawtooth type waveforms.
I think i've decided that i'm going to go down the digital controlled oscillator route.
Basically, 1 pin of the Pic generates a voltage between 0-5v which when smoothed will feeds a op amp based ramp generator and when the waveform gets to a specified length, another pin will switch on a transistor and discharge the current to form a sawtooth waveform.
This way I can get a true analogue waveform but frequency will be precisely controlled by the Pic.
BTW. It's been the best part of 20 years since I did stuff like this at College so my maths/electronics skills are rusty to say the least.
I did pick up a PicKit the other day and a few books on programming and I got a good soldering iron plus a friend recently gifted me a good oscilloscope so I should be good to go. |
|
|
Back to top
|
|
 |
cyberheater
Joined: Jun 03, 2008 Posts: 12 Location: Scotland
|
Posted: Thu Jun 19, 2008 3:32 pm Post subject:
|
 |
|
I came across this today that looks interesting and a possible start.
http://www.min.at/prinz/oe1rib/DDS/SineDDS.htm
I'll try to build something like this probably with an r1/r2 ladder at the weekend to see what it sounds like. |
|
|
Back to top
|
|
 |
frotje
Joined: Feb 26, 2008 Posts: 18 Location: Netherlands - Nuenen
Audio files: 5
|
|
|
Back to top
|
|
 |
slabman
Joined: Sep 01, 2005 Posts: 102 Location: UK
|
Posted: Thu Jul 17, 2008 9:00 am Post subject:
keep an eye on Paul Maddox's blog |
 |
|
| he is investigating the use of an Atmel Mega32 for just this purpose: http://blog.vacoloco.net/?p=68 |
|
|
Back to top
|
|
 |
slabman
Joined: Sep 01, 2005 Posts: 102 Location: UK
|
Posted: Fri Aug 22, 2008 1:28 am Post subject:
This probably won't work but... |
 |
|
| ... what about using a square wave from the PIC to clock a digital filter (such as the MF10 (http://www.national.com/pf/MF/MF10.html)? Crank up the resonance and you'd have a PIC-controlled sine-wave generator. Get the other waveforms from analogue wave shaping. Just a thought... |
|
|
Back to top
|
|
 |
slabman
Joined: Sep 01, 2005 Posts: 102 Location: UK
|
|
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sun Nov 09, 2008 7:31 am Post subject:
|
 |
|
IMO, I think you could use a PIC for a VCO, but I think not a great one. PICs aren't very fast which will limit what can be done.
And in order to do it with a slowish IC, you will need to produce audio at a fairly low sample rate. Lower sample rates make alias artifacts more apparent and at lower frequencies. If the PIC has enough power, I would suggest using a wavetable with a bandlimited version of the wave you want inside it. This will prevent ugly alias artifacts that would make you cringe when sweeping the frequency.
All in all, I think there are better devices than a straight PIC to do a musical VCO. A dsPIC sounds like a better device - but I'm spoiled by using FPGAs. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
|
Back to top
|
|
 |
slabman
Joined: Sep 01, 2005 Posts: 102 Location: UK
|
|
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Tue Nov 11, 2008 7:06 am Post subject:
|
 |
|
Just a note on something in Ryan's article about aliasing - aliasing is not prevented by using a high sample rate, it is merely made less apparent. I did a design with a 1 MHz DAC and alias artifacts are indeed hard to detect. This is because the harmonics above Nyquist (this would be 250KHz for the article dsPIC VCO) in a series that produces simple waveforms like a sawtooth are naturally attenuated enough that they aren't audible.
Also, high sample rates also place a limit on what the dsPIC is able to do each sample so to "fix" aliasing just by pumping up the sample rate often means leaving wanted features out of the device for lack of computation time.
Note that the DAC is 8 bits, it is common for inexpensive faster DACs to also be fewer bits. My own preference for a minimum is 12 bits. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
|
Back to top
|
|
 |
urbanscallywag

Joined: Nov 30, 2007 Posts: 317 Location: sometimes
|
Posted: Tue Nov 11, 2008 8:41 pm Post subject:
|
 |
|
| ScottG wrote: | | aliasing is not prevented by using a high sample rate, it is merely made less apparent. |
Why do you say that? If I increase my sample rate so that a single harmonic stays below the half sample rate I have prevented some aliasing.
If I increase my sample rate so that all harmonics that will alias are below the noise floor, I've [practically] eliminated aliasing. Of course mathematically the harmonics will fold around the half sample rate, but if I can't measure them are they there? |
|
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Tue Nov 11, 2008 9:15 pm Post subject:
|
 |
|
I was really making two points:
1: There are conditions in which high sample rate is effective and others where it is not. High sample rate helps to suppress audible alias artifacts more for notes of lower fundamental frequency than for higher notes because as the fundamental increases in frequency, the harmonics at a specific frequency are at higher and higher amplitudes and thus more and more audible (even when folded over Nyquist to form an artifact). This means that you must limit the top frequency the fundamental can attain because you will at some point begin to hear the artifacts.
2: Using higher sample rates limits the features that can be included because there is less time between samples at higher rates.
It isn't just one harmonic you care about, a sawtooth generated with a phase accumulator has an infinite harmonic series, they never stop, so elimination of alias artifacts is never possible no matter how high the sample rate is. Even if you can't hear them, they are there. HOWEVER, when the amplitude of the artifact is below the threshhold of hearing, then it doesn't matter and this is why a high sample rate helps. My point is that it does not eliminate artifacts, using the word's truest definition.
So I'm not saying it doesn't do any good - just that the good it does has limits. It's mainly a matter of what you are willing to sacrifice. If you need the features, then you're forced to use a lower sample rate to get them, but then you need to deal more seriously with alias artifacts such as by using bandlimited waveforms instead of a simple phase accumulator output.
The easiest way to hear the artifacts is to sweep the frequency of the note. Static frequency notes will hide the artifact as distortion, sweeping the frequency will make it wail like siren. You can use this to test a setup like this to determine what the highest usable fundamental frequency is.
EDIT ADD: I should also say that I use this technique too - knowing it's limitations. I've tested it with 1.0 MHz sample rates and it seems to work fairly well there - but I do limit the highest fundamental that can be produced, even with a 1.0 MHz sample rate. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
|
Back to top
|
|
 |
urbanscallywag

Joined: Nov 30, 2007 Posts: 317 Location: sometimes
|
Posted: Wed Nov 12, 2008 11:54 pm Post subject:
|
 |
|
| ScottG wrote: | | High sample rate helps to suppress audible alias artifacts more for notes of lower fundamental frequency than for higher notes |
Then keep increasing the sample rate.
Any time the sample rate is increased aliasing is prevented. Whether the remaining aliased harmonics are relevant or not is up to the designer. |
|
|
Back to top
|
|
 |
|