Need ideas for variable sampling rates.

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
Mr. K
Posts: 37
Joined: Sat Sep 06, 2003 1:01 am
Location: Rustbelt, USA
Contact:

Need ideas for variable sampling rates.

Post by Mr. K »

I need help figuring out how to sample sound at a low to moderate sampling rate.<p> I've been talking with the kids in my MultiMedia Applications class about the relationship between sampling rates and digitized sound quality. Though I draw a pretty sine wave on the board and show them how faster sampling rates yield a closer approximation to the source signal, they still aren't fully appreciating it. Too cerebral. Need a hands-on demo.<p> I thought I'd feed a signal from my function generator into my sound card and make a collection of files, but this isn't working out. The software that I have only offers a couple of sampling rates, and they're all pretty high. What I need is to be able to sample really slowly so that the resulting sound is horribly raunchy. (Nothin' like a good square wave coming out thru big speakers!) We'll then pick up the sampling rate in maybe a dozen steps and listen as the quality improves.<p> Can anyone point me in the direction of inexpensive software and/or devices that will let me construct this demo? Better yet, has anybody already done this? I'd like to keep it cheap, since the cost is on me. My construction skills rate as a solid "fair".<p> All thoughts appreciated. Thanks in advance!
In theory, there's no difference between theory and practice. In practice, there is.
russlk
Posts: 563
Joined: Thu Dec 06, 2001 1:01 am
Location: New Hampshire
Contact:

Re: Need ideas for variable sampling rates.

Post by russlk »

I don't know enough about software to help there, but I did design a circuit which is posted here: http://www.poptronics.com/forums/electr ... s/956.html
Mr. K
Posts: 37
Joined: Sat Sep 06, 2003 1:01 am
Location: Rustbelt, USA
Contact:

Re: Need ideas for variable sampling rates.

Post by Mr. K »

Thanks for the reply and the diagram. If I understand correctly, this would be a "real time" demo. Twist R2 and the sound goes from ugly to pretty. Right? The only "unknown" would be the actual sampling rate, but I could stick a 'scope on lead 3 of the 555 so they could see the rate pick up or drop as R2 changed. I suppose a freq counter would be better, but I don't have one. Anyway, I think that exact numbers are unimportant as long as they can see the sample rate change and hear what's happening. <p> Thanks again!
In theory, there's no difference between theory and practice. In practice, there is.
cato
Posts: 366
Joined: Sun Sep 07, 2003 1:01 am
Contact:

Re: Need ideas for variable sampling rates.

Post by cato »

I think you will need at least 3 scope channels to be really convincing, one each for the input sine wave, the sample pulse and the output signal.<p>Keep in mind, that according to Nyquist, you only need a bit more than 2 samples per cycle to reconstruct a sine wave. Therefore, you may have to turn the sample rate WAY down, before the kids notice a problem. (For example, each channel on a CD is sampled at 44Khz. The rule of thumb is, the highest frequency humans can here is 20Khz)<p>I would also think you could draw a pretty convicing diagram on the board. If you sample twice per cycle on the zero crossing and draw a line that connects the dots, the sampled signal looks like a straight line. If you shift the phase of the sampling just a bit, you get a you get a low amplitude triangle wave..... <p>Of course, if you sample at a lower frequency, you get aliasing, a shift in the apparent frequency of the signal.....<p>Google on --Nyquist Rate-- for more info.<p>[ October 25, 2003: Message edited by: cato ]<p>[ October 25, 2003: Message edited by: cato ]<p>[ October 25, 2003: Message edited by: cato ]</p>
Mr. K
Posts: 37
Joined: Sat Sep 06, 2003 1:01 am
Location: Rustbelt, USA
Contact:

Re: Need ideas for variable sampling rates.

Post by Mr. K »

Thanks for the thoughts! I've done the connect-the-dots thing. Some kids get it, some don't. Maybe I need to rethink my presentation.<p> Re 3 traces: I've got an old Tek 549, so there's two traces. Maybe I'll have to get out to the flea markets for that freq counter.<p> Thanks also for "Nyquist". I'd forgotten the name of that theory. If I can get the sampler circuit built, maybe I'll play with the choice of R2 so that it's less sensitive to adjustment and the highest frequency rate is still very modest. <p> Appreciate the help!
In theory, there's no difference between theory and practice. In practice, there is.
rshayes
Posts: 1286
Joined: Tue Mar 04, 2003 1:01 am
Contact:

Re: Need ideas for variable sampling rates.

Post by rshayes »

A Tektronix 549 can display four traces with either an Type M or a Type 1A4 plug in. These may show up at surplus stores or on eBay.<p>The "Nyquist Frequency" is one-half the sampling rate. After sampling, a signal at the Nyquist frequency can not be distinguished from a DC level. Spectral components in the original signal above the Nyquist frequency are folded back to lower frequencies as part of the sampling process and appear as lower frequency components in the reconstructed signal. This means that the original signal must be low pass filtered to remove components above the Nyquist frequency before being sampled. Since most filters do not fall off very rapidly, the cutoff frequency may have to be one-half of the Nyquist frequency or even lower.<p>The output side also requires a filter to remove high frequency ripple at the sampling frequency. This filter may also need to cut off at a fraction of the Nyquist frequency in order to have adequate ripple attenuation.
Mr. K
Posts: 37
Joined: Sat Sep 06, 2003 1:01 am
Location: Rustbelt, USA
Contact:

Re: Need ideas for variable sampling rates.

Post by Mr. K »

Thanks for the tips on the 4-trace plugins. I'll add those to my "wish list".<p>I appreciate the further discussion on signal sampling and understand the points. What I'm wondering now is how much I need to worry about pre-filtering higher freqs and post-filtering for ripple. I'm dealing with high school kids, and one of the points that I want to clearly make is that while you need sufficient sampling to get acceptable quality, "more" isn't always better. I see this issue all the time in the form of a 4/5/6 megapixel picture that the kid wants to drop into a PowerPoint slide or into their web site project. My current hope is to illustrate that sound sampling needs to be decently fast, but "excessive" sampling just gives us big files with no meaningful improvement in the result. If my demo has a barely preceptible distortion, I don't think it'll matter. Obvious distortion will (obviously). Guess I'll just have to smoke-test this one.<p>Thanks for all the help.
In theory, there's no difference between theory and practice. In practice, there is.
hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: Need ideas for variable sampling rates.

Post by hlreed »

To clarify wave forms for your students you might consider using a saw tooth wave which can be generated by simply counting by digit. Here is a base 4 saw tooth for example.
0 1 2 3 0 1 2 3 0 1 2 4 0 ... The counting rate and the number base determine the frequency and amplitude respectively. So you can impose this on any sine wave.
When I think of a wave, this is what I think of.<p>[ October 27, 2003: Message edited by: Harold ]</p>
Harold L. Reed
Microbes got brains
Mr. K
Posts: 37
Joined: Sat Sep 06, 2003 1:01 am
Location: Rustbelt, USA
Contact:

Re: Need ideas for variable sampling rates.

Post by Mr. K »

Cool. Thanks! I can think of a number of ways to employ that approach to defuse the math/graphing phobias that some of these kids have.
In theory, there's no difference between theory and practice. In practice, there is.
Post Reply

Who is online

Users browsing this forum: No registered users and 93 guests