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

Mats Wichmann mats at wichmann.us
Mon Oct 10 13:47:15 EDT 2022


On 10/10/22 10:03, Nathan Smith wrote:
> Hello,
> 
> 
> 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.
> 
> To do this I was looking at the wave module (it's there, so surely it's 
> the answer) but::
> 
> 
> 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).
> 
> 
> 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?

sample width and bit depth are the same thing, consistent terminology is 
not something we get...  that's in bytes, so you'd want a value of 2 for 
16-bit.

does that help?

beyond that we'll have to wait for someone who's actually fluent in 
audio stuff.

> In that instance, if I want to write the raw data in 16 bit format so it 
> actually plays, how would I begin to look into such a venture?
> 
> 
> Thanks
> 
> Nathan
> 



More information about the Tutor mailing list