Introduction
Welcome to the documentation for libpd iOS!
What is libpd iOS?
libpd is a lightweight, embeddable library for integrating Pure Data (Pd) into your iOS applications. Pure Data is a visual programming language for audio and multimedia processing. libpd allows you to create audio synthesis and processing algorithms using Pd, and then seamlessly integrate them into your iOS applications.
Getting Started
Prerequisites
- Mac computer with Xcode installed
- Basic knowledge of Objective-C or Swift
- Familiarity with audio signal processing concepts
Installation
To install libpd iOS, follow the steps below:
- Open Xcode and create a new project or open an existing project.
- Open Terminal and navigate to the root directory of your project.
- Run the command
pod init
to create a newPodfile
for your project. - Open the
Podfile
and add the following line:pod 'libpd'
. - Save the
Podfile
and run the commandpod install
to install libpd iOS. - Open the generated
.xcworkspace
file for your project. - Import the libpd framework into your project using the
#import <PdDispatcher.h>
statement. - You’re now ready to use libpd iOS in your project!
Usage
Initialize libpd
To initialize libpd, follow the steps below:
- Create an instance of
PdAudioController
in your application. - Set the active audio session category using
PdAudioController
‘sconfigurePlaybackWithSampleRate
method. - Start the audio engine with
PdAudioController
‘sactive
property. - Initialize the Pd dispatcher by creating an instance of
PdDispatcher
and attaching it to thePdAudioController
withPdAudioController
‘ssetActive:YES
method.
Load and Send Patches
To load and send Pd patches, follow the steps below:
- Locate your Pd patch file, usually with a
.pd
file extension. - Load the patch into a Pd patch instance using the Pd dispatcher’s
addPatch:toPath:
method. - Send messages to the Pd patch instance using the
sendList:toReceiver:
method or similar methods provided by the Pd dispatcher.
Handle Messages
To handle messages received from the Pd patch, you can register a listener using the Pd dispatcher’s addListener:forSource:
method. This allows you to react to messages and implement custom behaviors in your application.
Additional Topics
- API Reference
- Working with Audio
- UI Integration
- Advanced Techniques