This is a project to test google cloud deployment of an audio-analysis function. It can also be run locally.
- Python 3.8+ installed on your system
- Audio files (MP3, WAV, FLAC, M4A, or AAC format)
python -m venv audio_analysis_env
# On Windows:
audio_analysis_env\Scripts\activate
# On macOS/Linux:
source audio_analysis_env/bin/activatepip install librosa numpy pathlibNote: librosa might take a few minutes to install as it has several dependencies including scipy, scikit-learn, and audio processing libraries.
Create a small test script to verify everything works:
import librosa
import numpy as np
print("All packages installed successfully!")- Prepare your audio files: Put some music files in a folder
- Run the script: Execute the Python script and enter your music folder path
- Check results: Look for the generated
audio_analysis_results.jsonfile
- Duration: Length of the track
- Tempo: Beats per minute (BPM)
- Estimated Key: Musical key (C, D, E, etc.)
- Spectral Centroid: Brightness indicator (higher = brighter sound)
- RMS Energy: Overall loudness/energy level
- Zero Crossing Rate: Measure of how "noisy" vs "tonal" the audio is
- MFCCs: Audio fingerprint (useful for similarity matching later)
- Energy Level: High/Medium/Low based on tempo and RMS
- Brightness: Bright/Balanced/Dark based on spectral content
- Rhythmic Stability: How consistent the rhythm is
{
"file_name": "example_song.mp3",
"duration_seconds": 240.5,
"tempo_bpm": 128.4,
"estimated_key": "C",
"mood_indicators": {
"energy_level": "High Energy",
"brightness": "Bright",
"rhythmic_stability": "Stable"
}
}Start with 3-5 songs from different genres to see how the analysis varies!