Author |
Message |
jnuaury
Joined: Feb 28, 2008 Posts: 161 Location: chicago
Audio files: 9
|
Posted: Sun Aug 10, 2008 2:28 pm Post subject:
max/msp > arduino > cv Subject description: this has been wrecking my brain a bit |
|
|
awhile back i was using max to control some electromechanical stuff through the arduino using this "maxuino" code
http://www.parasitaere-kapazitaeten.net/max_msp/pduino_for_max
arduino pulse width is normally at 490Hz which is not good enough for cv control... i recently came across this link where someone is actually using the arduino for dsp in a guitar pedal
http://www.instructables.com/id/Lo_fi_Arduino_Guitar_Pedal/
i dont think ill be needing to "stack" the pwm outs as it will be for CV instead of audio purposes but ive been trying to take the pwm frequency override code from the guitar pedal link and shove it in the maxuino code
i listened to the pwm out and it definitely wasnt 490Hz anymore but it seemed to act pretty wonky and i was getting some weird hiccups and freakouts when i tried adjusting the PWM value
has anybody tried similar things with greater success?
i wonder if serial communications and high pwm rates is just too much for the arduino |
|
Back to top
|
|
|
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Tue Aug 12, 2008 8:10 pm Post subject:
|
|
|
Hi jnuaury,
I'm not quite sure what you're trying to do--can you give me a little more information? I haven't had any trouble using PWM outputs for analog voltages--the pulse width doesn't really matter much when you use a lowpass filter to smooth the output. But what you wrote makes me think you're looking for something different.
One note, for sure--if you're trying to generate audio waveforms directly from PWM, and if the "maxduino" code does something with the timer interrupts in the Arduino, then I would expect some irregularities in the PWM. I don't have Max/MSP, so I can't really see what it's trying to do. If it's *lots* of serial data, then I would expect glitches.
I've mostly been using parallel DACs (both chips and discrete resistor versions) for control voltage output, though, because they're more accurate for note control voltages.
Thanks,
Ole |
|
Back to top
|
|
|
skrasms
Joined: Feb 21, 2008 Posts: 121 Location: Portland, OR
|
Posted: Wed Aug 13, 2008 3:24 pm Post subject:
Re: max/msp > arduino > cv Subject description: this has been wrecking my brain a bit |
|
|
jnuaury wrote: | awhile back i was using max to control some electromechanical stuff through the arduino using this "maxuino" code
http://www.parasitaere-kapazitaeten.net/max_msp/pduino_for_max
arduino pulse width is normally at 490Hz which is not good enough for cv control... i recently came across this link where someone is actually using the arduino for dsp in a guitar pedal
http://www.instructables.com/id/Lo_fi_Arduino_Guitar_Pedal/
i dont think ill be needing to "stack" the pwm outs as it will be for CV instead of audio purposes but ive been trying to take the pwm frequency override code from the guitar pedal link and shove it in the maxuino code
i listened to the pwm out and it definitely wasnt 490Hz anymore but it seemed to act pretty wonky and i was getting some weird hiccups and freakouts when i tried adjusting the PWM value
has anybody tried similar things with greater success?
i wonder if serial communications and high pwm rates is just too much for the arduino |
490 Hz sounds incredibly slow for decent CV control, even with nice filtering. It's not even 9-bit for DC, let alone signals that are actually changing. I don't use the Arduino, but I see it has SPI support for some better options.
You could look into getting an SPI-controlled digital potentiometer that connects from +5V to ground and outputs on the wiper. Using the arduino to control the resistance would give you a cheap D/A (most likely 8-bits).
Here is a whole guide on an Arduino controlling a digipot: http://www.arduino.cc/en/Tutorial/SPIDigitalPot
OR you could go all out and get an SPI-controlled D/A chip from someplace like Analog Devices.
Hope that gives you some ideas! _________________ Software and Hardware Design |
|
Back to top
|
|
|
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Wed Aug 13, 2008 3:44 pm Post subject:
|
|
|
skrasms wrote: "...490 Hz sounds incredibly slow for decent CV control..."
It sounds wrong, actually--the default for analogWrite() is supposed to be 30kHz. It's also possible to change the PWM freqency, so the PWM speed itself probably shouldn't be an issue.
In addition, while the default PWM setting is for 8-bit, evil mad scientist labs had a nice piece on using 10-bit PWM. It looks like you could use up to 16-bit, but there would be various tradeoffs.
SPI using the provided shiftOut() function, however, is very slow. For playing notes, I've found that using digitalWrite() to control parallel DACs and/or latches works much better.
You can also use direct port manipulation to write all of the values in a given port (there are three predefined ports) at once, but there are disadvantages to using this approach. (Namely, that the only port available that a.) doesn't conflict with the analog inputs, and b.) doesn't conflict with Serial in, is 6-bit.
Thanks,
Ole |
|
Back to top
|
|
|
okvern
Joined: Feb 05, 2008 Posts: 78 Location: Seattle, Washington
Audio files: 5
|
Posted: Wed Aug 13, 2008 4:43 pm Post subject:
|
|
|
I goofed slilghtly in the above--the conflict I was thinking of isn't serial in--it's that digital outs 2 and 3 can be used as interrupt lines in Arduino 011 and newer, and I need them for that purpose.
Thanks,
Ole |
|
Back to top
|
|
|
fluxa
Joined: Jul 04, 2008 Posts: 2 Location: shanghai
|
|
Back to top
|
|
|
|