libpd-go icon indicating copy to clipboard operation
libpd-go copied to clipboard

Package libpd provides an idiomatic Go-lang wrapper for Pure Data embeddable audio synthesis library.

libpd-go puredata-logo GoDoc

This project provides Go bindings for Pure Data wrapper z_libpd.h — a Pure Data embeddable audio synthesis library.
All the binding code has automatically been generated with rules defined in core.yml. There is also a high-level Go package libpd implemented over the core, it introduces threadsafe access to PD, some idiomatic helpers and allows to run multiple instances of PD.

Before start you must install libpd library. Don't worry, it installs fine and that's the fastest way to begin using PD as an embedded DSP.

Usage

$ go get github.com/xlab/libpd-go/libpd

Demo

There is a minimal Pure Data player implemented in Go that can read patches, including extras, and play them via portaudio-go. It's about 100 lines of code. You will need to get PortAudio installed first.

$ brew install portaudio
$ go get github.com/xlab/libpd-go/cmd/pdplay

$ pdplay -h

Usage: pdplay [OPTIONS] PATCHDIR

A minimal PureData player implemented in Go.

Arguments:
  PATCHDIR=""   Path to the patch dir.

Options:
  --name="main.pd"   Name of the main file.

$ pdplay $GOPATH/src/github.com/xlab/libpd-go/assets/patch01

# an atmospheric meditation synthesis sound goes...
# by freezemode - http://soundcloud.com/freezemode

Try this patch for example too: PerotinusRandom on pdpatchrepo.info (also a precompiled version with freeverb~ extra for OS X 64-bit located here: PerotinusRandom.zip). Awesome chorus!

Rebuilding the package

You will need to get the cgogen tool installed first.

$ git clone https://github.com/xlab/libpd-go && cd libpd-go
$ make clean
$ make