Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!agate!eos!phil From: phil@eos.UUCP (Phil Stone) Newsgroups: comp.sys.amiga Subject: Re: Sampling at 29KHz (long) Message-ID: <734@eos.UUCP> Date: 18 May 88 22:08:55 GMT References: <2845@polya.STANFORD.EDU> Reply-To: phil@eos.UUCP (Phil Stone) Organization: NASA Ames Research Center, Calif. Lines: 59 In article <2845@polya.STANFORD.EDU> rokicki@polya.STANFORD.EDU (Tomas G. Rokicki) writes: > > Why Sampling At 29K Is Usually Sufficient > >.....Lecture on sampling theory omitted..... > > If you undersample such a waveform, aliasing will cause >some strange effects. Let us say our sampling rate that we are >undersampling at is m (samples per second.) According to Nyquist, >our sampling rate should be at least twice the frequency of the >highest component sine wave. Any components that have a >frequency greater than 2/m will have some portion of their energy >aliased or mirrored down to a lower frequency. > >.....7 paragraphs on the evils of undersampling omitted..... Obviously, one should not try to play frequencies higher than the Nyquist frequency; this is what you so laboriously illustrate. Your examples are not very realistic, however. Let's take a simple sine-wave synthesis instead (not the most realistic scenario either, but so simple as to be an example of what an audio driver *should* be able to handle). Compute a 256-point sine wave and put it in memory (32-byte sine waves don't cut it in my book - even a tin ear can hear the interpolation noise in fixed, jagged steps that big). With a fixed sample-playback increment and a maximum rate of 29 KHz, the highest frequency you can generate is 29000/256 = 113 Hz! - just about TWO OCTAVES below A440(!) With this same sine wave and a variable (intergral.fractional) sampling increment, one could generate a maximum frequency of 14 KHz! Now, I realize that more complex waveforms will alias at this frequency, but at more reasonable, musical frequencies, say 1 KHz, fairly complex waveforms can be easily generated with no Nyquist aliasing, and without the need to spin-off shorter tables just to get higher frequencies. My point is, it is the combination of a relatively low sampling rate *and* a simple increment method that makes the sound driver so inconvenient to use. Fix one or the other if you want a high quality and flexible sound device (I'd pick the increment as the easier to fix, though I don't appreciate the subtleties of the Amiga's DMA). Also, I'm all for multi-sampling, if what you are trying to do is *re-create* a musical instrument. Not everyone is using the Amiga as a sampler, though. I enjoy playing with its synthesis capabilities, and wouldn't mind if one waveform of say, 256 bytes, could be used over five octaves - not a tall order. I used to be able to do *that* with a 6502. Your postscript tosses off a reference to *making* the other octaves of sound - this is called interpolation, a process which has earned many Ph.D's over the last ten years. Try interpolating 4 octaves from one sample *live* sometime (can you say "Cray killer?") > Any further comments? Yes. Why is it that articles that start out with "I really don't know much about this but..." always turn out to be the longest ones? :-) Phil Stone (I still love the Amiga sound driver) phil@eos.arc.nasa.gov phil@eos.UUCP { uunet, hplabs, hao, ihnp4, decwrl, allegra, tektronix } ames!eos!phil