Build and develop chiller~, a Max/MSP external for real-time spectral freezing of audio buffers using FFT-based granular synthesis. Handles CMake builds, debugging, and parameter tuning.
Build and develop chiller~, a Max/MSP external that performs real-time spectral freezing of audio buffer content, creating evolving drones and textural sounds through FFT-based granular synthesis.
This skill helps you build, debug, and extend the chiller~ Max/MSP external. It handles CMake configuration for universal binaries (Intel + Apple Silicon), implements FFT-based audio processing, manages buffer~ integration, and provides comprehensive debugging for spectral analysis issues.
When the user asks you to work with the chiller~ external, follow these steps:
The chiller~ external is a Max/MSP audio object (`t_pxobject`) that:
**Key files:**
When building or rebuilding:
```bash
cd "/Users/a1106632/Documents/Max 8/Packages/max-sdk-main/projects/chiller"
mkdir -p build && cd build
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
cmake --build .
ls "/Users/a1106632/Documents/Max 8/Packages/externals/chiller.mxo"
```
**Verification:**
```bash
file "/Users/a1106632/Documents/Max 8/Packages/externals/chiller.mxo/Contents/MacOS/chiller"
```
**Spectrum Normalization (CRITICAL):**
The external previously suffered from magnitude explosion. Always ensure energy-based normalization in the capture phase:
```cpp
double target_energy = x->fft_size * 0.1;
double normalization_factor = sqrt(target_energy / spectrum_energy);
```
**Rate Limiting:**
Position changes must be rate-limited to prevent noise artifacts:
```cpp
if (current_time - x->last_position_change_time < 500.0) return;
```
**Processing Pipeline:**
```
Buffer Audio → Windowed FFT → Magnitude Extraction → Phase Randomization → IFFT → Overlap-Add → Output
```
When diagnosing audio problems, use the debug system:
**Send `bang` message to output:**
**Healthy spectrum energy:**
```
Spectrum Energy: 88633.919625
Max Magnitude: 94.018975
```
**Problem indicators:**
```
Spectrum Energy: 871190700897.731689 ← MAGNITUDE EXPLOSION
Max Magnitude: 334635.621325
```
**Core functions:**
**Synthesis parameters:**
**Object instantiation:**
**FFT Size Trade-offs:**
**Memory usage per instance:**
**Adding new parameters:**
1. Add attribute in struct definition
2. Implement setter method with `METHOD_ATTRIBUTE`
3. Register in `ext_main()`
4. Document in help patch and README
**Modifying FFT processing:**
1. Update `chiller_capture_spectrum()` for analysis changes
2. Update `chiller_generate_grain()` for synthesis changes
3. Test with debug `bang` to verify spectrum energy
4. Validate with multiple FFT sizes
**Fixing audio artifacts:**
1. Use `bang` to check spectrum energy (watch for explosion)
2. Verify rate limiting is active (check timing intervals)
3. Check overlap buffer states for discontinuities
4. Test with different buffer content types
After any code changes:
1. **Build verification:** Check universal binary architecture
2. **Load test:** Open help patch, verify object loads without errors
3. **Audio test:** Load buffer, set position, verify clean output
4. **Debug test:** Send `bang`, verify spectrum energy is reasonable
5. **Parameter test:** Sweep each parameter, verify smooth transitions
6. **Performance test:** Monitor CPU with Max performance monitor
When modifying functionality:
1. Update inline code comments
2. Update `README.md` for user-facing changes
3. Update `CLAUDE.md` for technical details
4. Update help patch with new examples
5. Document any new parameters or messages
**Building after code changes:**
```bash
cd "/Users/a1106632/Documents/Max 8/Packages/max-sdk-main/projects/chiller"
cd build
cmake --build .
```
**Diagnosing noisy output:**
1. Send `bang` to chiller~ object
2. Check Max console for "Spectrum Energy" value
3. If > 1,000,000: magnitude explosion issue
4. Verify normalization code is active in `chiller_capture_spectrum()`
**Adding a new synthesis parameter:**
1. Add `t_atom_float new_param;` to struct
2. Create `chiller_new_param(t_chiller *x, double f)` setter
3. Register in `ext_main()` with `CLASS_ATTR_DOUBLE`
4. Use in `chiller_generate_grain()` processing
5. Update help patch with example usage
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/chiller-maxmsp-external-builder/raw