     [file version.texinfo not included]

this file documents the quelcom tools: a set of commands to handle .wav and .mp3 files.

permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

     [file version.texinfo not included]

this file documents the quelcom tools vVERSION: a set of command line tools to handle .wav and .mp3 files.

     [file gpl.texinfo not included]

introduction
************

quelcom tools is a set of command line tools to manipulate .wav and .mp3 files.

with these tools you can do a set of operations (get info, join, cut, delete fragments, detect silence, check, fade, ...) on maybe the most popular sound file formats (wave and mpeg layer 3) without the need of a grafical interface (xwindow) nor these or those grafical libraries.

since they are build as command line apps, they can be easily included in scripts to do automatically some job.

the quelcom tools package is written by david manyé and you may find the package sources in http://www.etse.urv.es/~dmanye/quelcom/quelcom.html.

installation
************

requirements
============

the quelcom tools package is being developed on an old intel p133 with suse linux 6.3. other configurations may work also.

a c++ compiler is needed. currently are used gcc-2.95.2 and egcs-2.91.66. you can get the compiler name and version issuing the command gcc --version.

and of course, you also need que quelcom tools package. you may find it at http://www.etse.urv.es/~dmanye/quelcom/quelcom.html. using the latest available version is recommended.

configuring and building
========================

 1. unpack the package with the command tar xzf quelcom-VERSION.tar.gz. this creates a directory named quelcom-VERSION and expands there all the files.

 2. get into the directory with cd quelcom-VERSION

 3. if you want, you can take a look at the makefiles. then type make to build the sources. some compiler messages may appear, but it should compile successfully.

 4. once the package is successfully build, you can proceed to install it with make install.

     by default, the executables are installed under /usr/local/bin, the libraries under /usr/local/lib, the translation .mo files under /usr/local/share/locale and the info manual file under /usr/local/info.

