All Projects → elgiano → XPlayBuf

elgiano / XPlayBuf

Licence: GPL-3.0 License
A buffer player for SuperCollider that loops, fades and doesn't glitch on the float-precision issue

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
SuperCollider
123 projects

XPlayBuf

Author: Gianluca Elia

A buffer player that can loop and fade, while not suffering from the "float precision issue"

Motivations

There is a precision problem when using Phasor/BufRd, which becomes particularly annoying for long buffers or slow play rates. PlayBuf overcomes it by storing an internal phase as a double, with the drawback that current phase information is not accessible. Since I primarily use playback position to do anti-click fades, I wrote a UGen that does it internally, so that it can both benefit from double precision and not click.

I strongly support esluyter/super-bufrd as an effort to manage double precision AND communication of (precise) current phase. It's great and super promising, but it adds a good deal of complexity (e.g. number of UGens, CPU usage...) that I prefer to avoid unless I have a very good reason to want that precise phase information (and not only for anti-click fades). So that I can happily instantiate around a hundred XPlayBufs without saturating my CPU or having too big SynthDefs.

Features

  • All parameters are required in seconds, as opposed to samples;
  • Fades:
    • Cross-fades when skipping to new positions on trigger;
    • Fades to silence when approaching loop start and end positions;
  • Loop boundaries:
    • are updated only on trigger;
    • can loop across buffer end (e.g. a loop of 10s from BufDur - 5s to 5s)
  • Modulateable fadeTime, with a choice between linear or equal-power fades.
  • Cubic interpolation only.
  • Can loop across buffer boundaries (e.g buffer is 3 seconds, loop is 2 seconds and start is at 1s: goes from 2 to 3, fades to 0, goes to 1 and fades back to 2)

TODO

  • adjust fadeTime and/or loopDur to playback rate?
  • UnitTests

Requirements

  • CMake >= 3.5
  • SuperCollider source code

Building

Clone the project:

git clone https://elgiano/xplaybuf
cd xplaybuf
mkdir build
cd build

Then, use CMake to configure and build it:

cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --build . --config Release --target install

You may want to manually specify the install location in the first step to point it at your SuperCollider extensions directory: add the option -DCMAKE_INSTALL_PREFIX=/path/to/extensions.

It's expected that the SuperCollider repo is cloned at ../supercollider relative to this repo. If it's not: add the option -DSC_PATH=/path/to/sc/source.

Developing

Use the command in regenerate to update CMakeLists.txt when you add or remove files from the project. You don't need to run it if you only change the contents of existing files. You may need to edit the command if you add, remove, or rename plugins, to match the new plugin paths. Run the script with --help to see all available options.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].