How sonic-visualiser/sonic-visualiser works
Project Type and Purpose
• Sonic Visualiser is a cross-platform desktop application used for visualising, annotating, and analysing audio files. It is primarily a multimedia tool with a graphical user interface built using Qt, combined with audio processing and plugin support.
• The README emphasizes its capabilities (waveform displays, spectrogram views, annotation features, feature-extraction plugins using Vamp, etc.) as well as its multi-platform nature (Linux, macOS, Windows) with separate build instructions and CI integrations.
Analyzing the File Structure
• Top-Level Directories/Files: The file tree shows multiple directories such as “main” (with the core UI and application code), “deploy” (platform-specific deployment and packaging scripts for Linux, macOS, and Windows), “i18n” (internationalization files), and “samples” and “templates” which provide sample data/configurations.
• Build Configuration: Files such as meson.build and meson_options.txt indicate that Meson is used as the build system. The presence of CI configuration files (e.g., in the .github/workflows directory and .appveyor.yml) further indicates automated builds/testing across different platforms.
Architectural Components
a. User Interface (Frontend):
• MainWindow, PreferencesDialog, Splash screen, and other GUI components built using Qt.
• Internationalisation support (i18n folder) that feeds strings and translations to the UI.
b. Audio Processing Core:
• Core routines handling audio file loading, waveform generation, spectrogram calculations, and annotations.
• Interaction with external libraries (FFTW3, libsndfile, PortAudio, etc.) and codecs to support various audio formats.
c. Plugin and Feature Extraction System:
• Interfaces for Vamp plugins and possibly LADSPA allowing feature extraction (e.g., beat tracking, pitch detection).
• Architecture should reflect extension points that allow integration of plugins.
d. OSC/Remote Control Interface:
• Communication module (OSCHandler.cpp) to support remote controlling of the application using the OSC protocol.
e. Deployment and Packaging Components:
• Directories under “deploy” show scripts and configuration details for packaging the application as AppImage, DEB packages on Linux, notarizing and signing on macOS, and various build scripts for Windows.
Relationships and Interactions
• The User Interface layer interacts with the core audio processing modules to display loaded audio and rendered visualisations (e.g., spectrogram and waveform views).
• The core audio engine, in turn, calls out to external libraries and plugins for specialised processing.
• The OSC component listens for and sends control messages to/from the UI and processing backend.
• Deployment components are somewhat orthogonal – they package the complete build into installable units, so you might represent them as enveloping the entire application to denote the build & distribution pipeline.
Architectural Patterns and Design Principles
• Modular Design: The separation between “main” (UI/logic), “deploy” (platform-specific packaging), “i18n” (translation), and “samples/templates” (example data) points toward a modular layout.
• Plugin/Extension Architecture: Support for Vamp and LADSPA plugins is central, so represent clear extension points.
• Cross-Platform Consideration: The build and deployment system is split for Linux, macOS, and Windows, so emphasize platform-specific adaptations in the deployment pipeline.