Skip to content

Commit b5ba3d1

Browse files
committed
docs: update documentation for master
0 parents  commit b5ba3d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+27622
-0
lines changed

.nojekyll

Whitespace-only changes.

_sources/citation.rst.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Citation
2+
=======
3+
4+
.. mdinclude:: ../../README.md
5+
:start-line: 289
6+
:end-line: 306

_sources/compatibility.rst.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Plugin Compatibility
2+
====================
3+
4+
``pedalboard`` allows loading VST3® and Audio Unit plugins, which could contain *any* code.
5+
Most plugins that have been tested work just fine with ``pedalboard``, but some plugins may
6+
not work with ``pedalboard``; at worst, some may even crash the Python interpreter without
7+
warning and with no ability to catch the error.
8+
9+
Most audio plugins are "well-behaved" and conform to a set of conventions for how audio
10+
plugins are supposed to work, but many do not conform to the VST3® or Audio Unit
11+
specifications. ``pedalboard`` attempts to detect some common programming errors in plugins
12+
and can work around many issues, including automatically detecting plugins that don't
13+
clear their internal state when asked. Even so, plugins can misbehave without ``pedalboard``
14+
noticing.
15+
16+
If audio is being rendered incorrectly or if audio is "leaking" from one ``process()`` call
17+
to the next in an undesired fashion, try:
18+
19+
1. Passing silence to the plugin in between calls to ``process()``, to ensure that any
20+
reverb tails or other internal state has time to fade to silence
21+
2. Reloading the plugin every time audio is processed (with ``pedalboard.load_plugin``)

_sources/examples.rst.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Examples
2+
========
3+
4+
.. mdinclude:: ../../README.md
5+
:start-line: 75
6+
:end-line: 284

_sources/faq.rst.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Frequently Asked Questions
2+
--------------------------
3+
4+
Can Pedalboard be used with live (real-time) audio?
5+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
As of version 0.7.0, yes! See the :class:`pedalboard.io.AudioStream` class for more details.
8+
9+
10+
Does Pedalboard support changing a plugin's parameters over time?
11+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
Yes! While there's no built-in function for this, it is possible to
14+
vary the parameters of a plugin over time manually:
15+
16+
.. code-block:: python
17+
18+
from pedalboard.io import AudioFile
19+
from pedalboard import Pedalboard, Compressor, Reverb
20+
from tqdm import tqdm
21+
22+
board = Pedalboard([Compressor(), Reverb()])
23+
reverb = board[1]
24+
25+
# Smaller step sizes would give a smoother transition,
26+
# at the expense of processing speed
27+
step_size_in_samples = 100
28+
29+
# Manually step through the audio _n_ samples at a time, reading in chunks:
30+
with AudioFile("sample.wav") as af:
31+
32+
# Open the output audio file so that we can directly write audio as we process, saving memory:
33+
with AudioFile(
34+
"sample-processed-output.wav", "w", af.samplerate, num_channels=af.num_channels
35+
) as o:
36+
37+
# Create a progress bar to show processing speed in real-time:
38+
with tqdm(total=af.frames, unit=' samples') as pbar:
39+
for i in range(0, af.frames, step_size_in_samples):
40+
chunk = af.read(step_size_in_samples)
41+
42+
# Set the reverb's "wet" parameter to be equal to the
43+
# percentage through the track (i.e.: make a ramp from 0% to 100%)
44+
percentage_through_track = i / af.frames
45+
reverb.wet_level = percentage_through_track
46+
47+
# Update our progress bar with the number of samples received:
48+
pbar.update(chunk.shape[1])
49+
50+
# Process this chunk of audio, setting `reset` to `False`
51+
# to ensure that reverb tails aren't cut off
52+
output = board.process(chunk, af.samplerate, reset=False)
53+
o.write(output)
54+
55+
With this technique, it's possible to automate any parameter. Usually, using a step size of somewhere between 100 and 1,000 (2ms to 22ms at a 44.1kHz sample rate) is small enough to avoid hearing any audio artifacts, but big enough to avoid slowing down the code dramatically.
56+
57+
Can Pedalboard be used with VST instruments, instead of effects?
58+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59+
60+
As of version 0.7.4, yes! See the :class:`pedalboard.VST3Plugin` and :class:`pedalboard.AudioUnitPlugin` classed for more details.
61+
62+
Can Pedalboard plugins accept MIDI?
63+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64+
65+
As of version 0.7.4, both :class:`pedalboard.VST3Plugin` and :class:`pedalboard.AudioUnitPlugin` support passing MIDI
66+
messages to instrument plugins for audio rendering. However, effect plugins cannot yet be passed MIDI data.

