cvanal utility performs FFT analysis on impulse response files for use with Csound’s convolution opcodes. It converts time-domain impulse responses into frequency-domain representations optimized for fast convolution.
Syntax
Arguments
input_soundfile- Input impulse response audio fileoutput_analysis_file- Output convolution analysis file
Options
File and time selection
| Option | Description |
|---|---|
-s <rate> | Override input sample rate |
-c <channel> | Channel to analyze (1-4, default: all channels) |
-b <time> | Begin time in seconds |
-d <duration> | Duration to analyze in seconds |
File format
| Option | Description |
|---|---|
-X | Use new text-based format (machine-independent) |
Examples
Basic impulse response analysis
Analyze specific channel
Analyze time segment
Use portable text format
Multi-channel room response
Output file format
The analysis file contains:- Header: Sample rate, channels, impulse response length, FFT size
- FFT data: Frequency-domain representation of the impulse response
- Format flag: Indicates rectangular (time-domain derived) format
FFT size and zero-padding
The utility automatically:- Determines impulse response length
Hfrom input - Calculates FFT size as next power of 2 ≥
2H - 1 - Zero-pads impulse response to FFT size
- Performs FFT on zero-padded signal
Impulse response considerations
Recording impulse responses
Good impulse responses should:- Start at time zero with no pre-delay
- Decay to silence within the recording
- Have minimal background noise
- Be normalized to prevent clipping
Types of impulse responses
Room acoustics:- Concert halls
- Studios
- Churches
- Special acoustic spaces
- Speaker cabinets
- Microphone characteristics
- Analog equipment
- Audio effects
- Custom filter designs
- EQ curves
- Artificial reverbs
Channel handling
Mono impulse responses
Apply same response to all channels:Stereo impulse responses
Convolve with stereo files:Multi-channel responses
For surround sound or specialized routing:File formats
Binary format (default)
- Machine-dependent byte order
- Smaller file size
- Faster to read
- May not be portable across systems
Text format (-X flag)
- Machine-independent
- Portable across platforms
- Human-readable (for debugging)
- Larger file size
- Slower to read
Using convolution files in Csound
Convolution analysis files are used with:convolve- Time-domain convolutionpconvolve- Partitioned convolution for efficiency
Performance considerations
FFT size impact
- Larger impulse responses require larger FFT sizes
- FFT size affects convolution efficiency
- Very long responses (>1 second) may require partitioned convolution
Memory usage
Memory required (bytes) ≈FFT_size × channels × 8
For a 2-second impulse at 44.1kHz:
- Impulse length: 88,200 samples
- FFT size: 131,072 (next power of 2 ≥ 176,399)
- Memory: ~1 MB per channel
Troubleshooting
Analysis fails
- Check input file is valid audio
- Verify sufficient disk space
- Check file permissions
Output sounds wrong
- Ensure impulse response starts at time zero
- Check for DC offset in impulse (can cause artifacts)
- Verify impulse doesn’t clip
- Try normalizing impulse response first
File too large
- Trim silence from end of impulse
- Use
-dto limit duration - Consider shorter impulse responses
Technical details
FFT convolution
The frequency-domain convolution theorem states:Zero-padding requirement
To avoid circular convolution artifacts:- Minimum FFT size =
input_length + impulse_length - 1 - Utility rounds up to next power of 2