tosha(1)

NAME
tosha - read CD digital audio and video data via SCSI

SYNOPSIS
tosha [ -i | -q | -v | -h | -V | -r ] [ -d dev ] [ -f fmt ] [ -t tracklist ] [ -s sector ] [ -e sector ] [ -o outfile ] [ -k rate ] [ -b sectors ]

DESCRIPTION
tosha reads one or more CD-DA (digital audio) tracks or absolute sectors and writes them into a single or multiple files, or to the standard output. VideoCD tracks (digital video) are supported, too. The digital audio / video data is read through the SCSI/ATAPI bus; thus tosha does not work with proprietary interfaces.

OPTIONS
tosha options may be either the traditional POSIX one letter options, or the GNU style long options. POSIX style options start with a single ``-'', while GNU long options start with ``--''.

-i, --index
    Display the track index (table of contents) of the CD and exit. No audio data is read. If you use -iq, the index is printed in a more compact format which is suitable for parsing by shell scripts etc. Note that the index is written to stderr.

-q, --quiet
    Quiet operation, i.e. no informational output except for error messages.

-v, --verbose
    Verbose operation. Display additional information while reading audio data (how many percent done, and how long the remaining data will approximately take to read). Specify -vv to make it even more verbose.

-h, --help
    Print a short help text and exit.

-V, --version
    Print version information and exit.

-r, --reset
    Reset the CD-ROM drive (set default sector size and density) and exit. This is sometimes useful if you interrupt tosha by pressing Ctrl-C or by killing it, which might leave the CD-ROM drive in a state of being unable to mount regular data CD-ROMs. In such a case, just running ``tosha -r'' should help.

-d dev, --device dev
    Specify the CD-ROM device to use. The default is /dev/cd0c. If you have two drives and you want to read from the second one, use /dev/cd1c. If you want to read from a CD writer, use /dev/rworm0.ctl.

-f fmt, --format fmt
    Specify the output audio format. The default is pcm. Currently supported formats: ``pcm'' or ``raw'' (headerless little-endian), ``mcp'' or ``war'' (headerless big-endian), ``aiff'' (IFF audio format, used on the Amiga and by certain semi-professional software), ``wav'' (RIFF/WAV format commonly used by Microsoft products), ``au'' (AU format used by Sun workstations). The audio data is always stored in 16bit stereo 44.1kHz. If you need a different format, you can use sox(1) to convert it.

    The -f option is ignored when reading VideoCD tracks.

-t tracklist, --track tracklist
    Specify which track(s) to read. This can be a single track number, a range (from-to), multiple track numbers separated by commas, or a combination thereof. Tracks which don't exist on the CD are ignored. The default is to read all tracks in sequence (1-100).

-s sector, --start sector
    Specify the start sector. You must also use the -e option to specify the end sector. The -t option is ignored when sector addresses are used. Only one output file is created.

-e sector, --end sector
    Specify the end sector (inclusive). See the -s option above.

-o outfile, --output outfile
    Specify the output file name, which is used to store the audio data. If the name is a single dash ``-'', audio data is written to the standard output. If the name contains the character sequence ``%s'', it is substituted by an extension appropriate for the file file format (for example, if the output is in WAV format, ``%s'' will be replaced by ``wav'').

    If the name contains a percent sign ``%'' (not followed by an ``s''), it is interpreted as a formatting sequence for an integer value (according to sprintf(3)) which will be substituted by the current track number, so that every track will be written to its own file. Example:

    -o track%d.raw -t 1-3

    creates the files track1.raw, track2.raw, and track3.raw.

    If the name does not contain a percent sign, all tracks are written into the same output file, one after another.

-k rate, --kbps rate
    Specify the desired mp3 bitrate (in kbits/s) for MPEG audio encoding (the default is 128 kbits/s). This is not essential for tosha to operate correctly, but it helps in estimating the file size if you're going to MPEG encode the audio data. If you're not planning to MPEG encode it, this number is meaningless. It's also meaningless for VideoCD tracks.

-b sectors, --buffer sectors
    WARNING: This is a ``wizard option'' -- do not use it unless you know exactly what you're doing. This option specifies the size of the read buffer (in CD DA sectors), and thus it specifies the number of sectors that can be read at once (with a single drive access). The default is 10, which should work reasonably well with most drives. The maximum is 26 (my drive doesn't support more, probably because no more than 26 sectors with subchannel data fit into 64 Kb of memory).

SEE ALSO
pcmplay(1), pcmfade(1), sox(1), intro(1), sprintf(3)

DEVICE PERMISSIONS
In order to be able to access the CD-ROM drive with tosha, make sure that you have sufficient permission to access the appropriate device entries in the /dev directory (you need read and write access to the device). For the ``classic'' SCSI system, this is usually /dev/cd0c. For the new CAM SCSI system (FreeBSD 3.0), you need access to the pass and xpt devices (please refer to the manual pages pass(4) and xpt(4)).

The easiest way, of course, is to run tosha as root, thus not having to worry about permissions. However, this is not recommended.

A much cleaner approach would be to create a group for the users who are allowed to access the CD-ROM drive (or use an existing group such as ``operator''). Add those users to that group by editing the /etc/group file (note that modifications to that file will take effect the next time you log in), see the manual page group(5). Use chgrp(1) to give the appropriate devices to that group, then use chmod(1) to give read/write permission to that group. For example:

    chgrp operator /dev/cd0c
    chmod g+rw /dev/cd0c

VIDEOCD SUPPORT
The first track on VideoCDs usually contains a small ISO filesystem, containing information for CD-i players etc. The actual video tracks (one or more) start at track 2.

tosha detects if the track is an audio track or a VideoCD data track, and it automatically uses the appropriate access method for the drive. However, do not try to read normal CD-ROM data tracks with tosha. Doing so might result in SCSI errors.

The VideoCD data (as read by tosha) is basically an MPEG system stream with additional information (sync, timecode etc.). In order to play it on the screen, you'll need an MPEG player that is aware of this format (a plain MPEG player won't work). For example, you can use ``mpegtv'' (see http://www.mpegtv.com/).

NOTES
Not all SCSI drives work with tosha, and only some are really tested and proven to work. See the WWW page (section AUTHOR) for a list of drives which are know to work (or not to work).

The name ``tosha'' has historical reasons: The very first version only worked with the author's Toshiba drive.

There is currently no ``jitter correction'' performed. Frankly, I think that it shouldn't be necessary with most modern CD-ROM drives, so I didn't bother to implement it. Besides, I don't have drives to test it with -- all of my drives work perfectly well without jitter correction.

BUGS
Probably.

AUTHOR
Copyright (C) 1997-1999 Oliver Fromme <olli@fromme.com>
All rights reserved. For more information, please refer to the file LICENCE which is included with the source distribution.

Internet references:
http://www.fromme.com/tosha/