_sources/index.rst.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:og:title: Pedalboard Documentation
2+
:og:description: 🎛 🔊 Documentation for Pedalboard: A Python library for working with audio.
3+
4+
.. mdinclude:: ../../README.md
5+
:end-line: 74
6+
7+
Reference
8+
---------
9+
10+
.. toctree::
11+
:maxdepth: 1
12+
13+
API Reference (Audio Plugins) <reference/pedalboard>
14+
API Reference (Audio I/O) <reference/pedalboard.io>
15+
16+
17+
Documentation
18+
-------------
19+
20+
.. toctree::
21+
examples
22+
faq
23+
compatibility
24+
internals
25+
license
26+
GitHub Repo <http://github.com/spotify/pedalboard>

_sources/internals.rst.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Pedalboard Internals
2+
====================
3+
4+
Pedalboard is a Python wrapper around JUCE, an open-source cross-platform C++ library for developing audio applications.
5+
Most of Pedalboard is written in C++ using pybind11, a library for binding C++ code to Python. The design goals of
6+
Pedalboard are to:
7+
8+
- Expose the digital signal processing functionality of JUCE to Python code in an idiomatic way
9+
- Provide the raw speed and performance of JUCE's DSP code to Python
10+
- Hide the complexity of JUCE's C++ interface and show programmers an intuitive API
11+
12+
13+
Adding new built-in Pedalboard plugins
14+
--------------------------------------
15+
16+
Pedalboard supports loading VST3® and Audio Unit plugins, but it can also be useful to add new plugins to Pedalboard itself, for a variety of reasons:
17+
18+
- **Wider compatibility**: Not all plugins are supported on every platform. (Notably, VST3® plugins that support Linux are rare.)
19+
- **Fewer dependencies**: ``import pedalboard`` is simpler than ``pedalboard.load_plugin(...)``, and removes the need to copy around plugin files and any associated resources.
20+
- **More options**: Available plugins might not include all of the required options; for instance, plugins meant for musical use may not include the appropriate options to be used for machine learning use cases, or vice versa.
21+
- **Stability**: Some VST3® or Audio Unit plugins might have compatibility issues with Pedalboard or in environments where Pedalboard is used. Implementing the same effect within Pedalboard itself ensures that the logic is portable, well tested, thread-safe, and performant.
22+
23+
24+
Design considerations
25+
^^^^^^^^^^^^^^^^^^^^^
26+
27+
When adding a new Pedalboard effect plugin, the following constraints should be considered:
28+
29+
- **Licensing**: is the code that implements the new effect compatible with the GPLv3 license used for Pedalboard? Can it be statically linked?
30+
- **Vendorability**: will the code have to be added to Pedalboard's repository, or can it be included as a Git submodule?
31+
- **Binary Size**: Pedalboard is distributed as a binary wheel. Will the new code required (or any required resources) increase the binary size by a considerable amount?
32+
- **Platform Compatibility**: Does the new effect's code compile on macOS, Windows, and Linux?
33+
- **Dependencies**: Does the new code require any runtime dependencies that cannot be included in the Pedalboard binary? Requiring users to install additional files or have additional software installed, for example, would complicate the "just `import pedalboard`" simplicity of the package.

