Overview
Audio tracks are the fundamental building blocks for working with audio in Lumix. Each audio track provides a complete signal chain including mixing, plugin processing, volume/pan control, and metering.AudioTrack Class
TheAudioTrack class (~/workspace/source/Lumix/Tracks/AudioTracks/AudioTrack.cs:9) extends the base Track class and provides audio-specific functionality.
Key Properties
| Property | Type | Description |
|---|---|---|
TrackType | TrackType | Always returns TrackType.Audio |
Engine | TrackAudioEngine | The audio engine handling playback and processing |
DraggedClip | AudioFileReader | Currently dragged audio clip (for UI operations) |
Name | string | Track name |
Color | Vector4 | Track color (randomly assigned on creation) |
Clips | List<Clip> | Audio clips contained in this track |
Construction
Audio Track Lifecycle
Track Creation
When an audio track is created, it:
- Generates a random color for visual identification
- Initializes a
TrackAudioEnginewith the project’s sample rate - Subscribes to volume metering events for gain visualization
- Registers itself with the master track for final output routing
Clip Management
Audio clips can be:
- Dragged from the file browser onto the track
- Recorded directly into the track
- Duplicated, moved, and edited
Track Controls
Each audio track includes the following controls (defined in baseTrack class):
Volume and Pan
-
Volume: Range from -90 dB to +6 dB
- Converted to linear gain:
float linearVolume = (float)Math.Pow(10, _volume / 20) - Double-click to reset to 0 dB
- Converted to linear gain:
-
Pan: Range from -50 (left) to +50 (right)
- Mapped to stereo provider:
float mappedPan = _pan / 50f - Double-click to center
- Mapped to stereo provider:
Track State
| Control | Description |
|---|---|
| Enable/Disable | Turns track on/off (mute) |
| Solo | Mutes all other tracks |
| Arm Recording | Enables recording when playback starts |
Gain Metering
Each track displays a real-time stereo gain meter showing:- Left channel level (left half of meter)
- Right channel level (right half of meter)
- Smoothed visualization for better readability
Clip Operations
Adding Clips
Clips can be added to a track by:- Drag and drop from file browser
- Recording audio input
- Duplicating existing clips (Ctrl+D)
Supported Audio Formats
Any format supported by NAudio’sAudioFileReader, including:
- WAV
- MP3
- AIFF
- And other common formats
Track Duplication
Audio tracks can be fully duplicated with all settings and clips:Time Selection
Tracks support time selection areas for:- Selecting multiple clips within a time range
- Creating new MIDI clips (on MIDI tracks)
- Visual reference during editing
Bars.Beats.Ticks
Recording Audio
When recording is armed and playback starts:- Track engine creates a
WaveInEventdevice - Audio is written to a temporary WAV file
- On stop, an
AudioClipis created from the recorded file - The clip is added to the track at the recording start position
Best Practices
Track Organization
Track Organization
- Use descriptive track names
- Color-code related tracks for easier navigation
- Use track reordering (arrow buttons) to group related tracks
Performance
Performance
- Disable unused tracks to save CPU
- Use the solo feature instead of manually muting multiple tracks
- Monitor gain meters to avoid clipping
Workflow
Workflow
- Double-click track controls to open device view
- Use Ctrl+Click on solo to solo multiple tracks
- Right-click for quick access to track operations
Related Classes
- Base Track Class:
~/workspace/source/Lumix/Tracks/Track.cs - Audio Engine:
~/workspace/source/Lumix/Tracks/AudioTracks/TrackAudioEngine.cs - Track Types: Audio, MIDI, Group
Next Steps
Audio Clips
Learn about audio clip management and editing
Audio Engine
Deep dive into audio processing and playback