Prop Amplitude Modulation
WNed
Posts: 157
Hello,
I'd like to try to recreate an accurate vibraphone sound, and thought of using one cog to modulate the tone output of another cog.
Cog0 generates a tone on Pin0, which goes to the base of a transistor. Cog1 generates a varying PWM output to Pin1 connected to the collector of the transistor. The result should be an amplitude modulated tone to a load (speaker) between the collector and emitter.
Question 1: Is that theory correct?
Question 2: Is there a better / simpler way to accomplish this?
Question 3: If this is a good way to go about it, what would be a good transistor for this type of circuit? (I know how transistors work, but never got the hang of how to select the right one)
Thanks,
Ned
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno
I'd like to try to recreate an accurate vibraphone sound, and thought of using one cog to modulate the tone output of another cog.
Cog0 generates a tone on Pin0, which goes to the base of a transistor. Cog1 generates a varying PWM output to Pin1 connected to the collector of the transistor. The result should be an amplitude modulated tone to a load (speaker) between the collector and emitter.
Question 1: Is that theory correct?
Question 2: Is there a better / simpler way to accomplish this?
Question 3: If this is a good way to go about it, what would be a good transistor for this type of circuit? (I know how transistors work, but never got the hang of how to select the right one)
Thanks,
Ned
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno
Comments
You could also do all the synthesis including the multiplication digitally and output PWM to an audio amplifier. The Demo Board's schematic includes a PWM output circuit with a headphone amplifier included. In assembly language, a 16 bit multiply takes about 2.5us, more than fast enough for a high quality vibraphone synthesis.
I've got a demo board and will start picking away at the various PWM objects available for code examples.
Ned
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno
Raymond Allen's ToneGen is sine wave generator in spin that uses the ROM table. The output from that is pretty decent in that the tones have a pretty smooth sound even in headphones. I've got Beau Schwabe's Freq Synthesis object I'll have to look into because Allen's ToneGen only goes down to 8hz, which is too fast for vibe modulation. Then I'll learn about signal multiplication in software!
Mike, me boy, you're regular pillar of the community!
Added: Oops, Beau's object creates square waves. No go on that idea.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno
Post Edited (WNed) : 4/29/2009 6:32:25 PM GMT
If you generate two PWM signals that have the same exact frequency and you only adjust the phase of one of the signals, you effectively can control the amplitude modulation of the signal. At 0 Phase difference, the amplitude is the greatest, at 180 Phase difference, the amplitude is the least.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Assuming they're mutually coherent, and the PWM signals are perfectly rectangular, the output amplitude will be maximum when the pulses coincide, and zero when they don't overlap·-- which may occur with only a very small phase (time) difference, depending upon the pulse widths.· It sounds kind of hard to control.
In sum, I think I like WNed's original proposal better -- modulated signal on the base, and modulating signal as PWM on the collector supply.· I don't like his coupling method to the speaker, though.· Instead I'd use a resistor in series with the collector, chosen to give a load line in the linear region of the transistor's curves; and a small resistor in series eith the emitter to improve both linearity and stability.· Take the output signal off the collector through a capacitor, feeding a low-pass amplifier of some kind (to get rid of the PWM pulses)·which eventually feeds a speaker.· I might even use an LMF100 for the low-pass function, although really an RC would likely be good enough.· I just kind of like LMF100s, and I have a lot of LMF100s in my junk box.· They make stunningly good audio filters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
If you look at the DUTY mode output from two counters, A and B, as independent random variables, such that the probability at any point in time of the output from x being high is P(x) = FRQx / 232, then the probability of both being high at once, P(A & , is P(A) * P(B) which is proportional to FRQA * FRQB.
Of course the outputs are neither random nor independent, but as long as FRQA and FRQB are relatively prime, they should act as if they are and provide a plausible simulation of a modulation product. (Addendum: But if both are constantly in flux, as they would be with two sine waves, this point is likely moot.)
But I have to agree with Mike, in that there's ample time to do the multiplication in software, obviating the need for external hardware, save a lowpass filter for the DUTY doody.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 4/30/2009 8:08:57 AM GMT
Yes, and what happens if the frequencies are a little different? You have something like two signals with the same frequency and linearly changing phase difference. Remember trigonometry: Generate two signals, one a little lower than the one to produce, the other one the same little higher, and get the desired frequency with an amplitude modulation of abs(sin(t)) and a phase modulation of 180° * sign(sin(t))! Your ear won't notice the phase modulation but the amplitude modulation.
Okay, I don't know if you really want this modulation signal. Give it a try. It looks rather simple.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
Musical Applications of Microprocessors by Hal Chamberlin
http://www.amazon.com/Musical-Applications-Microprocessors-Hal-Chamberlin/dp/0810457687/ref=ed_oe_h
...it's been out of print for years but if you can pick up a copy second-hand it would be an invaluable read.
Check out the attached animated illustration.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 4/30/2009 3:55:43 PM GMT
-Phil
Jonathan
* this is (of course) complicated by the fact that the sine table is only 2048 samples covering 90 degrees, so the actual "lookup" requires the whatever cool wrapping and mirroring tricks you have to do to actually recover a sample from a full 360 degree sine wave.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
If you load ToneGen and edit it to send two signals to one pin, by playing with all the available parameters, you can achieve some fantastic sound effects (none of them sound like a vibraphone). But if you try to do wave summing that way, well... you can do 1+1, in phase, but as soon as you try to shift one of the tones, you start getting interference patterns rather than a modulated tone, so you need a way to filter those out. I think Phil's OR idea deals with that.
@Jonathan - That's probably the easiest way to allow for dynamic modulation, rather than trying to shorten or lengthen the signal for one cycle.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno
Post Edited (WNed) : 4/30/2009 5:52:26 PM GMT
For reasons you mention, I would not try to directly combine the two PWM's.· Instead, use a simple RC filter to turn the PWM into a pseudo-sine wave.· Do this for·both PWM signals, and then use a Summing Amplifier to combine the sine waves together.
http://hyperphysics.phy-astr.gsu.edu/HBASE/electronic/opampvar5.html
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno