![]() ![]() Google it, you'll find a lot, let's say on wikipedia. This filter can be an RC filter, which takes a resistor and a capacitor. Then pick a PWM channel and attach a low pass filter to it, to remove the high frequency. Aim for a high frequency, ideally above 20KHz, but anything smaller will do, just with more noise. There's at least one article on it on the arduino site. ![]() I'm writing from the top of my head, so you'll have to fill-in the gaps and do some searches.ġst thing you need to find out how to increase the PWM frequency. Here's an interesting experience if you'd like to try it. You'll have to figure out the rest for yourself.Īctually, the MOD playing think needs only 1 PWM channel for "any" number of music channels. Then you just need to have a timer to dump a signal into the DACs, at a fixed frequency (the sampling frequency). ![]() Set a high pitch PWM frequency and then modulate the duty cycle this creates a DAC. You can play complex sounds with this technique (like playing a WAV file, a "sample"). This technique uses 1 PWM port per channel. There's another alternative, using the same technique used by those ancient MOD files on the PC using the speaker. Then you put a diode and a resistor in series with all "tone" pins and connect together at the end that's where your mixed channels will come out. The timer frequency needs to be such that you your tone frequency error is small. The trick is, to play a tone in one channel, you need to toggle a port bit every few timer calls, such that you get the desired tone frequency. Then you need some data structure to manage the state of the several channels (one channel = one tone). Update: ok, it is possible to make lots of tones with one timer, but it does require some programming skills. This doesn't actually solve your problem, but it did appear to be a good opportunity to say it, sorry Oh, and it had a weaker CPU that was equivalent to an arduino running at 0.885 MHz. Does anyone remember the ZX Spectrum (48K)? It made all of those sounds (plus the rest) with a single port pin. ![]()
0 Comments
Leave a Reply. |