Skip to main content

Sonix Overview

Sonix is the audio engine module of VoxaTrace, providing:

  • Audio Playback — Play audio files with pitch shifting and tempo control
  • Recording — Record audio to M4A or MP3 formats
  • Multi-track Mixing — Mix multiple audio tracks with individual controls
  • Metronome — Programmable metronome with visual feedback
  • MIDI Synthesis — Play MIDI notes using SoundFont instruments

Sonix in Action

Mixing Multiple Tracks

Track 1 (Backing):  ████████████████████████████████  vol: 0.8
Track 2 (Vocals): ░░░░████████████████░░░░░░░░░░░░ vol: 1.0
Track 3 (Guide): ████████████████████████████████ vol: 0.3 (muted)
Track 4 (Click): █░░░█░░░█░░░█░░░█░░░█░░░█░░░█░░░ vol: 0.5
─────────────────────────────────
Output: Mixed audio to speakers

Pitch Shifting

Original:     C4 ──── D4 ──── E4 ──── F4 ────
262 Hz 294 Hz 330 Hz 349 Hz

+2 semitones: D4 ──── E4 ──── F#4 ─── G4 ────
294 Hz 330 Hz 370 Hz 392 Hz

The melody stays the same, just in a different key.

Recording Pipeline

Microphone


┌─────────────────┐
│ SonixRecorder │──── audioBuffers (real-time for visualization)
│ │──── level (VU meter)
│ ┌─────────────┐ │
│ │ MP3 Encoder │ │──── output.mp3
│ └─────────────┘ │
└─────────────────┘

Key Features

Playback

val player = SonixPlayer.create("song.mp3")
player.play()
player.pitch = 2f // +2 semitones (higher key)
player.tempo = 0.8f // 80% speed (slower)
player.seek(30_000) // Jump to 30 seconds
FeatureRange
FormatsM4A, MP3, WAV
Pitch shifting-12 to +12 semitones
Tempo control0.5x to 2x speed
LoopingAny region

Recording

val recorder = SonixRecorder.create(
SonixRecorderConfig.Builder()
.format(AudioFormat.MP3)
.outputPath("recording.mp3")
.build()
)
recorder.start()
// ... user sings ...
recorder.stop()
FeatureOptions
Output formatsM4A (AAC), MP3
Sample rates16kHz, 44.1kHz, 48kHz
Echo cancellationBuilt-in support
Background recordingSupported

Multi-track Mixing

Perfect for karaoke apps that need backing track + vocal guide + click track:

val mixer = SonixMixer.create()
mixer.loadTrack(0, "backing.mp3")
mixer.loadTrack(1, "vocal_guide.mp3")
mixer.setVolume(0, 0.8f) // Backing at 80%
mixer.setVolume(1, 0.3f) // Guide quiet
mixer.play()
FeatureSpecification
Simultaneous tracksUp to 8
Per-track controlsVolume, pan, solo, mute
SynchronizationSample-accurate

Metronome

val metronome = SonixMetronome.create(bpm = 120)
metronome.onBeat { beat, isAccent ->
// Update UI on each beat
}
metronome.start()
FeatureRange
BPM40 – 240
Time signaturesAny
Custom soundsSupported

MIDI Synthesis

Generate vocal guides or accompaniment from MIDI:

val synth = SonixMidiSynthesizer.create("piano.sf2")
synth.noteOn(channel = 0, note = 60, velocity = 100) // Middle C
synth.noteOff(channel = 0, note = 60)
FeatureSpecification
SoundFont support.sf2 files
Channels16 (MIDI standard)
EventsNote on/off, program change, pitch bend

Next Steps

API Reference

Guides