I want to encode a mono audio signal into a digital squarewave where the repitition frequency is the same as the instantaneous incoming audio, and the pulse width is proportional to the amplitude.
It's easy enough to clip the audio to get the right repitition frequency, but I'm not sure about the amplitude encoding. Something simple with 555s or similar would be great...
Good question. The resultant FM & PWM pulse train will be used to gate a high frequency pulse train, probably in the order of 400kHz. I want a recognisable form of the original audio, very much NOT hi-fi but recognisable none-the-less, to be recoverable from the final, gated, high-frequency pulse train.
My bad - I should have been more explicit - part of the issue is that I wasn't too sure of the final requirement myself.
many thanks for all your comments so far - very helpful.
Assuming now that I'm after FM & PWM, and I'm not worried too much about nyquist or hi-fidelity, can anyone recommend a simple approach using say a PWM controller like the TL494 or whatever?
You can sort of understand the output of audio fed into a zero referenced comparator... sort of a 1 bit digitizer that roughly follows the zero crossings, so it has a lot of fundamental in it.
Audio doesn't have a 'repetition fequency'. Do you mean the frequency of the audio ? There's a problem there, music isn't a single frequency. Squaring it sort of works I suppose except you'll see mostly LF content as a rule.
SWP/VSM Space width modulation/Variable Space Modulation.
A known trick used in simply things like RC control toys.. some types of remotes etc.
Pulse rate is detected at the receiver to select a channel of control while the duty cycle (width) is used for proportional control of that channel.
for basic application of, use a PIC/AVR or what ever to sample a complete transition onto the start of the next. Sample the time window as the frequency and the duty cycle as the proportional scale.
Thanks for the help. It's appreciated - I'll try this approach and see what happens. Not being an EE, it's sometimes tricky knowing where to start. I'm happier with s/w than h/w...
I've got an AVR in the circuit - I'l also try digitising the stream with a free-running ADC (8 bits would be fine), using the zero crossing to determine the pulse interval, and take the peak amplitude in the interval to determine the pulse length. Though this is crude, it should give me roughly what I need. I could always perform a faily short FFT (say 1024 bit) on the input stream, extract the fundamental/ peak energy frequency and its power, and use that, though in this instance it may be overkill...
You have a good point - I didn't express myself well, and didn't explain the issue properly. I'm hoping that the source with be monophonic, and the various approaches suggested so far have helped me clarify what I need to do. If the source ends up being polyphonic, or the simplistic approaches end up being unsuitable, then I'll move to the FFT one I mentioned elsewhere - I've used that before so already have workable code in GCC...
I think an ADC might be a good idea, some microcontrollers have them integrated, too, so you don't need much external components at all. But a FFT needs quite some processor power, so might be difficult with an AVR. If you need just detect some known frequencies, you can try this algorithm:
formatting link
You can adjust a bit the bandwidth by selecting the right window function. I've used this with a DSP for analyzing sine signals for multiple channels in parallel at 48 kHz and works nice.
--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
To get a voltage proportional to amplitude without filtering (which would have time-constant-vs-ripple issues), you could feed the input into both a zero-crossing detector (comparator) and into an op-amp integrator. When the comparator output goes low, it fires a one-shot that samples the integrator. This is just a CMOS switch (CD4016 section) that is closed briefly to charge a cap, whose voltage is monitored by an op-amp buffer. When the one-shot is done, the integrator cap is shorted by another
4016 section for the rest of the half-cycle.
The result if all this is that the buffer output will have a voltage proportional to the integrated amplitude of half the incoming wave. It will hold at that value until completion of the same half-cycle of the following wave cycle, and then it will step crisply to the new voltage.
If you had a fixed-frequency input, then you could just use this voltage to set the duration of a one-shot. But it sounds like what you really want is to control the duty cycle of the output for varying input frequencies (PWM). This would probably be best done with some sort of dual-slope approach, the details of which I haven't worked out yet.
Best regards,
Bob Masta DAQARTA v4.51 Data AcQuisition And Real-Time Analysis
formatting link
Scope, Spectrum, Spectrogram, Sound Level Meter FREE Signal Generator Science with your sound card!
--
if you want to use a _single_ frequency, neither 'monotonic' nor
'monophonic' is correct since, for the former, the signal voltage
changes polarity periodically and, for the latter, octave-related
frequencies can appear simultaneously on the single signal.
http://en.wikipedia.org/wiki/Monotonic_function
http://en.wikipedia.org/wiki/Monophony
I take it that what you'd like is a system where, say, a piano was being
played, one note at a time, and for each note played you'd like to have
an output pulse train with a period which corresponded to the frequency
of that note and a period which corresponded to its amplitude.
Something like this?: (View in Courier)
||
_ _
A440pp __| |__________________________________| |____________
->| |
Absolutely. Thank you. I was going to stick on an input low-pass filter with a 3dB point at about 5kHz to simplify things a bit. But, yes, single notes.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.