SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

rip -- Extract Wave Files from Audio CDs

The rip module allows you to extract audio tracks from an IDE CD-ROM drive to save to your hard drive in Wave file format. It is based on [1]DAGRAB, a package written by Marcello Urbani.

Currently rip is only expected to run on Linux/Unix. It has been tested on FreeBSD and Debian Linux.

The module defines the following items:

track_info([device])

          device is the path to a Unix file-like device containing the
          CD-ROM. The default is /dev/cdrom.

          Returns a 2-tuple containing information about the tracks on
          the CD-ROM, of the form ( numtracks, [audio_track1,
          audio_track2, ... audio_trackX] ) . The second variable in the
          tuple is a list of integers with each integer representing the
          track number of a valid audio track.

rip(track[, device[, path [, mode[, options[, callback[, call_every

          ]]]]]])
          Rip track number track from device.

          As with track_info, device defaults to /dev/cdrom.

          path is the path to the resulting wave file. It defaults to
          ./track<track_num>.wav.

          The file at path will be chmod to mode, which defaults to 0644
          unless specified otherwise.

          See the section below for options.

          callback is a python function that will be called each time
          call_every percent (default 5) of the track has been read and
          extracted. rip expects that callback will return non-zero if it
          should continue to extract the current track, and zero if it
          should terminate.

          Making use of callback is recommended, even if only to return
          1. rip will not process KeyboardInterrupt exceptions while in
          C, so taking advantage of this function call is an easy way to
          allow keyboard TERM signals to affect program execution.

options is a dictionary that specifies a number of performance options that are analogous to their DAGRAB counterparts. Consequently, the descriptions below are lifted right from the program man page.

The key constants, which can be found in rip are:

O_OVERLAP -- overlap sets the number of sectors which are used for jitter correction. Shouldn't be too high or you will get "jumps" in your dump. The default value is 3.

O_SECTORS -- number of sectors to be read per request from the cdrom driver.

O_KEY_LENGTH -- key length is the number of keys which must be equal for a match in jitter correction. Default value is 12.

O_RETRIES -- sets the number of times to reread sectors before a jitter error is given. Default is 40 times.

O_OFFSET -- sets the maximum offset to search for jitter correction. Default is 12.

As per the original DAGRAB code, rip will adjust these variables if unusual or impractical extremes are provided by the programmer.

Example

import rip

def go_on():

return 1

# rip track 3 from /dev/acd1c, to fileout3.wav, # -rw-rw-r--, call go_on each 5 percent rip.rip(3,"/dev/acd1c","fileout3.wav",0664,callback=go_on)

# rip track 7 from /dev/cdrom1, with some options rip.rip(7,"/dev/cdrom1",options={

                        rip.O_RETRIES    :  42,
                        rip.O_KEY_LENGTH :   9,
                        rip.O_OVERLAP    :   4,
                        })

# rip all of /dev/cdrom
trackinfo = rip.track_info()
for track in trackinfo[1]:

rip.rip(track)

References

  1. http://web.tiscali.it/marcellou/dagrab.html


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.