[Tutor] Can I have some assistance understanding the wave module

Nathan Smith nathan-tech at hotmail.com
Tue Oct 11 13:28:59 EDT 2022


Hello,


As ever Alan, spot on the mark, and thank you Mats, too, for your help.


Both proved invaluable, I admit I'd read the wave write part of the wave 
module multiple times, but did not read the wave read bit because, well, 
I didn't need to read! Hence I missed the explanations and such.


Seems to be working now, time to wrestle with ffmepg! Joys.


Thanks all

Nathan

On 10/10/2022 19:08, Alan Gauld via Tutor wrote:
> On 10/10/2022 17:03, Nathan Smith wrote:
>
>> So I am trying to work with the wave module, with the end goal of taking
>> raw data from an audio CD and writing it to a Wav file.
> Caveat: I have no experience with the wave module I just
> read the docs....
>
>
>> file.setsampwidth: What actually is this? It seems to except a number
>> between 1 and 4, but 4 produces a file that is 46 seconds long off disc
>> (but only 24 on disc).
> The docs say the number is the sample size in bytes. So a 4 means you
> are writing 4 byte = 32 bit samples. Maybe the original file was using
> 16 bit?
>
>> To that end, is this related to bit depth? Audio CD's are recorded at an
>> sr of 44100, and a bit depth of 16, but this being the case, can python'
>> s wave module not handle this?
> Based on the documentation you would need a samplesize of 2.
> Documentation is really useful. :-)
>
-- 

Best Wishes,

Nathan Smith, BSC


My Website: https://nathantech.net




More information about the Tutor mailing list