Backbone Singer Tone

Introduction

Backbone Singer Tone converts live mic audio into musical pitch data in real time—frequency (Hz), MIDI note, cents, and note name. Drop the MicToneDetector prefab, pick a mic, and you’re capturing with level gating and optional smoothing. Built for music games and apps: rhythm mechanics, singing trainers, ear-training, vocal UIs—on desktop, mobile, and WebGL.

Key Benefits

Requirements and platform permissions

This section explains what Unity versions and audio setup you need, and how microphone permissions work on each platform. Read it before shipping to desktop, mobile, or WebGL so the mic starts reliably and users see the correct permission prompts.

Minimum requirements

Permissions by platform

Notes and Tips

Quick Start

The Quickstart for Backbone Singer Tone is simple: drop MicToneDetector, tweak a few fields, optionally wire UnityEvents, and you are detecting sung notes in real time—no boilerplate.

  1. Add prefab: drag MicToneDetector into your scene (comes with a muted AudioSource).
  2. Inspector: start with autoStart = true, pitchWindowMs = 80–120, minVolumeDB ≈ -20, consecutiveDetections = 5, useClipRead = true.
  3. Events (optional): wire OnPitchHz, OnMidiNote, OnMidiCents, OnNoteName to UI or gameplay.
  4. Run: press Play, grant mic permission, sing. Values update live.
  5. Start/Stop manually (optional):
  6. Inspector overview
  7. Read latest values (polling):If you wish to use your own detection instead of being called by events, use
  8. Inspector overview

Prefab: MicToneDetector

MicToneDetector is your plug-and-play vocal pitch box. It listens to the mic, filters and analyzes the signal for stable monophonic pitch, gates by level, and exposes data plus UnityEvents so UI and gameplay can react. Think of it as a “voice → game” adapter: pick a mic, set the analysis window and gate, wire events, ship.

4.1 Components & Dependencies

4.2 Public Properties

Inspector overview
PropertyDescription
autoStartStarts the mic when the GameObject enables.
deviceNameMicrophone device name. Empty selects the first device.
pitchWindowMsAnalysis window (10–200 ms). Larger = steadier, smaller = snappier.
minVolumeDBLevel gate threshold. Below this, detection is suppressed.
consecutiveDetectionsMode smoothing window size (1–50).
clearOnSilenceEmit zeros/empty when below gate to avoid stale UI.
debugLogsPrint RMS/dB and decisions to the Console.
useClipReadRead mic clip directly for lowest latency.
LastFrequencyHzLatest frequency in Hz (0 = no tone).
LastMidiNoteLatest MIDI note (0 = no tone).
LastMidiNotePreciseNote + cents/100 as float.
LastCentsIntonation offset in cents (−50..+50).
LastNoteNameFormatted name, e.g., “A# 4”.
ActiveMic running flag.
ListDevices()Returns available microphone device names.
StartMic(string)Start capture. Optional device name.
StopMic()Stop capture.

4.3 UnityEvents

EventPayloadTypical use
OnPitchHzfloatUpdate a Hz label or drive visuals.
OnMidiNoteintGameplay logic by note number.
OnMidiCentsintIntonation UI or scoring.
OnNoteNamestringUser-friendly note display.

Usage Examples

Below are small, drop-in snippets that show common patterns:
• Display live data in UI (Hz, note name, MIDI, cents).
• React to specific notes with UnityEvents for gameplay or FX.
• Select a microphone programmatically at runtime.

Prerequisite: add a MicToneDetector to your scene (prefab or component).

6.1 Display Hz / Note / MIDI in UI

Inspector overview

Shows live pitch data on screen. Wire Backbone Singer Tone events (OnPitchHz, OnNoteName, OnMidiNote, OnMidiCents) to UI Text/TMP fields to display values while singing.

6.2 React to notes with UnityEvents

Inspector overview

Trigger gameplay or FX when specific notes are detected. Subscribe to OnMidiNote and run your logic on matching notes—lights, animations, scoring, or state changes.

6.3 Select microphone in code

Inspector overview

Programmatically choose the input device at runtime: list Microphone.devices, pick a name, and call StartMic("DeviceName") on the component.

Troubleshooting

7.1 No pitch detected

7.2 Permissions and WebGL specifics

7.3 Latency vs stability and performance

FAQ

Technical Reference (Doxygen) — read this first

Backbone Singer Tone’s runtime is a full DSP stack: windowed analysis, band-shaping IIR filters, coarse-to-fine pitch search, interpolation, overlap handling, and history smoothing. The internal API exposes levers that interact in non-obvious ways. The Doxygen reference is aimed at experienced developers who need to extend or audit internals (e.g., filter responses, search curves, latency/smoothing strategies).

If you only need to detect notes and drive gameplay, stick to the prefab and high-level API. If you plan to modify algorithms, read classes in order: SingerToneDSPSingerToneTrackerIIRFilterCircularBuffer<T>SingerToneDetector.

→ View full API documentation (advanced use only)

Conclusion & Support

Backbone Singer Tone gives your game a reliable voice interface: simple setup, real-time results, and clear hooks for UI and logic. Profile on target hardware, tune the analysis window and smoothing, and ship with confidence.

For questions or support, contact: backbonegamelabs@gmail.com