A simple-to-use sound file writer
Steve Holden
steve at holdenweb.com
Thu Jan 14 11:07:07 EST 2010
Alf P. Steinbach wrote:
> * Steve Holden:
[...]
> 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!
>
>
I'm sorry, but this is merely hand-waving. It looks appealing, but
there's no rigor there.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
More information about the Python-list
mailing list