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.2.tar.gz (7.3 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.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: musan-0.0.2.tar.gz
  • Upload date:
  • Size: 7.3 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.2.tar.gz
Algorithm Hash digest
SHA256 c2752bc3de4ad6480bfc61b3d8bd5730bbb240807e2fcaa2cecf458c048d338b
MD5 2966cd633b012ee0cd027d642f1b9b31
BLAKE2b-256 8bcccc671e4c289e13961040e8e383bb48c9339d3c03419d197b88cdfa5aebcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: musan-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2655ca80605dffb6ea33b085ec5b0886536e343c93590e104c2ae9d272c73094
MD5 cc93433ae66d5fc32161abb3e0c39bf0
BLAKE2b-256 9190a0d785fa9adbbe95bf01aa628b96602fa75d64719c11e32f2916bd7f0007

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