A simple-to-use sound file writer

Alf P. Steinbach alfps at start.no
Thu Jan 14 13:42:48 EST 2010


* Steve Holden:
> Alf P. Steinbach wrote:
>> * Steve Holden:
>>> Grant Edwards wrote:
>>>> On 2010-01-14, Alf P. Steinbach <alfps at start.no> wrote:
>>> [bogus hand-waving]
>>>>> 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.
>> Just for the record: Grant has seen that representation numerous times,
>> he just didn't recognize it.
>>
>>
>>>  Can you provide any references?
>>> Of course he can't.  And it isn't the basis of analog quantization.
>> Of course it isn't the basis of quantization: it *is* quantization,
>> directly.
>>
> Nope, quantization is taking the *instantaneous value* of a waveform and
> using that as the representation for one sample period. That is nowhere
> near the same as summing periodic square waves.

There are two three things wrong with that paragraph. First, quantization can 
not physically be instantaneous. So it's pretty much moot to try to restrict it 
to that.

Second, for the mathematical exercise you can let the measurement be an 
instantaneous value, that is, the value at a single point.

Third, the result of quantization is a sequence of values, each value present 
for an interval of time, and the same is obtained by summing square waves.

I'm beginning to believe that you maybe didn't grok that simple procedure.

It's very very very trivial, so maybe you were looking for something more 
intricate  --  they used to say, in the old days, "hold on, this proof goes by 
so fast you may not notice it!"


>> Which is the basis of digital representation.
>>
> Well at least we agree that quantization is the basis of digital
> representations. But I've never seen any summed square wave presentation
> of it.

Well, I'm glad to be able to teach something.

Here's the MAIN IDEA in the earlier procedure: a square wave plus same wave 
offset (phase) and negated, produces a set of more rectangular waveforms, which 
I called "bars"  --  in between the bars the two square waves cancel each other:

          _
         | |
         | |
   ______| |______   ______
                  | |
                  | |
                  |_|

The bars alternate in positive and negative direction. They can be made as 
narrow as you wish, and when they are as narrow as each sample interval then 
each bar can represent the sample value residing in that interval. Even a sample 
corresponding to a point measurement (if such were physically possible).

And samples are all that's required for representing the sine. And happily the 
alternation of upgoing and downgoing bars is matched by an identical alternation 
of the sine wave. :-) Otherwise it would be a tad difficult to do this.

But then, representing sines is all that's required for representing any wave 
form, since any wave form can be decomposed into sines.


>>> And I suspect Alf has never hear of Shannon's theorem.
>> It's about 30 years since I did that stuff.
>>
> Well me too, but information theory is, after all, the theoretical
> underpinning for the way I make my living, so I felt obliged to study it
> fairly thoroughly.
>>> But don't listen to me, apparently I'm full of it.
>> You're spouting innuendo and personal attacks, repeatedly, so that seems
>> to be the case, yes. :-)
>>
> Nothing personal about it. I'm just asking you to corroborate statements
> you have made which, in my ignorance, I consider to be bogus hand-waving.

OK.

May I then suggest going through the procedure I presented and *draw* the square 
waves.

I dunno, but maybe that can help.


> Nothing about you there. Just the information you are promoting. I don't
> normally deal in innuendo and personal attacks. Though I do occasionally
> get irritated by what I perceive to be hogwash. People who know me will
> tell you, if I am wrong I will happily admit it.

There's a difference between an algorithm that you can implement, and hogwash.


Cheers,

- Alf



More information about the Python-list mailing list