Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Size of *.wav on disk 'v' on cd

by ron.savage (Novice)
on Nov 26, 2011 at 08:12 UTC ( #940165=perlquestion: print w/ replies, xml ) Need Help??
ron.savage has asked for the wisdom of the Perl Monks concerning the following question:

Hi Folks What's with *.wav files on an audio cd? Each one is almost exactly 4 times the size on disk. I created the audio cd with audacity, but files with real names on disk are called 'Track $N.wav' on cd. Is there a formula I can use to convert the on-cd size to the on-disk size, so as to work out exactly which files of my 1938 are on each cd? TIA. Ron

Comment on Size of *.wav on disk 'v' on cd
Re: Size of *.wav on disk 'v' on cd
by CountZero (Bishop) on Nov 26, 2011 at 08:25 UTC
    From the Wikipedia article:
    Audio CDs
    Audio CDs do not use WAV as their sound format, using instead Red Book audio. The commonality is that both audio CDs and WAV files have the audio data encoded in PCM. WAV is a data file format for a computer to use that cannot be understood by CD players directly. To record WAV files to an Audio CD the file headers must be stripped and the remaining PCM data written directly to the disc as individual tracks with zero-padding added to match the CD's sector size. In order for a WAV file to be able to be burned to a CD with most burners it should be in the 44100 Hz, 16-bit stereo format.
    So there are no WAV files on your CD, but whether that warrants a 1-in-4 difference in size I do not know.

    Perhaps there are more appropriate forums to ask this question, which does not really has much Perl content?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      The commonality is that both audio CDs and WAV files have the audio data encoded in PCM.

      That's wrong. WAV is a just container format (like .avi). The actual audio encoding is not dictated. It could just as easily be MP3 as PCM. That said, it's almost always PCM in my experience.

        Hi Folks $many x $thanx to all who replied. I understand the problem better now. And yes, Perl will be used to help me clean up the recordings... As for which format to record in, the real question is which formats can my playback devices handle? We'll see. Cheers Ron
Re: Size of *.wav on disk 'v' on cd
by Anonymous Monk on Nov 26, 2011 at 08:39 UTC

    Hi Folks What's with *.wav files on an audio cd? Each one is almost exactly 4 times the size on disk. I created the audio cd with audacity, but files with real names on disk are called 'Track $N.wav' on cd. Is there a formula I can use to convert the on-cd size to the on-disk size, so as to work out exactly which files of my 1938 are on each cd? TIA. Ron

    This all from memory (dang accurate)

    Music CDs, aka "red book" format, don't have WAV files, and yes, the track sizes are ~three times bigger , but they overlap --- built-in-raid-like-scratch-resistance

    So if your cd-reader/file-explorer shows you wav files, you must remember there are no wav files , and this is a bug in the cd-reader/file-explorer, its not accounting for the red-book format

    If it is possible to account for red-book, if there is a formula, the CD FAQ would have it

    Anyway, why not create images/.iso?

    Or why not use http://cdexos.sourceforge.net/ since it will rip/convert, and tag your files with data from CDDB (and name them using CDDB data), just like Audio::CD - Perl interface to libcdaudio (cd + cddb)

    I'm not sure, but cdexos may also know how to get cddb data and rename your wave files, in case you already copied all your disks (eeek), and the files are grouped by disk

      I seem to remember somewhere that CD sound-files were designed to be “bigger,” so that if the player happens to encounter a bum track, it can skip to the next one and play it, instead, without you noticing.   So, the format deliberately uses a “big, fat, long” waveform instead of a “tight, compact, space-efficient” one.   This lets manufacturers use “factory seconds” for publication instead of throwing them away.   (To this day, you see CD-R factory seconds being sold as “music” CDs.   Every now and then, misinformed people – my mother, for instance – will use them for backups.   Oops...)

Re: Size of *.wav on disk 'v' on cd
by Khen1950fx (Canon) on Nov 26, 2011 at 18:25 UTC
    Instead of thinking in terms of on-cd size, I would concentrate on determining the total time in seconds and then get the total number of minutes involved. An audio cd can only record a certain number of minutes, (somewhere between 70+ to 84?). I tried getting the metadata and seconds using Audio::Scan and Audio::Wav::Read.
    #!/usr/bin/perl -l use strict; use Audio::Wav; use Audio::Scan; use Data::Dumper::Concise; my $file = '/root/Desktop/explode.wav'; my $info = Audio::Scan->scan_info( $file ); print Dumper( $info ); my $wav = new Audio::Wav; my $read = $wav->read( $file ); my $audio_seconds = $read->length_seconds(); print "Total number of seconds: ", Dumper( $audio_seconds );

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://940165]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2014-09-02 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (20 votes), past polls