samuraipizzacat29

hello, sorry if this has been covered before, but the search function fails me. I would like to do mulitple pwm oscillators off of an uno. The oscillators need to be locked in frequency, but able to have different "start points". Therefore, they would be out of phase with each other. The idea is to make something like a CMOS melody generator:http://www.youtube.com/watch?v=lb_1RoYByqcI figure if I have full flexibility of the oscillators, I can combine as many pwm channels as I want to make complex digital waveforms, sequences, or even just clock or trigger signals for other devices. Therefore, I need frequency control, pulse width control, and a phase (or start point delay) function.

I'm unsure whether I would attenuate each channel separately using a potentiometer or a VCA in the case of the waveform/melody generator. Yet, if it was able to be done in the microcontroller and give an analog output, I feel that would be superior.

Can anyone help point me in the right direction? so far, the pwm articles i've read say little about creating out of phase pwm channels. I feel like the tlc5940 is a good start since it'll give a max of 16 channels. Then I could make a 16 step analog sequencer with the same device! I'm not sure if the best approach is a ton of conditional statements or ________?

first microcontroller project if it isn't obvious

thanks,nate

samuraipizzacat29

right around minute 4 of this video shows a CMOS project doing basically what I'd like to do with a microcontroller. It uses multiple square waves attenuated separately to control an oscillator. Project page at the cat girl synth site.

samuraipizzacat29

I appreciate your reply. the sounds in the video are not inherently what i'm after, it's the piece sending the voltage control to the oscillator that I want. Maybe it's best visualized with pictures.

Here's a stepped wave from the web:

I'm only interested in the positive going side of the wave. Therefore, I would view that as 4 PWM waves in frequency sync with each other, but each with varying pulse width, amplitude, and phase. I would like to manipulate each pulse on its own to go from simple clock signals all the way up to complex waveforms that would of course have to be fined tuned on the user's end with a scope to be musical

PeterH

I'm only interested in the positive going side of the wave. Therefore, I would view that as 4 PWM waves in frequency sync with each other, but each with varying pulse width, amplitude, and phase. I would like to manipulate each pulse on its own to go from simple clock signals all the way up to complex waveforms that would of course have to be fined tuned on the user's end with a scope to be musical

It sounds as if you're trying to approximate a DAC, and doing that with multiple PWM signals doesn't seem a particularly obvious way to achieve that.

What sort of sampling frequency do you want to achieve on the output? What sort of resolution do you need to achieve on the amplitude?

samuraipizzacat29

I need to be able to use the individual pwm signals for triggers and gates in a synthesizer for creating funky rhythms and the like. I haven't got as far as amplitude resolution since I figured I could do that after the fact if needs be by attenuating each channel. I'm mostly concerned with getting the pwm waves out of phase and pulse width controllable. so that I can do something like this:I'm viewing this as 4 different waves locked to the same frequency, but out of phase with each other. I want control over the pulse width and phase so that I can change it subtly like thisor I could fine tune it so that the waves align themselves like a low bit rate stepped wave into audio frequencies, as a step sequencer, or as a melody generator sending CV to an oscillator.

Its easy enough to do with DDS, you could even use the Auduino as a starting point, the two triangle waves are easily converted to square waves, you could also easily output them on two seperate pins rather than mix them on a single pin.

Phase and pulse width are also easy enough, in fact the triangle wave is a really good base for variable pulse width - I will let you figure out how and why.

This project uses DDS to generate four simultaneous waveforms - it isn't exactly what you want but has a lot of explanation and the code is fully commented for you to adapt -

PeterH

That is starting to look a bit like a serial data stream and if your modulation patterns are simple enough, perhaps you could achieve them as a bitstream.

Failing that, I remember reading about an Arduino tone generator project which worked on the basis of a timer triggering at a frequency which was suitable higher than the frequencies of all the tones that needed to be generated and just toggled the outputs high and low at the appropriate times. I'm sure that Googling for Arduino tone generator would find it for you.