Train your ear. Understand every chord. Build a stronger fretboard.
Bragi is a desktop music-practice application for guitarists and other fretted-string players. It brings live instrument input, pitch detection, note and chord exercises, ear training, music-theory explanations, configurable instrument tunings, and player-specific progress tracking into one application.
Bragi is built with Python and Flet. Its audio pipeline uses SoundDevice/PortAudio, NumPy, and SciPy-compatible numerical processing. Music theory, application state, and local persistence are separated into dedicated modules.
Project status — Beta: The current release line is 0.2.0, and the
v0.2.0-beta.1tag has been pushed. Its original tagged CI run passed 790 automated tests, but Windows packaging failed because the hosted runner did not have a usable Flutter SDK and Flet could not complete its interactive setup prompt. The local regression suite has since grown to 1,087 passing tests (November 29, 2026). No Windows installer or portable ZIP has been published yet. See the tagged workflow run, GitHub Actions, and Releases for updates.
Bragi is designed around a practice loop:
- Receive a note or chord target.
- Play the target through an audio interface or supported input.
- Get live pitch feedback and automatic exercise evaluation.
- Open a contextual theory hint to understand the chord's construction.
- Track practice accuracy, XP, achievements, and challenge progress.
It is an audio-based practice and learning tool. It does not currently identify a complete guitar fingering, fretboard position, inversion, or exact string-by-string voicing from a recording.
- Home screen with a central Bragi hub and four circular navigation buttons for Trainer, Tuner, Ear Training, and Analytics.
- Header navigation remains available throughout the app.
- Clicking the Bragi logo in the header returns to Home.
- Each main view has its own background image.
The Trainer provides three exercise modes:
- Single Note: receive a note and string target, play it, and advance when the detected pitch satisfies the note and tuning checks for the configured hold duration.
- Strummed Chord: strum a chord and let Bragi compare detected pitch classes with the target chord.
- Arpeggio Chord: pick through a chord. Bragi accumulates detected pitch classes over a rolling 2.5-second window and checks for the required chord tones.
The Trainer also includes:
- Target skipping.
- Adjustable auto-advance hold timing.
- Live pitch feedback.
- Instrument-aware string numbering and tuning labels.
- Contextual chord-theory hints.
The Hint & Theory dialog provides progressive guidance for the current chord target:
- Reveal hints before displaying the full explanation.
- Inspect the chord root and quality.
- Review the chord formula, such as 1–b3–5.
- See correctly spelled chord-tone names and interval names.
- Review reference-scale degrees where defined.
The theory layer separates diatonic interval spelling from chromatic semitone distance. It supports enharmonic spellings and helps distinguish notes that sound the same but have different theoretical spellings.
The tuner displays:
- Detected note name.
- Estimated frequency.
- Cents deviation from the nearest equal-tempered pitch.
- In-tune feedback.
- A visual tuning indicator.
The live pitch tracker uses autocorrelation, peak selection, and parabolic interpolation. The Tuner and Single Note Trainer share the same live pitch state.
A separate FFT-based chromagram analyzer maps spectral energy into the 12 pitch classes. A short multi-frame history and harmonic attenuation help identify candidate pitch classes for strummed-chord practice. The audio engine also maintains the rolling pitch-class history used by arpeggio practice.
Bragi includes a dedicated, session-driven Ear Training suite with four progressive difficulty levels. Exercises use MIDI-based note generation and playback, with questions generated independently of the live guitar-input and pitch-detection pipeline.
Introduces fundamental pitch, interval, and chord-quality recognition. Foundations is designed to help new players develop basic listening familiarity before progressing to larger sets of answer choices.
The level includes three exercises:
- Single Pitch: identify the pitch class of a played note.
- Melodic Intervals: identify basic intervals played sequentially, ascending or descending.
- Chord Quality: distinguish major, minor, diminished, and suspended-fourth triads.
To make the initial learning experience more approachable, Single Pitch and Melodic Intervals begin with a simplified multiple-choice format containing four answer options.
- The correct answer is always included.
- Three additional options are selected as distractors.
- After 25 completed questions in an individual exercise, the full answer set becomes available automatically.
- Progress is tracked independently for each exercise and player.
- The transition happens regardless of accuracy; it is intended as an introduction, not a mastery requirement.
Chord Quality already uses four answer options and retains its existing format.
The interval curriculum includes:
- Unison
- Minor second
- Major second
- Minor third
- Major third
- Perfect fourth
- Perfect fifth
- Octave
Expands pitch recognition and introduces more advanced interval and chord exercises.
- Single Note: identify the exact note, including its octave.
- Melodic Interval: identify all 13 supported intervals within an octave, including the tritone.
- Harmonic Interval: identify two notes played simultaneously.
- Chord Quality: distinguish eight chord qualities.
The supported chord qualities are:
- Major
- Minor
- Diminished
- Suspended second
- Suspended fourth
- Dominant seventh
- Major seventh
- Minor seventh
Level 3 expands ear-training recognition through more complex intervals, chord structures, voicings, and registers.
Implemented exercises:
- Interval Identification: identify intervals with starting-note recognition.
- Compound Interval Identification: recognize intervals extending beyond one octave.
- Chord Identification: identify a chord's root and quality across three voicings.
- Chord Inversions: identify root position, first inversion, and second inversion for major, minor, and diminished triads.
Chord identification supports three voicing structures:
- Close
- Open
- Spread
The Level 3 interval and chord exercises use an expanded MIDI register of 36–96 (C2–C7).
Level 4 removes multiple-choice assistance and requires users to recall and enter answers directly.
Implemented exercises:
- Note Recall: enter the exact note name, including octave.
- Interval Recall: enter the starting note and interval name.
- Chord Recall: enter the chord root and quality.
- Inversion Recall: enter the chord quality and inversion.
- Compound Interval Recall: enter the complete compound interval name.
Active Recall uses typed responses rather than selectable answer options. Answers are validated against the generated question, with support for accepted musical terminology and aliases.
A built-in answer guide explains the required response format for each exercise.
Level 4 is designed to test independent musical recognition without visible answer choices or hints.
The Ear Training session controller manages:
- Level and exercise selection.
- Question generation and audio playback.
- Multiple-choice and typed-answer validation.
- Question replay and replay-count tracking.
- Response-time measurement.
- Correct and incorrect answer feedback.
- Player-specific progression and level tracking.
Progression milestones are based on performance across 20 attempts at the current level. A minimum of 16 correct answers (80%) is required to unlock the next level.
Beta access: All four levels are currently selectable, regardless of milestone progress. This allows testers to evaluate the complete Ear Training curriculum without having to unlock each level sequentially. Progression statistics and milestone tracking remain active.
Planned production behavior: Level access will return to milestone-based unlocking, requiring users to demonstrate sufficient accuracy before progressing to the next level.
Each player's Ear Training progress and attempt history are stored independently in SQLite.
The MIDI foundation supports the full standard 88-key piano range, from A0 (MIDI 21) through C8 (MIDI 108).
The current playback implementation provides MIDI note, multi-note, and melodic-interval playback through the dedicated SamplePlayer component. Natural sampled-instrument playback and additional instrument timbres are future audio-development goals.
The database supports Ear Training attempt history and aggregate analytics, including:
- Overall accuracy.
- Exercise-specific performance.
- Interval and chord-quality performance.
- Note and root identification.
- Response times.
- Replay frequency.
Dedicated Ear Training analytics presentation within the UI remains under development.
The instrument configuration system currently supports:
- Guitar
- Bass
- Ukulele
- Baritone ukulele
- Banjo
Each instrument has a standard tuning configuration. Players can also configure custom string counts and individual string note/octave assignments, within the supported 1–12 string range.
Instrument and tuning configurations are saved separately for each player. The Trainer uses the active configuration when displaying string targets and selecting string numbers.
Multiple named player profiles can be used on the same installation. Each player has independent:
- XP and level.
- Practice-attempt history and analytics.
- Consecutive-correct-answer streak.
- Unlocked badges.
- Hero Boss challenge progress.
- Instrument and tuning configuration.
The Players dialog supports creating, switching, renaming, resetting, and deleting profiles. Resetting clears the selected player's progress while retaining the profile and its instrument configuration. Deleting a player removes that player's associated records; the last remaining player cannot be deleted. Deleting the active player switches the app to another remaining profile.
The original single-player database is migrated into the initial Player 1 profile.
The Analytics view reports practice totals and progression, including:
- Total attempts and accuracy.
- Average response time.
- XP and level.
- Unlocked badges.
- Hero Boss challenge progress.
The Hero Boss challenge tracks consecutive note, chord, and arpeggio successes against its response-time requirement.
There are 40 badge definitions across the application categories. Unlock evaluation is currently implemented for a subset of those definitions; the full catalog does not mean every badge condition is active.
Streak terminology: the stored streak is a count of consecutive correct answers. It is not a calendar-based daily practice streak. The current Analytics screen still labels this value as “days”; that display label is inaccurate.
Current theory and practice content includes:
- Chromatic note names, including sharp, flat, enharmonic, and Unicode accidental spellings.
- Major, minor, diminished, suspended, and seventh-chord theory and recognition.
- Single-note targets and pitch-class matching for strummed chords.
- Arpeggiated chord-tone accumulation.
- Four fully implemented Ear Training levels: Foundations, Intermediate, Advanced, and Active Recall.
- Melodic and harmonic interval recognition, including compound intervals.
- Chord identification using close, open, and spread voicings.
- Major, minor, and diminished triad inversion recognition.
- Typed-answer validation across all five Active Recall exercises.
- MIDI-based note generation across the standard 88-key piano range.
- Expanded Level 3 musical register from MIDI 36 (C2) through MIDI 96 (C7).
Bragi does not yet validate a specific fretboard position, complete guitar voicing, string assignment, note order in an arpeggio, or rhythmic accuracy. Chord inversion recognition is currently limited to ear-training exercises.
The automated release workflow is intended to build Windows x64 packages. The workflow definition is in place, but the first tagged build has not completed packaging successfully yet. The original tagged CI run passed its 790-test suite, while the Flet build stage stopped because Flutter was not available on the hosted runner and the CLI could not complete its interactive setup prompt. The current local regression suite has since grown to 1,087 passing tests. The CI environment must be corrected before downloadable packages are available.
- Installer:
Bragi-0.2.0-setup.exe - Portable archive:
Bragi-0.2.0-Windows-x64.zip
The installer is created with Inno Setup and provides an application shortcut and uninstaller. The portable ZIP contains the complete Flet application bundle. Extract the ZIP before launching Bragi; do not run the executable from inside the compressed archive.
The Windows build bundles the application runtime and required files. Users do not need to install Python separately to run the packaged Windows application.
The current workflow is triggered by pushing a version tag beginning with v. It checks that the tag's base version matches project.version in pyproject.toml, installs dependencies, runs pytest, builds the Windows application, creates the installer and ZIP, and publishes a GitHub prerelease. For example:
git checkout main
git pull --ff-only origin main
# First update project.version in pyproject.toml to the new release version.
git tag -a vX.Y.Z-beta.N -m "Bragi X.Y.Z Beta N"
git push origin vX.Y.Z-beta.NReplace X.Y.Z-beta.N with a new version tag that matches the updated project.version. Do not reuse the existing v0.2.0-beta.1 tag.
The workflow uses Python 3.12 for its build environment and the project-pinned Flet 1.0.4 release.
Linux and macOS source execution may be possible where Python, Flet, PortAudio, and a compatible audio backend are available, but automated Linux and macOS packages are not part of the current beta workflow.
Audio-device discovery is currently Windows-oriented: the preferred device list searches for specific Windows WASAPI and WDM-KS endpoints, including HeadRush and common Windows audio devices. The audio engine can fall back to the system's default input, but generic device enumeration and selection have not yet been generalized across operating systems.
Android and iOS packages are not currently supported. Mobile distribution requires additional platform-specific audio capture and packaging work.
| Technology | Role |
|---|---|
| Python 3.10+ | Application language and development runtime |
| Flet 1.0.4 | Desktop UI and event handling |
| NumPy | Audio buffers and numerical analysis |
| SciPy | Scientific-computing dependency |
| SoundDevice / PortAudio | Audio input and generated audio playback |
| Pydantic | Typed data models and validation |
| SQLite | Local player profiles, practice history, and progression |
| pytest | Automated tests |
| setuptools | Package and editable-install configuration |
| Inno Setup | Windows installer generation |
Runtime dependencies and Flet packaging metadata are declared in pyproject.toml.
The following tree shows the main application and release files on the current main branch. Generated build output, local environments, and user data are excluded.
Bragi/
├── .github/
│ └── workflows/
│ └── build.yml
├── installer.iss
├── src/
│ ├── assets/
│ │ ├── analytic_bg.png
│ │ ├── ear_trainer_bg.png
│ │ ├── home_bg.png
│ │ ├── trainer_bg.png
│ │ ├── tuner_bg.png
│ │ ├── icon.ico
│ │ ├── icon.png
│ │ ├── logo.ico
│ │ ├── logo.png
│ │ └── release-description.md
│ ├── main.py
│ ├── core/
│ │ ├── app_state.py
│ │ └── ear_training_session.py
│ ├── domain/
│ │ ├── chord_definitions.py
│ │ ├── chord_theory.py
│ │ ├── ear_training_engine.py
│ │ ├── gamification_policy.py
│ │ ├── instrument_definitions.py
│ │ ├── music_theory.py
│ │ ├── note_spelling.py
│ │ └── scale_definitions.py
│ ├── dsp/
│ │ ├── audio_engine.py
│ │ ├── chromagram.py
│ │ ├── pitch_tracker.py
│ │ └── sample_player.py
│ ├── storage/
│ │ ├── db_manager.py
│ │ └── path_utils.py
│ └── ui/
│ ├── app_shell.py
│ ├── components/
│ │ ├── header_nav.py
│ │ └── modals/
│ │ ├── active_recall_help_modal.py
│ │ ├── device_modal.py
│ │ ├── filter_modal.py
│ │ ├── hint_modal.py
│ │ ├── instrument_modal.py
│ │ ├── player_modal.py
│ │ └── timing_modal.py
│ └── views/
│ ├── analytics_view.py
│ ├── ear_training_view.py
│ ├── home_view.py
│ ├── trainer_view.py
│ └── tuner_view.py
├── tests/
│ ├── fixtures/
│ │ └── real_guitar/
│ │ └── low_e2.wav
│ ├── test_app_state.py
│ ├── test_audio_engine.py
│ ├── test_chord_definitions.py
│ ├── test_chord_theory.py
│ ├── test_db_manager.py
│ ├── test_ear_training_engine.py
│ ├── test_ear_training_session.py
│ ├── test_gamification_policy.py
│ ├── test_instrument_definitions.py
│ ├── test_music_theory.py
│ ├── test_note_spelling.py
│ ├── test_pitch_tracker.py
│ └── test_scale_definitions.py
├── analyze_guitar_test.py
├── record_guitar_test.py
├── pyproject.toml
├── .gitignore
└── README.md
| Area | Responsibility |
|---|---|
src/main.py |
Application entry point; initializes shared state, views, UI shell, and audio engine. |
src/core/ |
Shared application state, view selection, live pitch state, player switching, and progression events. |
src/domain/ |
Music theory, chord and scale definitions, note spelling, instrument configurations, and gamification rules. |
src/dsp/ |
Audio-device management, capture and processing pipeline, pitch tracking, chromagram analysis, and generated audio playback. |
src/storage/ |
SQLite access, multi-player persistence, schema migration, and platform-specific application-data paths. |
src/ui/ |
Flet application shell, navigation, feature views, and reusable dialogs. |
src/assets/ |
Application icons, logo assets, and per-view backgrounds. |
tests/ |
Automated tests for application state, audio processing, theory, storage, instruments, and progression rules. |
| Root diagnostic scripts | Manual audio recording and guitar pitch-analysis utilities. |
The live audio path is separated from the Flet interface:
Audio Input Device
|
v
SoundDevice / PortAudio
|
v
Audio Callback
|
v
Bounded Audio Queue
|
v
Background DSP Worker
|
+--------------------------+
| |
v v
Autocorrelation Pitch FFT Chromagram
Tracker Analyzer
| |
v v
Live Note / Cents Active Pitch Classes
| |
+-------------+------------+
|
v
AppState
|
v
Flet UI Views
The PortAudio callback copies incoming samples into a bounded queue. A background worker maintains the rolling analysis buffer and runs pitch and chromagram analysis. Pitch updates are dispatched to the Flet event loop; the main DSP calculations are kept out of the audio callback.
AppState holds the active view, trainer mode, target information, live pitch result, timing preference, active player, instrument configuration, and progression state. Views subscribe to state notifications and refresh when relevant values change.
DatabaseManager stores player-scoped profiles, practice attempts, unlocked badges, Hero Boss progress, and instrument configurations in SQLite. Database migrations preserve legacy single-player progress when upgrading to the multi-player schema.
- Python 3.10 or newer.
- Git.
- An audio input device for live Trainer and Tuner features.
- A supported local audio backend. PortAudio availability and device behavior depend on the operating system and installed drivers.
git clone https://github.com/RunicAudio/Bragi.git
cd BragiWindows PowerShell
python -m venv .venv
.venv\Scripts\Activate.ps1macOS / Linux
python3 -m venv .venv
source .venv/bin/activateFrom the repository root:
python -m pip install --upgrade pip
python -m pip install -e .On Linux, SoundDevice may require PortAudio packages or development libraries supplied by the distribution.
Run the application from the repository root:
python src/main.pyThe application initializes its shared state and views, then starts the audio engine. Connect and configure an input device before using live-input exercises.
- Connect your instrument to an audio interface or supported audio input.
- Ensure the interface and its driver are available to the operating system.
- Launch Bragi.
- Open the audio-input device control in the header.
- Select an input device when it appears in the list.
- Play a note and verify that the live input level and pitch display respond.
| Setting | Starting point |
|---|---|
| Sample rate | Use the input device's native rate; 48 kHz is a suitable common setting. |
| Input | A direct instrument input or clean interface line/instrument input. |
| Input level | Strong enough for reliable analysis without clipping. |
| Signal | Prefer a clean, relatively noise-free signal for pitch exercises. |
Bragi requests mono input for its current live-analysis stream. The audio engine queries the selected device's default sample rate and tries that rate before attempting the alternate common rate.
Bragi uses pytest for automated regression testing.
Run the complete test suite from the repository root:
pytest -qRun an individual test module when working on a specific component:
pytest -q tests/test_ear_training_engine.py
pytest -q tests/test_ear_training_session.py
pytest -q tests/test_db_manager.py
pytest -q tests/test_pitch_tracker.pyThe real-guitar fixture at tests/fixtures/real_guitar/low_e2.wav supports testing against a recorded instrument signal. The root-level record_guitar_test.py and analyze_guitar_test.py scripts are manual diagnostic tools and are not part of the automated pytest suite.
Bragi is currently undergoing functional and usability testing before its first stable production release.
The completed Ear Training curriculum is included in this testing phase. Testing focuses on:
- Verifying question generation across all four difficulty levels.
- Checking interval, chord, inversion, and note recognition.
- Validating typed answers and accepted musical aliases in Active Recall.
- Confirming that answer formats and help instructions are clear.
- Checking audio playback, question replay, and response feedback.
- Verifying XP, accuracy, response-time tracking, and progression.
- Confirming that player-specific progress persists correctly in SQLite.
- Checking that changes do not introduce regressions elsewhere in the application.
Beta access currently allows testers to select every Ear Training level. This makes it possible to evaluate the complete curriculum without first satisfying progression milestones.
Automated tests verify application logic and expected behavior, but they do not replace manual testing of the actual application. UI behavior, audio playback, usability, and real-world exercise difficulty must also be evaluated during the Beta phase.
Latest verified local regression result: 1,087 tests passed on November 29, 2026.
The test count may change as new features and fixes are introduced. The full test suite should be run after significant changes and before publishing a release.
The GitHub release workflow runs the full pytest suite before attempting to package the Windows application.
Bragi stores player profiles, XP, practice history, unlocked badges, Hero Boss progress, and instrument configurations in a local SQLite database. The database path is managed by src/storage/path_utils.py.
| Platform | Application data directory |
|---|---|
| Windows | %USERPROFILE%\AppData\Roaming\Bragi (normally %APPDATA%\Bragi) |
| macOS | ~/Library/Application Support/Bragi |
| Linux / other Unix | ~/.config/Bragi |
The default database filename is bragi_progress.db. Local databases and user data should not be committed to the repository.
The following describes the implementation on main, rather than intended future behavior:
- Single-note validation: the Trainer displays the target string and note and checks the detected pitch/in-tune state. It does not independently confirm the physical string that produced the sound.
- Continuous pitch analysis: the pitch tracker analyzes rolling audio frames. A dedicated note-onset detector and robust idle-noise rejection are not yet implemented.
- Chord recognition: strummed-chord validation checks target pitch classes. It does not identify a complete guitar voicing, inversion, string assignment, or fret position.
- Arpeggio recognition: arpeggio mode checks accumulated pitch classes over a 2.5-second window. It does not yet validate note order, rhythmic accuracy, or a specific voicing.
- Ear-training scope: All four levels are implemented, including foundational pitch and interval recognition, harmonic intervals, chord qualities, compound intervals, chord voicings, inversions, and typed-answer Active Recall. The curriculum is undergoing Beta usability and functional testing.
- Ear-training analytics: attempt logging, progress persistence, and aggregate analytics are implemented in the database layer. A dedicated analytics interface remains pending.
- Ear-training audio: MIDI-based playback is implemented, but the current sound-generation system has not yet been upgraded to a high-quality sampled piano instrument.
- Tuning scope: the tuner is chromatic. It does not currently provide automatic string-by-string tuning plans or alternate-tuning workflows.
- Progression streak: the stored streak counts consecutive correct answers, not calendar days. The Analytics screen's current “days” label is inaccurate.
- Badge progression: 40 badge definitions are present, but unlock evaluation currently checks only a subset of badge IDs and conditions.
- Audio-device selection: the preferred device list is Windows-specific. Generic input enumeration and selection on Linux and macOS still need work.
- Platform packages: the current automated beta workflow publishes Windows x64 packages only. Linux/macOS packages and Android/iOS apps are not currently part of the release pipeline.
These limitations should be considered when interpreting exercise results and analytics.
- Keep real-time audio capture callbacks short; perform analysis in the background worker.
- Keep DSP algorithms in
src/dsp/and avoid coupling them to Flet controls. - Keep music-theory definitions and calculations in
src/domain/. - Keep shared application state and notifications in
src/core/app_state.py. - Keep database access and local data paths in
src/storage/. - Keep screen-specific presentation in
src/ui/views/and reusable UI elements insrc/ui/components/. - Add or update tests when changing behavior.
- Do not commit virtual environments, local databases, caches, or generated build output.
The repository includes two root-level utilities:
record_guitar_test.py— records an input stream for manual inspection.analyze_guitar_test.py— analyzes recorded guitar audio and reports pitch-detection results.
Use these scripts when investigating input-level, device, or pitch-tracking behavior.
No license has been added to the repository yet. Until a license is selected and committed, all rights remain with the copyright holder. Do not assume the repository is open source or that redistribution rights are granted beyond the terms explicitly stated by the copyright holder.