to activate the automatic translation to catalan or to spanish (the only languages supported at this moment), it should be enough (if there haven't been no problem until now), setting the environment variable LANG this way (with bash shell): export LANG=ca or export LANG=es respectively. otherwise, the messages will appear in english.

problems
========

if you have problems configuring or building the package, or if you find a bug in any of the tools, please update to the latest release. if the problem remains, please send electronic mail to dmanye@etse.urv.es including the version number and a detailed description of the problem.

wav tools
*********

tests has been done only with 44100 Hz 16 bit stereo files, though it may work with mono/stereo 8/16 bits files.

the tools to handle wav files are the following:

qwavcut
=======

qwavcut extracts and/or deletes parts of a wav file

synopsis
--------

qwavcut OPTION... FILE

description
-----------

qwavcut allows to extract and/or delete a fragment of a wav file. some parameters must be supplied in order to define the start/size/end cut points and what to do then: either the fragment must be copied to another file or erased from the file (or both)

general options
---------------

-d
--delete
     deletes the fragment from the file. if option --delete is used, deletion is always done after fragment extraction.

-h
--help
     show a brief help and exit.

-o OUTFILE
--output=OUTFILE
     OUTFILE is the name of the file where all the samples in the given fragment will be copied.

-V
--version
     show version and exit.

cut options
-----------

cut options are used to specify where the fragment begins and ends. there are two ways to do it: with time slices (easier) and with cut points (more complex but also more powerful). cut options are mandatory (which way is used is matter of your choice).

if time slices are used, cut points options are automatically ignored.

cut with time slices
....................

there is only one option:

-S TIMESLICE
--slice TIMESLICE
     TIMESLICE (see specifying time) specifies, in terms of time, where the cut begins and ends.

cut with cut points
...................

there are several options with cut points. cut points are used to specify at which sample the fragment begins (--begin and --Begin), ends (--end and --End), or which size it has (--size). at least, one cut option must be specified (non specified options take its default values). neither the options --begin and --Begin, and the options --end and --End can be used together; also, a begin, end and size option cannot be used at the same time.

by default, the fragment begins at the first sample and ends at the last sample; there's no default value for size.

-b CUTPOINT
--set-begin-from-eof=CUTPOINT
     CUTPOINT (see cut points) specifies the first sample of the file that belongs to the cut counting from the end of the file.

-B CUTPOINT
--set-begin=CUTPOINT
     CUTPOINT (see cut points) specifies the first sample of the file that belongs to the cut counting from the beginning of the file.

-e CUTPOINT
--set-end-from-eof=CUTPOINT
     CUTPOINT (see cut points) specifies the last sample of the file that belongs to the cut counting from the end of the file.

-E CUTPOINT
--set-end=CUTPOINT
     CUTPOINT (see cut points) specifies the last sample of the file that belongs to the cut counting from the beginning of the file.

-s CUTPOINT
--size=CUTPOINT
     CUTPOINT (see cut points) specifies the number of samples contained in the cut.

examples
--------

 1. to get the last ten seconds of a file

          qwavcut -b 10s -o outfile.wav infile.wav

 2. four different ways to get the first minute of a file:

          qwavcut -S -1:0 -o outfile.wav infile.wav
          qwavcut -S -60 -o outfile.wav infile.wav
          qwavcut -E 1m -o outfile.wav infile.wav
          qwavcut -s 1m -o outfile.wav infile.wav

 3. four ways of getting the second quarter of a file:

          qwavcut -S 15:0-30:0 -o outfile.wav infile.wav
          qwavcut -B 15m -E 30m -o outfile.wav infile.wav
          qwavcut -s 15m -E 30m -o outfile.wav infile.wav
          qwavcut -B 15m -s 15m -o outfile.wav infile.wav

qwavfade
========

qwavfade fade in/out wav files

synopsis
--------

qwavfade OPTION... FILE...

description
-----------

qwavfade modifies a wav file applying on it a fade in or a fade out or both.

a fade consists in modifying progressively the level of the wav as if you were slowly increasing or decreasing the volume. a fade in consists in increasing the volume starting from a low level at the beginning of the wav. a fade out consists in decreasing the volume to a low level at the end of the wav.

option list
-----------

-d CUTPOINT
--duration=CUTPOINT
     CUTPOINT (see cut points) specifies the duration of the fade. the default value is five seconds. this option overrides the --length option explained below.

-h
--help
     show a brief help and exit.

-i
--in
     just fade in. don't fade out. by default, fade in and fade out.

-l TIME
--length=TIME
     TIME (see specifying time) specifies the length(=duration) of the fade. this option is quite similar to the --duration option above. it's easier to use though not as powerful than the previous one. the default value is five seconds. this option overrides --duration option explained above.

-o
--out
     just fade out. don't fade in. by default, fade in and fade out.

-t
--test
     this option can be used to create and fade test files instead of modifying the original file. a test file will be created for each type of selected fade (in or out). the name of the test file will be fadein.FILE or fadeout.FILE. the duration of the test files is the fade duration plus five seconds.

-v
--verbose
     show more detailed info.

-V
--version
     show version and exit.

example
-------

suppose you want to fade in and out the fantastic song live.in.concert.wav using a fade duration of 3.5 seconds:

first we are going to test:

     qwavfade --test --length 3.5 live.in.concert.wav

hear the test fades:

     my-wav-player fadein.live.in.concert.wav fadeout.live.in.concert.wav

if you want to try with another duration, jump to the first step and change the length(or --duration) argument.

if you're happy with the tests (omit --test):

     qwavfade --length 3.5 live.in.concert.wav

notes
-----

qwavfade doesn't allow both types of fades (in and out) to overlap. if you want to fade in and out a wav file, and the two regions to fade overlap, then probably you made a mistake (maybe you selected a too large fade). in any case, you'll have to fade separately.

qwavheaderdump
==============

qwavheaderdump dumps (and fixes) wav headers

synopsis
--------

qwavheaderdump OPTION... FILE...

description
-----------

qwavheaderdump reads a list of wav files and prints on standard output all its header values in text (no binary) form. also, it has ability to fix some of the headers in case they'd be incorrect.

option list
-----------

-F
--fix
     correct the header if there's any incorrect value. not all the fields are recoverable.

-h
--help
     show a brief help and exit.

-q
--quiet
     no output messages. don't show detected (and corrected) errors.

-V
--version
     show version and exit.

qwavinfo
========

qwavinfo show info from wav files.

synopsis
--------

qwavinfo OPTION... FILE...

description
-----------

qwavinfo reads a list of wav files and prints on standard output some of its parameters: sample rate, bits per sample, mono/stereo and duration. a duration summary is appended at the end of the list.

option list
-----------

-h
--help
     show a brief help and exit.

-s
--summary-only
     show only the summary. do not show info from every file.

-v
--verbose
     show also the number of bytes and samples.

-V
--version
     show version and exit.

qwavjoin
========

qwavjoin joins wav files

synopsis
--------

qwavjoin OPTION... FILE1 FILE2...

description
-----------

qwavjoin reads a list of wav files and joins them in the specified order in one wav file. the files must have the same parameters (i.e. sampling rate, bytes per sample, ...) in order that the joining can be done.

option list
-----------

-h
--help
     show a brief help and exit.

-o OUTFILE
--output=OUTFILE
     OUTFILE is the name of the file where all the samples will be copied. if this option is not used, the samples from the second to the last file of the list will be appended to FILE1.

-v
--verbose
     show which operations are done.

-V
--version
     show version and exit.

qwavsilence
===========

qwavsilence detects and shrinks silence sequences in wav files

synopsis
--------

qwavsilence OPTION... FILE...

description
-----------

qwavsilence reads a list of wav files looking for silence sequences longer than a given value, possibly shrinking them.

option list
-----------

-d CUTPOINT
--duration=CUTPOINT
     CUTPOINT (see cut points) specifies the minimum duration of a silent sequence in a file to be reported. the default value is one second. this option overrides the option --length explained below.

-h
--help
     show a brief help and exit.

-l TIME
--length=TIME
     TIME (see specifying time) specifies the minimum length(=duration) of a silent sequence in a file to be reported. this option is quite similar to the --duration option above. it's easier to use though not as powerful than the previous one. the default value is one second. this option overrides the --duration option explained above.

-S
--shrink
     when this option is set, all the silent sequences greater than the value of the --duration option will be shrinked down to DURATION and the file size truncated accordingly.

-t THRESHOLD
--threshold=THRESHOLD
     THRESHOLD is a percentage value respect the maximum (absolute) sample value. samples whose value is under the given THRESHOLD are considered silent. for example, a value of 2 means that all samples with absolute value under the 2% will be treated as silent samples. the default value is 0.

-v
--verbose
     show also sample information.

-V
--version
     show version and exit.

mp3 tools
*********

tests have been done only with mpeg version 1 layer iii streams, though it may (or not) work with other versions or layers.

the tools to handle mp3 files are the following:

qmp3check
=========

qmp3check checks and cleans mp3 streams

synopsis
--------

qmp3check OPTION... FILE...

description
-----------

qmp3check reads mp3 streams looking for invalid frames or, simply, garbage. it can be used as a mp3 file checker but also as a mp3 file cleaner because it is able to strip garbage bits from the streams.

option list
-----------

-D
--delete
     delete invalid frames and garbage. use with care

-h
--help
     show a brief help and exit.

-q
--quiet
     no output messages

-T
--delete-tag
     delete tag (if exists). option --delete must be set.

-v
--verbose
     show more detailed info

-V
--version
     show version and exit.

qmp3cut
=======

qmp3cut extracts and/or deletes parts of a mp3 file

synopsis
--------

qmp3cut OPTION... FILE

description
-----------

qmp3cut allows to extract and/or delete a fragment of a mp3 file. some parameters must be supplied in order to define the start/size/end cut points and what to do then: either the fragment must be copied to another file or erased from the file (or both)

general options
---------------

-d
--delete
     deletes the fragment from the file. if option --output is used, deletion is always done after fragment extraction.

-h
--help
     show a brief help and exit.

-o OUTFILE
--output=OUTFILE
     OUTFILE is the name of the file where all the frames in the given fragment will be copied.

-v
--verbose
     verbose

-V
--version
     show version and exit.

cut options
-----------

cut options are used to specify where the fragment begins and ends. there are two ways to do it: with time slices (easier) and with cut points (more complex but also more powerful). cut options are mandatory (which way is used is matter of your choice).

if time slices are used, cut points options are automatically ignored.

cut with time slices
....................

there is only one option:

-S TIMESLICE
--slice TIMESLICE
     TIMESLICE (see specifying time) specifies, in terms of time, where the cut begins and ends.

cut with cut points
...................

there are several options with cut points. cut points are used to specify at which frame the fragment begins (--begin and --Begin), ends (--end and --End), or which size it has (--size). at least, one cut option must be specified (non specified options take its default values). neither the options --begin and --Begin, and the options --end and --End can be used together; also, a begin, end and size option cannot be used at the same time.

by default, the fragment begins at the first frame and ends at the last frame; there's no default value for size.

-b CUTPOINT
--set-begin-from-eof=CUTPOINT
     CUTPOINT (see cut points) specifies the first frame of the file that belongs to the cut counting from the end of the file.

-B CUTPOINT
--set-begin=CUTPOINT
     CUTPOINT (see cut points) specifies the first frame of the file that belongs to the cut counting from the beginning of the file.

-e CUTPOINT
--set-end-from-eof=CUTPOINT
     CUTPOINT (see cut points) specifies the last frame of the file that belongs to the cut counting from the end of the file.

-E CUTPOINT
--set-end=CUTPOINT
     CUTPOINT (see cut points) specifies the last frame of the file that belongs to the cut counting from the beginning of the file.

-s CUTPOINT
--size=CUTPOINT
     CUTPOINT (see cut points) specifies the number of frames contained in the cut.

examples
--------

 1. to get the last ten seconds of a file

          qmp3cut -b 10s -o outfile.mp3 infile.mp3

 2. four different ways to get the first minute of a file:

          qmp3cut -S -1:0 -o outfile.mp3 infile.mp3
          qmp3cut -S -60 -o outfile.mp3 infile.mp3
          qmp3cut -E 1m -o outfile.mp3 infile.mp3
          qmp3cut -s 1m -o outfile.mp3 infile.mp3

 3. four ways of getting the second quarter of a file:

          qmp3cut -S 15:0-30:0 -o outfile.mp3 infile.mp3
          qmp3cut -B 15m -E 30m -o outfile.mp3 infile.mp3
          qmp3cut -s 15m -E 30m -o outfile.mp3 infile.mp3
          qmp3cut -B 15m -s 15m -o outfile.mp3 infile.mp3

qmp3info
========

qmp3info show info from mp3 files.

synopsis
--------

qmp3info OPTION... FILE...

description
-----------

qmp3info reads a list of mp3 files and prints on standard output some of its parameters: version, layer, sample rate, bit rate, duration and tag. a duration summary is appended at the end of the list.

option list
-----------

-c
--check
     check the entire stream (slower but accurate). all the frames of the stream are read and the total duration is exactly computed. this option is automatically activated if the stream appears to be vbr (have different bit rate frames).

-h
--help
     show a brief help and exit.

-s
--summary-only
     show only the summary. do not show info from every file.

-v
--verbose
     show also the number of bytes and frames.

-V
--version
     show version and exit.

bugs
----

variable bit rate (vbr) streams are detected by reading the initial 5 frames in the stream. if their bit rate field differs, the --check option is activated automatically. if vbr is not detected, qmp3info reads only the first frame in the stream and calculates the duration supposing that (1) the entire stream is composed by valid frames and (2) all the frames have the same bit rate. this is a fast way to compute the duration of the stream, but it is not exact: there's an error of 0.3% aprox. if you want to be accurate, or qmp3info is unable to detect a vbr stream, use --check.

qmp3join
========

qmp3join joins mp3 files

synopsis
--------

qmp3join OPTION... FILE1 FILE2...

description
-----------

qmp3join reads a list of mp3 files and joins them in one mp3 file in the specified order. some conditions must be met for the parameters of each of the files (see the notes subsection below).

option list
-----------

-f
--force
     force join bypassing bit rate checks. by default, to join two files they must be both vbr (have variable bit rate) or have the same bit rate. using this option you can skip this check.

-h
--help
     show a brief help and exit.

-o OUTFILE
--output=OUTFILE
     OUTFILE is the name of the file where all the frames will be copied. if this option is not used, the frames from the second to the last file of the list will be appended to FILE1.

-v
--verbose
     show which operations are done.

-V
--version
     show version and exit.

notes
-----

both mp3 must have the same bit rate or (both) must have a variable bit rate. this restriction can be by-passed with the --force flag.

before joining, all the streams are tested for validity. this is a time consuming operation. if the streams are not found clean, the join operation is aborted, so if you want to join dirty streams or simply qmp3join detects a clean stream as dirty, please report this as a bug and/or use cat.

due to the mp3 file format characteristics, qmp3join can be viewed like a better but restrictive cat for mp3 files.

qmp3report
==========

qmp3report reports mp3 files and directories

synopsis
--------

qmp3report OPTION... FILE...

description
-----------

qmp3report reads mp3 files or directories containing mp3 files and gives information about them. qmp3report can output the reports with plain text or in html format. using the latter format, you can navigate your mp3 directories with a web browser.

option list
-----------

-a
--all-files
     report all files, not just files with suffix .mp3.

-A
--show-all
     implies --dirs, --files and --summary. show report for files and directories and a summary report.

-d
--dirs
     show a report for every directory containing reported files/directories. note that if option --all-files is not set, only will be reported those directories containing mp3 files.

-f
--files
     show a report for every reportable file (see also --all-files).

-h
--help
     show a brief help and exit.

-H
--html
     output in html format (default is plain text).

-r
--recursive
     scan directories.

-s
--summary
     show a summary report.

-S
--split
     split report across visited directories. qmp3report leaves in each visited directory a file with the report for that directory, independently of the output format. the name of the report file is the name of the directory with extension .txt or .html depending on the selected output format.

-v
--verbose
     show more detailed info.

-V
--version
     show version and exit.

bugs
----

variable bit rate (vbr) streams are detected by reading the initial 5 frames in the stream. if their bit rate field differs, the entire stream is read to compute the duration time with accuracy (see qmp3info).

if vbr is not detected, qmp3report reads only the first frame in the stream and calculates the duration supposing that (1) the entire stream is composed by valid frames and (2) all the frames have the same bit rate. this is a fast way to compute the duration of the stream, but it is not exact: there's an error of 0.3% aprox.

the htmlize function, which converts file names in a suitable form for html format (ie. replacing blanks with '%20'), is not bulletproof.

cut points
**********

cut points are used to specify point in a sound file. they can also be used to speciy a size or a time duration using the beginning of the file as start reference. a cut point has the following form:

VALUE[FORMAT]

in all cases, a positive integer VALUE is required. the wav tools treat this number as a number of samples, whereas the mp3 tools treat this number as a number of frames. since most of the times is hard to specify a point (or size, or duration) in a file in terms of samples or frames, some modifiers are accepted. these modifiers consist in a single letter that must be written behind the number without leaving any blank.

cut points modifiers
====================

these are the valid modifiers and how they modify the interpretation of VALUE:

j
     milliseconds

s
     seconds

m
     minutes

b
     bytes

k
     kbytes (1024 bytes)

M
     megabytes (1024 kbytes)

in either case, the given values will be rounded to an integer number of samples/frames.

specifying time
***************

time specifiers are a easier (more human) way than cut options to specify points in a file.

a time specifier has the following form:

[[H:]M:]S[.MS]

where:

H
     hours

M
     minutes

S
     seconds

MS
     milliseconds

as you can see, time specifiers are easier to use but less powerful than cut options (which can also specify a point in a file in terms of bytes or frames/samples).

time slices
===========

time slices are composed by two time specifiers designing a range (slice) of time:

BEGIN-END

where BEGIN and END are time specifiers. they can be not specified, meaning, respectively, the beginning and the end of the file.