A real-time audio analysis application with automatic bird species detection, built in Python using PyQt5 and integrated with BirdNET.
- Real-time Audio Visualization: Live waveform and spectrogram visualizations
- Automatic Bird Species Identification: Detect bird species in real-time using BirdNET
- Detection Database: Store and manage bird detections with associated audio clips
- Audio Recording: Record and analyze audio from microphone input
- Multiple Visualization Options: Customizable spectrogram and waveform displays
- File Analysis: Load and analyze audio files
- Data Export: Export detection data to CSV for further analysis
- Location Tagging: Tag detections with geographic coordinates for mapping
- Python 3.9+ (3.10 or 3.11 recommended)
- PyAudio (for microphone access)
- PyQt5 (for the user interface)
- NumPy and SciPy (for signal processing)
- BirdNETlib package (for bird species detection)
- psutil (for memory monitoring)
-
Clone the repository:
git clone https://github.com/gddickinson/sound_analyzer.git cd sound_analyzer -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the required dependencies:
pip install -r requirements.txt -
Install BirdNET dependencies:
pip install birdnetlib resampy librosa psutil -
Run the application:
python main.py
The application has four main areas:
- Waveform Display: Shows the audio amplitude over time
- Spectrogram Display: Shows the frequency content of the audio
- BirdNET Plugin: Controls for bird detection settings and displays results
- Detection Database: Manages stored bird detections and audio clips
- Select your input device from the dropdown in the toolbar
- Click "Start Recording" to begin capturing audio
- The app will automatically analyze the audio for bird sounds
- Detected species will appear in the results table
- Click "Stop Recording" when finished
- Adjust the confidence threshold slider (lower values catch more species but with less certainty)
- Set the analysis interval (how often BirdNET analyzes the audio buffer)
- Set the detection window (the size of the audio segment analyzed each time)
- Enable location filtering by checking "Use Location for Species Filtering"
- Start recording to automatically detect bird species
- Use "Force Analysis Now" to immediately analyze the current audio buffer
- Use "Test With Bird Sound" to generate a test sound for verifying functionality
- All detections are automatically saved to the database with their audio clips
- Click "View Detections" to browse, filter, and play saved detections
- Export detections to CSV for analysis in other software
- Start a new recording session with the "Start New Session" button
- Delete unwanted or false detections through the detections browser
The config.yaml file contains settings for:
- Audio parameters: Sample rate, buffer size, FFT settings
- BirdNET settings: Confidence threshold, analysis interval, location
- UI preferences: Theme, window size
- Plugin settings: Enabled plugins and plugin-specific configurations
Customize these settings to optimize for your specific use case and hardware.
sound_analyzer/
├── core/ # Core functionality
│ ├── audio_capture.py # Audio input handling
│ ├── audio_processor.py # Audio processing utilities
│ └── plugin_manager.py # Plugin management system
├── data/ # Data storage
│ ├── audio_clips/ # Saved bird sound clips
│ └── detections.db # SQLite database file
├── gui/ # GUI components
│ ├── main_window.py # Main application window
│ ├── visualization.py # Visualization components
│ └── widgets/ # Reusable UI components
│ ├── spectrogram.py
│ └── waveform.py
├── plugins/ # Analysis plugins
│ ├── base_plugin.py # Base class for plugins
│ └── birdnet/ # BirdNET plugin
│ └── birdnet_plugin.py
├── utils/ # Utility functions
│ ├── config.py # Configuration handling
│ ├── detection_db.py # Database management
│ └── logging_setup.py # Logging configuration
├── logs/ # Log files
├── main.py # Application entry point
├── config.yaml # Configuration file
└── requirements.txt # Project dependencies
The application includes a SQLite database for storing and managing bird detections:
- Detection Metadata: Species, confidence, timestamp, location
- Audio Storage: Audio clips saved for each detection
- Session Management: Group detections into recording sessions
- Export Capabilities: Export detection data to CSV
- Filtering: Filter by species, confidence, date, or session
If you're not seeing any audio input:
- Check that your microphone is connected and working
- Select the correct input device from the dropdown
- Check system permissions for microphone access
- Try increasing the input volume
If BirdNET isn't detecting birds:
- Ensure you're in an environment with bird sounds
- Lower the confidence threshold (try 0.2 or lower for testing)
- Increase the detection window to 5-10 seconds
- Check if the audio level is too low (RMS value shown in the buffer display)
- Try the "Test With Bird Sound" button to verify functionality
If the visualizations aren't displaying properly:
- Check if PyQtGraph is installed correctly
- Make sure your graphics drivers are up to date
- Try reducing the window size if display is slow
If the application crashes:
- Check the log files in the
logsdirectory for error messages - Ensure you have enough available memory (at least 2GB free)
- Update all dependencies to the latest versions
- Try reducing the detection window size
- Close other memory-intensive applications
The BirdNET plugin can filter species based on geographic location and time of year:
- Enable location filtering in the BirdNET settings
- Set your latitude and longitude
- The system will prioritize species likely to be in your area during the current season
For better detection in different environments:
- Urban environments: Lower the confidence threshold to 0.1-0.2, as bird sounds may be mixed with noise
- Quiet natural settings: Raise the confidence threshold to 0.3-0.5 for higher accuracy
- Dawn chorus (many birds): Set a shorter analysis interval (1-2 seconds) to catch more species
- Single bird songs: Increase the detection window to 5-10 seconds for better species identification
Contributions are welcome! Please feel free to submit pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- BirdNET for the bird species identification algorithm
- PyQt5 for the GUI framework
- PyQtGraph for the visualization components
- The K. Lisa Yang Center for Conservation Bioacoustics at the Cornell Lab of Ornithology
Built with AI assistance from Claude (Anthropic).
