A simple-to-use sound file writer
Alf P. Steinbach
alfps at start.no
Thu Jan 14 11:14:45 EST 2010
* Steve Holden:
> 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.
Bullshit.
Cheers,
- Alf
More information about the Python-list
mailing list