IAP
A Library bundled for the ITDevCon 2014 presentation "Immersive Audio Programming", which contains the necessary code to build a platform independent audio environment with Delphi.
- Active · last change 4-10-2026
- ★ 8 on GitHub
README
IAP - Immersive Audio Programming Library
A cross-platform audio programming library written in pure Object Pascal, originally created for the ITDevCon 2014 presentation "Immersive Audio Programming". This library provides the necessary components to build platform-independent audio applications with Delphi and Free Pascal.
📦 Quick Download
Pre-built demo applications are available for download:
- Download for Windows - Includes PortAudio DLL
- Download for Linux - Requires
libportaudio2 - Download for macOS - Requires PortAudio via Homebrew
Each release includes all 4 demo applications ready to run!
Features
- Pure Object Pascal implementation for maximum portability
- Cross-platform audio I/O via PortAudio bindings
- DSP (Digital Signal Processing) components including:
- Filters (highpass, lowpass, bandpass, etc.)
- FFT (Fast Fourier Transform) for frequency domain processing
- Convolution for reverb and other effects
- Simple oscillators for signal generation
- Audio file support for WAV and MPEG formats
- Real-time audio processing capabilities
- Demo applications showcasing library features
Platform Support
| Platform | Delphi | Free Pascal (FPC) | Status |
|---|---|---|---|
| Windows | ✅ XE+ | ✅ 3.2.2+ | Fully Supported |
| Linux | � | ✅ 3.2.2+ | Fully Supported |
| macOS | ✅ XE+ | ✅ 3.2.2+ | Should work (untested) |
Note: The library uses generics and other modern language features, requiring Delphi XE or above and FPC 3.2.2 or above.
Requirements
Common Requirements (All Platforms)
- PortAudio library (v19 or later)
- Provides cross-platform audio I/O functionality
Delphi Requirements
- Delphi XE or later (tested with XE-11)
- Windows: Comes with PortAudio DLL
- macOS: Install PortAudio via Homebrew
Free Pascal Requirements
- Free Pascal Compiler (FPC) 3.2.2 or later
- Lazarus IDE 2.0+ (recommended for GUI applications)
- Lazarus LCL (Lazarus Component Library) for GUI demos
Development Tools (Optional but Recommended)
- just - Command runner for task orchestration (Install)
- Simplifies building, testing, formatting, and linting
- Run
just --listto see all available commands
- dos2unix - Line ending converter
- entr - File watcher for auto-rebuild (optional)
Quick Start with Just
If you have just installed, you can use these convenient commands:
just --list # List all available commands
just install-deps # Install all dependencies (Ubuntu/Debian)
just build # Build all demos
just lint # Run all linting checks
just format # Format all Pascal files
just ci # Run all CI checks locally
just dev # Format, lint, and build (full dev cycle)See the justfile for all available commands.
Building with Delphi
Windows (Delphi)
- Install Dependencies:
- Ensure
portaudio.dllis available in your system PATH or next to the executable - The library is usually included in the
Binariesfolder
- Ensure
- Open Project:
Open Demos/Demos.groupproj in Delphi IDE - Build Individual Demos:
- Navigate to
Demos/[Demo Name]/ - Open the
.dprojfile - Press F9 to compile and run
- Navigate to
- Build All Demos:
- Use the group project:
Demos/Demos.groupproj - Right-click → Build All
- Use the group project:
macOS (Delphi)
- Install PortAudio:
brew install portaudio - Open and Build:
- Open project files in Delphi for macOS
- The library should automatically link to libportaudio.2.dylib
- Build as you would on Windows
Note: macOS support with Delphi is untested but should work based on the PortAudio bindings.
Building with Free Pascal (FPC)
Linux (FPC/Lazarus)
-
Install FPC and Lazarus:
Ubuntu/Debian:
sudo apt-get update sudo apt-get install fpc lazarusFedora:
sudo dnf install fpc lazarusArch Linux:
sudo pacman -S fpc lazarus -
Install PortAudio:
Ubuntu/Debian:
sudo apt-get install libportaudio2 portaudio19-devFedora:
sudo dnf install portaudio portaudio-develArch Linux:
sudo pacman -S portaudio -
Compile from Command Line:
cd Demos/[Demo Name] fpc -Fu../../Source \ -Fu/usr/lib/lazarus/3.0/lcl/units/x86_64-linux \ -Fu/usr/lib/lazarus/3.0/lcl/units/x86_64-linux/gtk2 \ -Fu/usr/lib/lazarus/3.0/components/lazutils/lib/x86_64-linux \ -Fi/usr/lib/lazarus/3.0/lcl/include \ -dLCL -dLCLgtk2 \ [ProgramName].dpr -
Or Use Lazarus IDE:
- Create a new project and add the demo source files
- Configure project options to include the Source directory
- Build and run
macOS (FPC/Lazarus)
- Install FPC and Lazarus:
brew install fpc # Download Lazarus from: https://www.lazarus-ide.org/ - Install PortAudio:
brew install portaudio - Compile:
cd Demos/[Demo Name] fpc -Fu../../Source \ -Fu/usr/local/lib/lazarus/lcl/units/x86_64-darwin \ -Fu/usr/local/lib/lazarus/lcl/units/x86_64-darwin/cocoa \ -dLCL -dLCLcocoa \ [ProgramName].dpr
Note: Paths may vary depending on your Lazarus installation location.
Windows (FPC/Lazarus)
- Install FPC and Lazarus:
- Download from: https://www.lazarus-ide.org/
- Run the installer which includes both FPC and Lazarus
- Install PortAudio:
- Download
portaudio.dllfor Windows - Place it in the demo executable directory or Windows\System32
- Download
- Compile from Command Line:
cd Demos\[Demo Name] fpc -Fu..\..\Source ^ -Fu"C:\lazarus\lcl\units\x86_64-win64" ^ -Fu"C:\lazarus\lcl\units\x86_64-win64\win32" ^ -dLCL -dLCLwin32 ^ [ProgramName].dpr - Or Use Lazarus IDE:
- Open Lazarus
- Create a new project or open demo files
- Configure library paths in Project Options
- Build and run
Demo Applications
The library includes several demo applications located in the Demos/ folder:
1. Sine Generator
Demonstrates basic audio output by generating sine wave tones at variable frequencies and amplitudes.
Features:
- Real-time frequency control
- Volume/amplitude adjustment
- PortAudio driver selection
2. Noise Generator
Creates white noise output with adjustable volume.
Features:
- White noise generation
- Volume control
- Simple audio callback demonstration
3. Effect Generator
Advanced demo showing convolution-based audio effects and filtering.
Features:
- Convolution reverb
- Various filter types (highpass, lowpass)
- Audio file playback (MP3/WAV)
- Real-time effect processing
4. VU Meter
Demonstrates audio input monitoring with level metering.
Features:
- Real-time audio input
- Peak level detection
- VU meter visualization
Project Structure
IAP/
├── Source/ # Library source files
│ ├── IAP.PortAudio.* # PortAudio bindings
│ ├── IAP.DSP.* # DSP components (filters, FFT, etc.)
│ ├── IAP.AudioFile.* # Audio file format support
│ ├── IAP.Math.* # Math utilities
│ └── IAP.Types.pas # Common types and definitions
├── Demos/ # Example applications
│ ├── Sine Generator/
│ ├── Noise Generator/
│ ├── Effect Generator/
│ └── VU Meter/
└── Binaries/ # Pre-compiled libraries (Windows)Library Components
Audio I/O
IAP.PortAudio.Host- High-level PortAudio wrapperIAP.PortAudio.Binding- Dynamic PortAudio binding (Windows)IAP.PortAudio.BindingStatic- Static PortAudio binding (macOS/Linux)
DSP
IAP.DSP.Filter- Various digital filter implementationsIAP.DSP.FilterSimple- Simple first-order filtersIAP.DSP.FilterBasics- Filter design utilitiesIAP.DSP.Convolution- Convolution engine for reverbIAP.DSP.FftReal2Complex- FFT implementationIAP.DSP.SimpleOscillator- Basic waveform generators
Audio Files
IAP.AudioFile.WAV- WAV file reading/writingIAP.AudioFile.MPEG- MPEG/MP3 file supportIAP.Chunk.Classes- RIFF/chunk-based file handling
Math & Utilities
IAP.Math- Math functions and utilitiesIAP.Math.Complex- Complex number operationsIAP.Types- Common type definitions
Conditional Compilation
The library uses conditional compilation to support both Delphi and FPC:
{$IFDEF FPC}
{$MODE DELPHI} // Use Delphi syntax mode in FPC
{$ENDIF}
uses
{$IFDEF FPC}
LCLIntf, LCLType, // FPC: Use LCL units
SysUtils, Classes,
{$ELSE}
WinApi.Windows, // Delphi: Use VCL units
System.SysUtils, System.Classes,
{$ENDIF}
IAP.PortAudio.Host;Troubleshooting
PortAudio Library Not Found
Linux:
# Check if PortAudio is installed
ldconfig -p | grep portaudio
# If not found, install it
sudo apt-get install libportaudio2macOS:
# Check installation
brew list portaudio
# Install if needed
brew install portaudioWindows:
- Ensure
portaudio.dllis in your PATH or application directory - Check if you have the correct architecture (32-bit vs 64-bit)
Compilation Errors with FPC
Error: "Can't find unit Interfaces"
- Install Lazarus LCL:
sudo apt-get install lcl-units-3.0 - Ensure you include the LCL unit paths in fpc command
Error: "Can't find unit System.SysUtils"
- The library should handle this automatically with conditional compilation
- If issues persist, ensure you're using FPC 3.2.2 or later
Runtime Issues
No audio devices listed:
- Check if PortAudio can detect your audio hardware
- On Linux, verify ALSA or PulseAudio is working
- Try running the application with elevated permissions (temporarily for testing)
Audio crackling or glitches:
- Increase the PortAudio buffer size
- Check system audio settings
- Ensure your CPU isn't overloaded
Continuous Integration
This project uses GitHub Actions for continuous integration and code quality checks:
Build Workflow
Automatically builds all demo applications on:
- Linux (Ubuntu with FPC/Lazarus)
- Windows (FPC/Lazarus via Chocolatey)
- macOS (FPC with Homebrew)
Each successful build produces artifacts (compiled binaries) available for download.
Code Quality Workflow
Performs comprehensive code quality checks including:
Syntax Checks:
- FPC syntax validation for all Pascal source files
- Compilation with maximum warning levels
Code Analysis:
- Detection of TODO/FIXME comments
- Potential memory leak detection (missing Free/FreeAndNil calls)
- Windows-specific code without proper conditional compilation
- Code duplication patterns
Formatting Checks:
- File encoding validation (UTF-8)
- Line ending consistency checks
- Indentation consistency (tabs vs spaces)
- Trailing whitespace detection
- Long line detection (>120 characters)
- Lines of code statistics
Compiler Warnings:
- Full compilation with all warnings and hints enabled
- Warning and hint reports uploaded as artifacts
All checks run automatically on:
- Every push to main/master/develop branches
- All pull requests
- Feature branches (claude/**)
Running Checks Locally
Before pushing your changes, you can run the same quality checks locally.
Using Just (Recommended):
# Run all checks (same as CI)
just ci
# Quick pre-commit checks
just pre-commit
# Individual checks
just lint # All linting checks
just lint-syntax # Syntax only
just lint-formatting # Formatting only
just build # Build all demos
just format # Auto-format codeUsing Scripts Directly:
# Check code quality
./scripts/check-code-quality.sh
# Check syntax
./scripts/check-syntax.sh
# Check formatting
./scripts/check-formatting.sh
# Build all demos
./scripts/build-all-demos.shAll scripts exit with an error code if issues are found, making them suitable for pre-commit hooks.
Setup Pre-commit Hook:
just setup-hooksThis installs a git hook that automatically runs just pre-commit before each commit.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for detailed guidelines.
Quick overview:
- Fork the repository and create a feature branch
- Follow the Pascal coding standards
- Run local checks before committing
- Ensure all CI checks pass
- Submit a pull request with a clear description
We welcome contributions for:
- Bug fixes
- Platform compatibility improvements
- New DSP algorithms
- Additional demo applications
- Documentation improvements
License
Please check with the original author for licensing information.
Credits
Created for the ITDevCon 2014 presentation "Immersive Audio Programming"
PortAudio: http://www.portaudio.com/ Cross-platform audio I/O library used by this project.
Support & Contact
For questions, issues, or contributions, please use the GitHub issue tracker.

