Skip to main content

Unit tests Pylint License: AGPL v3

Music Mood Analysis

This analysis tool extracts tempo and tonality from music using digital signal processing techniques to analyse the mood of a piece of music.

The tool comes with a graphical user interface, which may be used to select the file to be analysed, configure the analysis parameters, run the analysis and finally inspect the analysis results.

Screenshot of the analysis GUI

Getting started

To run the package, install it using pip, then run it using:

python -m pip install music_mood_analysis
python -m music_mood_analysis

Command line interface

The music analysis tool can also be used directly with its command line interface, bypassing the graphical interface completely:

usage: __main__.py [-h] [--tempo-analysis {fft,lmv}] [--chunk-size CHUNK_SIZE]
                   [--downsample DOWNSAMPLE] [--min-bps MIN_BPS]
                   [--max-bps MAX_BPS] [--lmv-decay LMV_DECAY]
                   filepath

positional arguments:
  filepath              The path to the audio file to be analysed

optional arguments:
  -h, --help            show this help message and exit
  --tempo-analysis {fft,lmv}, -t {fft,lmv}
                        The tempo analysis method to be used
  --chunk-size CHUNK_SIZE, -c CHUNK_SIZE
                        The size (in seconds) of audio data chunk to be
                        analysed at once
  --downsample DOWNSAMPLE, -d DOWNSAMPLE
                        The factor by which to downsample audio data during
                        analysis
  --min-bps MIN_BPS     The minimum amount of beats per second to be
                        considered during tempo analysis
  --max-bps MAX_BPS     The maximum amount of beats per second to be
                        considered during tempo analysis
  --lmv-decay LMV_DECAY
                        The amplitude decay of local maxima during lmv tempo
                        analysis

To bring up this help message, run:

python -m music_mood_analysis -h

Real-time

The tool used to be configured to be used in a real-time analysis setting for analysis of ambient music. In the current configuration of the script, this is currently not possible anymore; however, it should not be too hard to re-instate the real-time functionality if required.

The current configuration uses a .wav file to test the analysis functionality. It streams several data chunks per second from the file, which could be either be read from a file or be provided by a funnel script reading audio data directly from audio hardware. Such a script is not included in this repository, as it is hardware-specific.

Contributions

To contribute to this repository, please read the contribution guidelines.

Python

Written in Python 3.8.3.

License

This repository is open-source software available under the AGPL-3.0 License.

Contact

Please raise an issue for code changes. To reach out, please send an email to richard@baltrusch.net.

Metadata

Release files for music-mood-analysis 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for music-mood-analysis 1.0.5
File Size Uploaded
music_mood_analysis-1.0.5.tar.gz 30.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for music-mood-analysis 1.0.5
File Interpreter ABI Platform
music_mood_analysis-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 63.7 kB

Release files / music_mood_analysis-1.0.5.tar.gz

Download URL music_mood_analysis-1.0.5.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fa11b9a3c90b0ce2bbcd029b8a42078b9763a44aeab770d7ef815e906c263e5b
BLAKE2b-256 checksum
How to use checksums
495a0d23508e8e5dd7793365f20dda8996342e5c0c449c60d721d110fdbdc2bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release files / music_mood_analysis-1.0.5-py3-none-any.whl

Download URL music_mood_analysis-1.0.5-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bb8086bb07d37df60f5977f4b5701d1942ab9b855f9856de2232bd0bc21d3ab
BLAKE2b-256 checksum
How to use checksums
4fd1e6a199ec841c06b4304db984f72f868a8a138523006241587b98377a6b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page