- license: : what you can do with quelcom

- introduction: : introductory information.
- installation: : installation instructions
- wav tools: : tools to manipulate wav files
- mp3 tools: : tools to manipulate mp3 files

- cut points: : how to specify points in files
- specifying time: : how to specify time in arguments

[ Next:introduction | Previous:Top | Up:Top ]

# GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

    Copyright © 1989, 1991 Free Software Foundation, Inc.
    675 Mass Ave, Cambridge, MA 02139, USA

    Everyone is permitted to copy and distribute verbatim copies
    of this license document, but changing it is not allowed.

## Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow.

1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

   Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

2. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

   You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

3. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
   1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
   2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
   3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

   These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

   Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

   In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

4. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
   1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
   2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
   3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

   The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

   If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

5. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
6. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
7. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
8. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

   If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

   It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

   This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

9. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
10. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

11. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

## How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

    one line to give the program's name and an idea of what it does.
    Copyright (C) 19yy  name of author

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
    type `show w'.  This is free software, and you are welcome
    to redistribute it under certain conditions; type `show c'
    for details.

The hypothetical commands `show w` and `show c` should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w` and `show c`; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

    Yoyodyne, Inc., hereby disclaims all copyright
    interest in the program `Gnomovision'
    (which makes passes at compilers) written
    by James Hacker.

    signature of Ty Coon, 1 April 1989
    Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.

[ Next:installation | Previous:license | Up:Top ]

# 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.

[ Next:requirements | Previous:introduction | Up:Top ]

# installation

- requirements: :
- configuring building and installing: :
- problems: :

[ Next:configuring building and installing | Previous:installation | Up: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.

[ Next:problems | Previous:requirements | Up:installation ]

## configuring and building

1. unpack the package with the command `tar xzf quelcom-0.4.0.tar.gz`. this creates a directory named `quelcom-0.4.0` and expands there all the files.
2. get into the directory with `cd quelcom-0.4.0`
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.

[ Next:wav tools | Previous:configuring building and installing | Up:installation ]

## 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.

[ Next:qwavcut | Previous:problems | Up:Top ]

# 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: : extract and/or delete parts of a wav file.
- qwavfade: : fade in/out wav files.
- qwavheaderdump: : dump (and fix) wav headers.
- qwavinfo: : show info from wav files.
- qwavjoin: : join multiple wav files in one.
- qwavsilence: : detect and shrink silence sequences in wav files.

[ Next:qwavfade | Previous:wav tools | Up:wav tools ]

## 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

[ Next:qwavheaderdump | Previous:qwavcut | Up:wav tools ]

## 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.

[ Next:qwavinfo | Previous:qwavfade | Up:wav tools ]

## 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.

[ Next:qwavjoin | Previous:qwavheaderdump | Up:wav tools ]

## 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.

[ Next:qwavsilence | Previous:qwavinfo | Up:wav tools ]

## 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.

[ Next:mp3 tools | Previous:qwavjoin | Up:wav tools ]

## 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.

[ Next:qmp3check | Previous:qwavsilence | Up:Top ]

# 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: : check and clean mp3 files.
- qmp3cut: : extract and/or delete fragments from a mp3 file.
- qmp3info: : show info from mp3 files.
- qmp3join: : join multiple mp3 files in one.
- qmp3report: : generate simple reports for mp3 files and directories

[ Next:qmp3cut | Previous:mp3 tools | Up:mp3 tools ]

## 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.

[ Next:qmp3info | Previous:qmp3check | Up:mp3 tools ]

## 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

[ Next:qmp3join | Previous:qmp3cut | Up:mp3 tools ]

## 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`.

[ Next:qmp3report | Previous:qmp3info | Up:mp3 tools ]

## 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.

[ Next:cut points | Previous:qmp3join | Up:mp3 tools ]

## 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.

[ Next:specifying time | Previous:qmp3report | Up:Top ]

# 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.

[ Previous:cut points | Up:Top ]

# 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.