A simple-to-use sound file writer
Grant Edwards
invalid at invalid.invalid
Thu Jan 14 11:40:41 EST 2010
On 2010-01-14, Alf P. Steinbach <alfps at start.no> wrote:
>> It's not clear to me that you can approximate any waveform
>> with a suitable combination of square waves,
>
> Oh. It's simple to prove. At least conceptually! :-)
[...]
> With the goal of just a rough approximation you can go about
> it like this:
>
> 1. Divide a full cycle of the sine wave into n intervals.
> With sine wave frequency f this corresponds to n*f
> sample rate for digital representation.
>
> 2. Each interval will be approximated by a rectangular bar
> extending up to or down to the sine wave. As it happens
> this (the bar's height) is the sample value in a digital
> representation.
>
> 3. In the first half of the cycle, for each bar create that
> bar as a square wave of frequency f, amplitude half the
> bar's height, and phase starting at the bar's left, plus
> same square wave with negative sign (inverted amplitude)
> and phase starting at the bar's right. And voil?, not
> only this bar generated but also the corresponding
> other-way bar in second half of cycle.
>
> 4. Sum all the square waves from step 3.
>
> 5. Let n go to infinity for utter perfectness! :-)
>
> And likewise for any other waveform.
>
> After all, it's the basis of digital representation of sound!
Huh? I've only studied basic DSP, but I've never heard/seen
that as the basis of digital represention of sound. I've also
never seen that representation used anywhere. Can you provide
any references?
--
Grant Edwards grante Yow! CHUBBY CHECKER just
at had a CHICKEN SANDWICH in
visi.com downtown DULUTH!
More information about the Python-list
mailing list