Simple audio encoding... how?

Dec 04, 2008 29 Replies

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!

T

h f=3D

Audio means different things to different people. Since he was saying that a square wave was at the frequency, I took it as only one frequency. ie: I think I took the only meaning that makes his post make sense. I guess I have a bias towards assuming that people who post here are not talking complete nonsense. This perhaps is a failing on my part. :)

That is a good idea but it is a type of filter.

Note the comparator I suggested and view in fixed font:

---+-----/\\/\\---+-----/\\/\\--- ! ! ! ! --!-\\ ! O ! >------+--- to integrator out yet.

How about:

Make your integration a real integration that resets on the edges.

OR (1) Voltage controlled one-shot

(2) Integrate output of (1)

(3) Use op-amp to servo to duty cycle.

On a sunny day (Fri, 5 Dec 2008 07:52:42 -0800 (PST)) it happened MooseFET wrote in :

Well, there is a lot of noise on Usenet, and sometimes I myself contribute some too ;-) I now do have the impression the OP has no clue. Not wanting to insult the OP, but if you can do a fft (like he claims), then you already have all you want, and that is software anyways.

Problem is very often people think they have some incredible new idea and then do not say what they *really* want to do. If they did the wheel would be very often there as example :-)

e some too ;-)

I didn't explain it well... mea culpa ;-)

I've used dFFT algorithms of my own design in several systems - original ideas from Numerical Recipes in C and my uni notes, but completely re-written (as the NR code is often truely awful - orginally just transliterated into C from the FORTRAN versions) over the years for uPs, differing windowing functions, new platforms etc. Initially, my first uP implementation was for a real-time bio-acoustic ultrasound analyser (30kHz->200kHz). Also used substantially the same code for analysing performance of large (Sun F15K) clusters to determine periodicity of CPU & IO-intensive events etc. (now that was a novel application).

It's not an incredible new idea, and I've never insinuated that it was. I was just hoping that there might be a simple h/w method of doing roughly what I was after - as has been pointed out by myself and others, though the FFT approach would almost certainly work for a general case, it's processor-intensive, and not (in this instance) ideal. This is not a production system, it's something I'm hacking around with in the workshop.

I appreciate the "steering in the right direction" as I did need that

- I now have some ideas to take forward.

Cheers

On a sunny day (Fri, 5 Dec 2008 09:42:19 -0800 (PST)) it happened snipped-for-privacy@hotmail.com wrote in :

fFt in FPGA, as you want hardware?

You are nothing more than a liar and a coward. Go crawl back into your hole, little one.

Roger Blake (Subtract 10s for email. "Google Groups" messages killfiled due to spam.)

"Roger Blake the Slimy Fake "

** Got a nice big brain tumor growing in that pointy head of yours ?

Hope it kills you - real soon

- pal.

A weakling as well, I see. Liar, coward, weakling. Quite an array of personal characteristics you have there. Pal.

Roger Blake (Subtract 10s for email. "Google Groups" messages killfiled due to spam.)

OK, here are the details. I *thought* this all sounded a bit familiar: Turns out it was a strategy I used in an ignition system for GM back in the mid-70s called ESS (Electronic Spark Selection, see US patent 4,077,372). The basic idea in that was to produce a variable phase delay (spark delay in degrees relative to Top Dead Center), but the same concept would apply here.

When you detect a cycle start, you start charging a capacitor with a current proportional to the desired phase delay (duty cycle here). This can be done via an op-amp integrator with a variable input voltage, but I find it easier to visualize this with charging capacitors.

The capacitor charges until it reaches a certain fixed threshold, at which time the charging current is switched off and a fixed discharge current is switched on. It discharges until the start of the next cycle, at which point the system switches back to charge. (Use a flip-flop.)

At longer cycle times, the discharge portion will go down to a lower voltage before the next cycle starts, which means the charge phase will take longer to reach the fixed threshold. The waveform will be a large sawtooth extending below the threshold voltage toward zero (which it must never reach... adjust values for different ranges). At shorter cycle times the sawtooth shrinks upward toward the threshold. Eventually it gets too small to detect reliably, which sets the upper limit on frequency.

Worked great in old Cadillacs, as a cheap-and-dirty alternative to fully computerized ignition. Got about 90% of the fuel economy benefits, at 10% of the cost. But it didn't get used much (Eldorados only, I think, for just one or two years) before computers took over.

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!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required