_sources/license.rst.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
License
2+
=======
3+
4+
.. mdinclude:: ../../README.md
5+
:start-line: 307
6+
:end-line: 319
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
The ``pedalboard.io`` API
2+
=========================
3+
4+
This module provides classes and functions for reading and writing audio files or streams.
5+
6+
.. note::
7+
For audio effects, see the :py:mod:`pedalboard` module.
8+
9+
:py:mod:`pedalboard.io` allows for reading and writing to audio files
10+
just like working with other types of files in Python. Audio encoding
11+
and decoding is handled automatically behind the scenes in C++, providing
12+
high quality, high performance, thread-safe access to audio files.
13+
14+
The goal of :py:mod:`pedalboard.io` is to direct access to audio like
15+
a regular file in Python::
16+
17+
from pedalboard.io import AudioFile
18+
19+
with AudioFile("my_filename.mp3") as f:
20+
print(f.duration) # => 30.0
21+
print(f.samplerate) # => 44100
22+
print(f.num_channels) # => 2
23+
print(f.read(f.samplerate * 10))
24+
# => returns a NumPy array of shape (2, 441_000):
25+
# [[ 0. 0. 0. ... -0. -0. -0.]
26+
# [ 0. 0. 0. ... -0. -0. -0.]]
27+
28+
.. note::
29+
The :class:`pedalboard.io.AudioFile` class should be all that's necessary for most use cases.
30+
31+
- Writing to a file can be accomplished by passing ``"w"`` as a second argument, just like with regular files in Python.
32+
- Changing the sample rate of a file can be accomplished by calling :py:meth:`pedalboard.io.ReadableAudioFile.resampled_to`.
33+
34+
If you find yourself importing :class:`pedalboard.io.ReadableAudioFile`,
35+
:class:`pedalboard.io.WriteableAudioFile`, or :class:`pedalboard.io.ResampledReadableAudioFile` directly,
36+
you *probably don't need to do that* - :class:`pedalboard.io.AudioFile` has you covered.
37+
38+
The following documentation lists all of the available I/O classes.
39+
40+
41+
.. automodule:: pedalboard.io
42+
:members:
43+
:imported-members:
44+
:special-members: __enter__, __exit__
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
The ``pedalboard`` API
2+
======================
3+
4+
This module provides classes and functions for adding effects to audio.
5+
Most classes in this module are subclasses of :class:`Plugin`, each of
6+
which allows applying effects to an audio buffer or stream.
7+
8+
.. note::
9+
For audio I/O functionality (i.e.: reading and writing audio files), see
10+
the :py:mod:`pedalboard.io` module.
11+
12+
The :py:mod:`pedalboard` module is named after
13+
`the concept of a guitar pedalboard <https://en.wikipedia.org/wiki/Guitar_pedalboard>`_,
14+
in which musicians will chain various effects pedals together to give them
15+
complete control over their sound. The :py:mod:`pedalboard` module implements
16+
this concept with its main :class:`Pedalboard` class::
17+
18+
from pedalboard import Pedalboard, Chorus, Distortion, Reverb
19+
20+
# Create an empty Pedalboard object:
21+
my_pedalboard = Pedalboard()
22+
23+
# Treat this object like a Python list:
24+
my_pedalboard.append(Chorus())
25+
my_pedalboard.append(Distortion())
26+
my_pedalboard.append(Reverb())
27+
28+
# Pass audio through this pedalboard:
29+
output_audio = my_pedalboard(input_audio, input_audio_samplerate)
30+
31+
32+
:class:`Pedalboard` objects are lists of zero or more :class:`Plugin` objects,
33+
and :class:`Pedalboard` objects themselves are subclasses of :class:`Plugin` -
34+
which allows for nesting and composition.
35+
36+
The following documentation lists all of the available types of :class:`Plugin`.
37+
38+
39+
.. automodule:: pedalboard
40+
:members:
41+
:imported-members:
42+
:inherited-members:
43+
:special-members: __call__

0 commit comments

Comments
 (0)