[Tutor] Python + Sound
Corey Richardson
kb1pkl at aim.com
Sat Feb 12 08:56:43 CET 2011
On 02/12/2011 02:27 AM, Steven D'Aprano wrote:
> Corey Richardson wrote:
>> Hello Tutors,
>>
>> I'm working on a small script that compresses a file, sends it through
>> the telephone, and then receives and decompresses the file on the other
>> end. The compression is the easy part. The transmission is the hard
>> part. If anyone has worked with sound before, what do you recommend?
>
> [snip of excellent help and advice]
>
> http://en.wikipedia.org/wiki/TCP/IP_model
> http://www.howstuffworks.com/modem.htm
> http://en.wikipedia.org/wiki/Modem
>
> and this may entertain, and help:
> http://www.joelonsoftware.com/articles/LeakyAbstractions.html
>
Always been a fan of Joel's articles.
>
> Of course this can be done -- otherwise we wouldn't have the Internet!
> But my guess is that doing this in pure Python will be so slow it will
> be almost faster for you to copy the file onto a USB stick and
> hand-deliver it to the other end. But if you insist...
Well, I'm still on my way to learning other languages, Java (which I
hate) and soon I begin my voyage onwards into C. I figure once I get
something working in a tool I know how to use well, I'll be able to get
it done in a tool that I /don't/ know as well.
>
> * Your compressed file is a bunch of bytes. You need to come up with
> a scheme for encoding that to sound. This needs to be reversible
> and designed to work on low-fidelity systems (phone networks).
> The obvious way is to have one tone represent a one-bit, and another
> *very different* tone represent a two-bit. See also "frequency
> modulation" and "amplitude modulation".
>
> * Because of noise on the line, you need a scheme for error correction.
> Google for "Error correcting codes" for more information.
>
> * The sender and receiver need a way to notify each other that they
> are ready to start transmitting data. This is called a handshake.
> Otherwise, you risk losing data from the ends of the transmission.
>
> You described this as "a small script" -- it might be so far, but by the
> time you finish it will be huge.
>
>> I don't really want to use the wave module because it looks like too
>> much work.
>
> Pardon me while I chortle :)
Merely one aspect of a larger whole that I expected to be much more
complex - I didn't want to spend all my time working on sound encoding.
I think I have much more realistic view on it now.
Thank you _so much_ for the help. I truly appreciate it, you've given me
much more perspective, and I'll need to consider carefully my next
steps. Probably quite a bit of time at the drawing board!
More information about the Tutor
mailing list