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.4.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.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: musan-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3e8ebbb345fc885521bb85b4e899c124893993c170dd893ef34d6674a3ea4e82
MD5 4e80813c6cb014ecccf2c89581175916
BLAKE2b-256 513bf4e767c96fae19f5373ec0642672d8dc999c0358a3e4f0889a9ab01b22f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: musan-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1f931aade680b0675b278e40846fb4f3fa70f3044ffcd8e12c6dfaa55a9a4b33
MD5 b061e86e8746324314cbe8a2049a3a0b
BLAKE2b-256 f638270d8791ac7b086a0253d4264605345cfefa2a04159b62d35ad487273f8e

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