Skip to main content

This is the module for work with mel-specs based music analitycs models

Project description

MUSAN LIBRARY

What is this?

The module allows you to work with music-sentiment-analisys models for happy/sad classification and relaxing/energetic classification tasks. Source code of models and how them were trained you can see in this repository. Library also provides methods to build and transform mel-spectrograms from the source audio file.

Quick Guide

Example of usage:

import musan
import io

with open(filename, 'rb') as f:
    mp3_bytes = f.read()
    mp3_bytes = io.BytesIO(mp3_bytes)

hs_model, re_model = musan.load_pretraned_models()
result = musan.predict(mp3_bytes, hs_model, re_model, verbose=True)

Output:

19.10.2025 18:20:00: spec shape: torch.Size([1, 96, 4096])
19.10.2025 18:20:01: prediction time: 0:00:00.291374; running on cpu
{'predict': 'happy', 'happy': 0.6612311005592346, 'sad': 0.3387688398361206, 'energetic': 0.649221658706665, 'relaxing': 0.35077834129333496}

You also can load and use only one model:

model_re = musan.load_pretraned_re_model()
result = musan.predict(mp3_bytes, model_re=re_model)

or

model_hs = musan.load_pretraned_hs_model()
result = musan.predict(mp3_bytes, model_hs=hs_model)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

musan-0.0.3.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

musan-0.0.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file musan-0.0.3.tar.gz.

File metadata

  • Download URL: musan-0.0.3.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for musan-0.0.3.tar.gz
Algorithm Hash digest
SHA256 26a80c47b547ecb76b476e395c9bec45662b131a346b1d05fbdccc0123a22e36
MD5 4f2b6cf9ad9aef8fc4262ad765edf973
BLAKE2b-256 162491979f65acdbdecff4b633d5bd8c08333f7f6f14819b0b971fc82a23d5c3

See more details on using hashes here.

File details

Details for the file musan-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: musan-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for musan-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6d94935ae3b1b7d245222bc0b366c065eb9dfbfa16c6a17b0c6d2385b48788b
MD5 c53fddf75f83bf43966974d5d8a5b635
BLAKE2b-256 c7a0db76faf0731e1afd452c3b0dfa85b9be9147292b6b11e9bb67287e380d6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page