Skip to content

cycdp: provides python bindings to CDP8 #36

Description

@shakfu

I thought this new project would be interesting since it is another way to use the CDP8 algorithms:

Overview

The Composers Desktop Project (CDP) is a venerable suite of over 500 sound transformation programs developed since the late 1980s by Trevor Wishart, Richard Orton, and others. It occupies a unique niche in audio processing: where most tools focus on mixing, mastering, or standard effects, CDP specializes in deep spectral manipulation, granular synthesis, pitch-synchronous operations, waveset distortion, and other techniques rooted in the electroacoustic and computer music traditions.

Historically, CDP programs are invoked as standalone command-line executables that read and write sound files, which makes integration into modern workflows cumbersome. cycdp solves this in two ways. First, a C library (libcdp) reimplements a curated subset of CDP's algorithms to operate directly on memory buffers. Second, a shim layer intercepts the file I/O calls inside original CDP algorithm code (the sfsys open/read/write/seek functions) and redirects them to memory buffers transparently, so those algorithms can run in-process without touching the filesystem. Both paths are exposed to Python via Cython bindings, giving you native-speed audio processing with a Pythonic API, zero-copy buffer interoperability, and no subprocess overhead.

Design principles

  • Zero-copy interop. Cython memoryviews and the buffer protocol mean data passes between Python and C without copying.
  • No numpy dependency. Operates on any object supporting the Python buffer protocol (array.array, memoryview, numpy arrays, etc.). Numpy is optional, not required.
  • Functional API. Most functions accept a buffer and return a new buffer, leaving the original unchanged. Low-level in-place alternatives are also available.
  • Self-contained. The C library is compiled into the extension; no external CDP installation is needed.

Features

Spectral Processing -- Time stretching (preserving pitch), pitch shifting (preserving duration), spectral blur, shift, stretch, focus, hilite, fold, and noise cleaning.

Granular Synthesis -- Classic brassage, freeze, grain clouds, grain time-extension, simple and multi-layer texture synthesis, wrappage, plus extended grain operations (reorder, rerhythm, reverse, timewarp, repitch, stereo positioning, omit, duplicate).

Pitch-Synchronous Operations (PSOW) -- Time-stretching that preserves pitch via PSOLA, grain extraction and interpolation, and a hover effect for sustained pitched textures.

FOF Extraction and Synthesis -- Extract pitch-synchronous grains (FOFs), build a grain bank, resynthesize at arbitrary pitch and duration, and repitch with optional formant preservation.

Morphing and Cross-Synthesis -- Spectral morphing between two sounds, gliding morphs over time, and vocoder-style cross-synthesis.

Distortion -- Waveset-based techniques: overload/saturation, reverse, fractal, shuffle, cut with decaying envelopes, marker-based interpolation, wavecycle repetition, half-wavecycle shifting, and progressive warp with sample folding.

Dynamics and EQ -- Compressor, limiter, noise gate, parametric EQ, envelope follower, and envelope application.

Filters -- Lowpass, highpass, bandpass, and notch (band-reject).

Effects -- Reverb (FDN: 8 comb + 4 allpass), delay, chorus, flanger, ring modulation, bitcrush, tremolo, and attack reshaping.

Spatial Processing -- Static and envelope-driven panning, stereo mirror and width control, spinning rotation with optional doppler, dual-rotation modulation, spatial tremolo, and phase-based stereo enhancement.

Playback and Time Manipulation -- Zigzag, iterate, stutter, bounce, drunk-walk navigation, looping with crossfades, TDOLA time-stretching, waveset scrambling, splinter, and silence constriction.

Experimental / Chaos -- Strange attractor (Lorenz), Brownian motion, crystal growth, fractal, Chirikov map, Cantor set, cascade, fracture, and tesselation transformations.

Analysis -- Pitch tracking (YIN), formant analysis (LPC), and partial/harmonic extraction.

Synthesis -- Waveform generation (sine, square, saw, ramp, triangle), white and pink noise, click/metronome tracks, and chord synthesis from MIDI notes.

Core Operations -- Gain (linear and dB), normalization, phase inversion, peak detection, channel conversion (mono/stereo, split, merge, interleave), mixing, reverse, fade in/out, and concatenation.

File I/O -- Read and write WAV files (float32, PCM16, PCM24).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions