Files
librubberband/README.md

185 lines
7.9 KiB
Markdown
Raw Normal View History

# Rubber Band Library
An audio time-stretching and pitch-shifting library and utility program.
2012-09-09 16:57:42 +01:00
Written by Chris Cannam, chris.cannam@breakfastquay.com.
Published by Particular Programs Ltd t/a Breakfast Quay.
2024-03-07 15:19:37 +00:00
Copyright 2007-2024 Particular Programs Ltd.
2012-09-09 16:57:42 +01:00
Rubber Band is a library and utility program that permits changing the
tempo and pitch of an audio recording independently of one another.
2020-02-14 11:33:48 +00:00
* About Rubber Band: https://breakfastquay.com/rubberband/
2020-02-14 11:33:08 +00:00
* Code repository: https://hg.sr.ht/~breakfastquay/rubberband
2020-09-11 17:11:21 +01:00
* Github mirror: https://github.com/breakfastquay/rubberband
CI builds:
* [![Build status](https://builds.sr.ht/~breakfastquay/rubberband.svg)](https://builds.sr.ht/~breakfastquay/rubberband?) (Linux)
* [![Build Status](https://github.com/breakfastquay/rubberband/workflows/macOS%20and%20iOS%20CI/badge.svg)](https://github.com/breakfastquay/rubberband/actions?query=workflow%3A%22macOS+and+iOS+CI%22) (macOS, iOS)
2024-03-07 14:26:13 +00:00
* [![Build Status](https://github.com/breakfastquay/rubberband/workflows/Windows%20CI/badge.svg)](https://github.com/breakfastquay/rubberband/actions?query=workflow%3A%22Windows+CI%22) (Windows)
2020-09-15 08:32:07 +01:00
## Licence
Rubber Band Library is distributed under the GNU General Public
License (GPL). You can redistribute it and/or modify it under the
terms of the GPL; either version 2 of the License, or (at your option)
any later version. See the file COPYING for more information.
If you wish to distribute code using Rubber Band Library under terms
other than those of the GNU General Public License, you must obtain a
commercial licence from us before doing so. In particular, you may not
legally distribute through any Apple App Store unless you have a
commercial licence. See https://breakfastquay.com/rubberband/ for
licence terms.
2012-09-09 16:57:42 +01:00
If you have obtained a valid commercial licence, your licence
supersedes this README and the enclosed COPYING file and you may
redistribute and/or modify Rubber Band under the terms described in
that licence. Please refer to your licence agreement for more details.
Rubber Band includes a .NET interface generously contributed by
Jonathan Gilbert under a BSD-like licence. The files in the
2022-01-20 08:31:54 +00:00
`dotnet/rubberband-dll` and `dotnet/rubberband-sharp` directories fall
2021-02-11 14:15:38 +00:00
under this licence. If you make use of this interface, please ensure
you comply with the terms of its licence.
Rubber Band may link with other libraries or be compiled with other
source code, depending on its build configuration. It is your
responsibility to ensure that you redistribute these only in
accordance with their own licence terms, regardless of the conditions
under which you are redistributing the Rubber Band code itself. The
licences for some relevant library code are as follows, to the best of
2022-06-30 12:07:39 +01:00
our knowledge. See also the file [COMPILING.md](COMPILING.md) for more
details.
2024-07-18 16:35:26 +01:00
* FFTW3 - GPL with commercial proprietary option
* Intel IPP - Proprietary of some nature
* SLEEF - BSD-like
* KissFFT - BSD-like
* libsamplerate - BSD-like from version 0.1.9 onwards
* Speex - BSD-like
* Pommier math functions - BSD-like
## Compiling Rubber Band Library
2022-06-30 12:07:39 +01:00
Please refer to the file [COMPILING.md](COMPILING.md) for details of
how to configure and build the library.
## Contents of this README
2012-09-09 16:57:42 +01:00
1. Code components
2. Using the Rubber Band command-line tool
3. Using Rubber Band Library
## 1. Code components
2012-09-09 16:57:42 +01:00
Rubber Band consists of:
2020-01-13 08:57:04 +00:00
* The Rubber Band Library code. This is the code that will normally
2012-09-09 16:57:42 +01:00
be used by your applications. The headers for this are in the
2021-10-14 13:48:15 +01:00
`rubberband/` directory, and the source code is in `src/`.
2021-04-08 15:57:10 +01:00
The Rubber Band Library may also depend upon external resampler
and FFT code, if so configured; see section 7 of COMPILING.md for
details.
2021-10-14 13:48:15 +01:00
* The Rubber Band command-line tool. This is in `main/main.cpp`.
This program uses Rubber Band Library and also requires libsndfile
2012-09-09 16:57:42 +01:00
(http://www.mega-nerd.com/libsndfile/, licensed under the GNU Lesser
General Public License) for audio file loading.
2022-01-07 13:58:09 +00:00
* A pitch-shifter audio effects plugin in LADSPA and LV2 formats.
These are in `ladspa-lv2/`. They require the LADSPA SDK header
`ladspa.h` and LV2 header `lv2.h` respectively (not included).
2012-09-09 16:57:42 +01:00
* A Vamp audio analysis plugin which may be used to inspect the
dynamic stretch ratios and other decisions taken by the Rubber Band
2021-10-14 13:48:15 +01:00
Library when in use. This is in `vamp/`. It requires the Vamp
2020-02-14 11:33:08 +00:00
plugin SDK (https://www.vamp-plugins.org/develop.html) (not included).
## 2. Using the Rubber Band command-line tool
The Rubber Band command-line tool builds as `build/rubberband`. The
2022-01-12 10:26:10 +00:00
basic incantation is
2021-03-08 10:14:05 +00:00
```
$ rubberband -t <timeratio> -p <semitones> <infile.wav> <outfile.wav>
2021-03-08 10:14:05 +00:00
```
2012-09-09 16:57:42 +01:00
For example,
2021-03-08 10:14:05 +00:00
```
2012-09-09 16:57:42 +01:00
$ rubberband -t 1.5 -p 2.0 test.wav output.wav
2021-03-08 10:14:05 +00:00
```
2022-01-12 10:26:10 +00:00
stretches the file `test.wav` to 50% longer than its original
duration, shifts it up in pitch by a whole tone, and writes the output
2022-01-12 10:26:10 +00:00
to `output.wav`.
2021-10-14 13:48:15 +01:00
Several further options are available: run `rubberband -h` for help.
2022-06-28 14:07:05 +01:00
The most important are the options `-2` and `-3`. These select between
two different processing engines, known as the R2 (Faster) engine and
the R3 (Finer) engine. The R3 engine produces higher-quality results
than R2 for most material, especially complex mixes, vocals and other
sounds that have soft onsets and smooth pitch changes, and music with
substantial bass content. However, it uses much more CPU than the R2
engine.
The R2 engine was the only method available in Rubber Band Library up
to versions 2.x, and for compatibility it remains the default (in the
case that neither `-2` nor `-3` is requested explicitly) whenever the
command-line tool is invoked as `rubberband`. The R3 engine is the
default if the tool is invoked as `rubberband-r3`.
Many further options are available, most of which only have an effect
when using the R2 engine. In particular, different types of music may
benefit from different "crispness" options (`-c` flag, with a
numerical argument from 0 to 6).
## 3. Using Rubber Band Library
Rubber Band has a public API that consists of one C++ class, called
`RubberBandStretcher` in the `RubberBand` namespace. You should
`#include <rubberband/RubberBandStretcher.h>` to use this class.
There is extensive documentation in the class header.
2012-09-09 16:57:42 +01:00
A header with C language bindings is also provided in
2019-08-30 11:24:07 +01:00
`<rubberband/rubberband-c.h>`. This is a wrapper around the C++
2012-09-09 16:57:42 +01:00
implementation, and as the implementation is the same, it also
requires linkage against the C++ standard libraries. It is not yet
documented separately from the C++ header. You should include only
one of the two headers, not both.
A .NET interface is also included, contributed by Jonathan Gilbert;
2021-03-05 11:31:11 +00:00
see the files in the `dotnet` directory for details.
2019-08-30 11:24:07 +01:00
The source code for the command-line utility (`main/main.cpp`)
provides a good example of how to use Rubber Band in offline mode; the
2022-01-07 13:58:09 +00:00
pitch shifter plugin (`ladspa-lv2/RubberBandPitchShifter.cpp`) may be
used as an example of Rubber Band in real-time mode.
2022-06-30 12:14:01 +01:00
**IMPORTANT:** Please ensure you have read and understood the
licensing terms for Rubber Band before using it in your application.
This library is provided under the GNU General Public License, which
means that any application that uses it must also be published under
the GPL or a compatible licence (i.e. with its full source code also
available for modification and redistribution) unless you have
separately acquired a commercial licence from the author.
2022-06-30 12:14:01 +01:00
## 4. Further documentation
* The [API documentation](https://breakfastquay.com/rubberband/code-doc/index.html) is thorough and we encourage you to read it
* [Conceptual notes and examples](https://breakfastquay.com/rubberband/integration.html) for integration into an application
* [Help text](https://breakfastquay.com/rubberband/usage.txt) of the command-line application
* [Rubber Band Library home page](https://breakfastquay.com/rubberband/)