Clemylia / Musica2

huggingface.co
Total runs: 71
24-hour runs: 0
7-day runs: 5
30-day runs: 71
Model's Last Updated: November 14 2025
audio-classification

Introduction of Musica2

Model Details of Musica2

đŸŽŒ Musica2 : DĂ©tection de Rythme Audio (CalĂ© ou DĂ©calĂ©)

Musica

🌟 PrĂ©sentation

Musica2 est un modÚle d'apprentissage profond conçu pour analyser un clip audio (chanson) et déterminer s'il est dans le rythme (calé) ou hors rythme (décalé) . Ce modÚle a été entraßné from scratch par Clemylia en utilisant la bibliothÚque Keras et TensorFlow .

🎯 Tñche et Classes
ID Label Description
0 Calé L'audio est bien aligné sur le rythme.
1 Décalé L'audio présente un désalignement ou un décalage rythmique.
⚙ Architecture et EntraĂźnement

Musica2 est un modÚle Convolutionnel 2D (CNN) , adapté à l'analyse d'images de spectrogrammes Mel, qui représentent la distribution de l'énergie audio dans le temps et la fréquence.

  • Framework d'EntraĂźnement : Keras (TensorFlow)
  • DonnĂ©es d'EntrĂ©e : Spectrogrammes Mel (reprĂ©sentation visuelle de l'audio).
đŸ“„ Comment Utiliser Musica2

Le modÚle est disponible en téléchargement et chargement direct depuis Hugging Face Hub en utilisant huggingface_hub et tensorflow/keras .

đŸ’» DĂ©pendances

Assurez-vous d'avoir installé les bibliothÚques nécessaires :

pip install tensorflow keras numpy librosa huggingface_hub
🐍 Code d'InfĂ©rence (Exemple)

Le code d'inférence fourni est la méthode stable pour utiliser Musica2. Il gÚre le téléchargement, le chargement, le prétraitement de l'audio et la prédiction.

ParamÚtres Clés
ParamĂštre Valeur Description
HF_REPO_ID "Clemylia/Musica2" Identifiant du dépÎt sur Hugging Face.
FULL_MODEL_FILENAME "musica2_complete_model.keras" Nom du fichier Keras complet.
SAMPLE_RATE 16000 Taux d'échantillonnage cible (Hz).
MAX_CLIP_DURATION 10 Durée maximale des clips audio traités (secondes).
N_MELS 128 Nombre de bandes Mel pour le spectrogramme.
đŸ› ïž Pipeline de PrĂ©traitement
  1. Chargement : L'audio est chargé.
  2. Rééchantillonnage : L'audio est rééchantillonné à $16000\text{ Hz}$.
  3. Tronquage/Padding : L'audio est tronqué ou complété pour atteindre exactement $10$ secondes.
  4. Spectrogramme Mel : Le spectrogramme Mel à $128$ bandes est calculé.
  5. Conversion Logarithmique : Conversion en décibels ( librosa.power_to_db ).
  6. Normalisation Z-Score : Le spectrogramme est normalisé à $\mu=0$ et $\sigma=1$ pour l'entrée du modÚle.

Note : Le modÚle attend une entrée de forme $(1, \text{Hauteur}, \text{Largeur}, 1)$, correspondant à un spectrogramme Mel normalisé.

📊 InterprĂ©tation des RĂ©sultats

Le modÚle effectue une prédiction binaire, retournant une probabilité $P$ entre $0.0$ et $1.0$ :

  • Si $P < 0.5$, le verdict est CalĂ© (Classe 0). La confiance est $1 - P$.
  • Si $P \ge 0.5$, le verdict est DĂ©calĂ© (Classe 1). La confiance est $P$.
⚠ Limitations et Avertissements
  • DurĂ©e du Clip : Le modĂšle est optimisĂ© pour des clips audio de 10 secondes . L'analyse d'un clip plus long ou plus court pourrait affecter la prĂ©cision.
  • QualitĂ© Audio : La performance peut ĂȘtre affectĂ©e par une mauvaise qualitĂ© d'enregistrement ou un bruit excessif.
  • DĂ©finition de Rythme : Le modĂšle a appris Ă  partir d'un ensemble de donnĂ©es spĂ©cifique ; sa gĂ©nĂ©ralisation Ă  des genres musicaux ou des dĂ©finitions de "rythme" trĂšs Ă©loignĂ©es peut varier.
đŸ€ Contribution et Contact

Pour toute question, suggestion ou collaboration, veuillez contacter Clemylia .

Exemple de code d'inférence fonctionnel

import tensorflow as tf
from tensorflow import keras
import numpy as np
import librosa
from huggingface_hub import hf_hub_download
import os
import warnings

warnings.filterwarnings('ignore', category=FutureWarning) 
warnings.filterwarnings('ignore', category=UserWarning)

# ----------------------------------------------------------------------------------
# PARTIE 1 : CONFIGURATION ET CHARGEMENT DU MODÈLE COMPLET
# ----------------------------------------------------------------------------------

# --- CONFIGURATION D'INFÉRENCE ---
SAMPLE_RATE = 16000     
MAX_CLIP_DURATION = 10
N_MELS = 128           

# >>> NOUVEAU NOM DE FICHIER DU MODÈLE COMPLET <<<
HF_REPO_ID = "Clemylia/Musica2"
FULL_MODEL_FILENAME = "musica2_complete_model.keras"

id_to_label = {0: "calé", 1: "décalé"} 
model = None # Initialisation

print(f"⏳ TĂ©lĂ©chargement et chargement du modĂšle complet depuis {HF_REPO_ID}...")

downloaded_model_path = None

try:
    # 1. Télécharger le fichier .keras complet
    downloaded_model_path = hf_hub_download(
        repo_id=HF_REPO_ID, 
        filename=FULL_MODEL_FILENAME,
        force_download=True
    )
    
    # 2. CHARGEMENT DU MODÈLE : Keras gÚre le fichier .keras complet en une seule fois
    model = keras.models.load_model(downloaded_model_path)
    
    print("✅ ModĂšle Musica2 chargĂ© et prĂȘt pour l'infĂ©rence.")

except Exception as e:
    print(f"❌ ERREUR FATALE DE CHARGEMENT DU MODÈLE COMPLET : {e}")
    print("Veuillez vérifier l'URL du dépÎt ou le nom du fichier du modÚle complet sur Hugging Face.")
    model = None

# ----------------------------------------------------------------------------------
# PARTIE 2 : FONCTION DE PRÉTRAITEMENT
# ----------------------------------------------------------------------------------

def preprocess_audio_for_inference(audio_path):
    """
    Pipeline de prétraitement pour l'audio.
    """
    if not os.path.exists(audio_path):
        raise FileNotFoundError(f"Fichier audio non trouvé à : {audio_path}")
        
    print(f"   -> Prétraitement de l'audio à : {audio_path}")
    
    audio_data, current_sr = librosa.load(audio_path, sr=None)
    
    if current_sr != SAMPLE_RATE:
        audio_data = librosa.resample(audio_data, orig_sr=current_sr, target_sr=SAMPLE_RATE)

    target_length = SAMPLE_RATE * MAX_CLIP_DURATION
    if len(audio_data) > target_length:
        audio_data = audio_data[:target_length]
    elif len(audio_data) < target_length:
        padding = target_length - len(audio_data)
        audio_data = np.pad(audio_data, (0, padding), 'constant')

    S = librosa.feature.melspectrogram(y=audio_data, sr=SAMPLE_RATE, n_mels=N_MELS)
    S_dB = librosa.power_to_db(S, ref=np.max)
    
    S_norm = (S_dB - np.mean(S_dB)) / np.std(S_dB)
    
    S_final = S_norm[np.newaxis, ..., np.newaxis].astype(np.float32)

    return S_final

# ----------------------------------------------------------------------------------
# PARTIE 3 : FONCTION DE PRÉDICTION ET EXÉCUTION
# ----------------------------------------------------------------------------------

def predict_rhythm(model, audio_file_path):
    """
    Effectue la prédiction et affiche le résultat.
    """
    if model is None:
        print("\n❌ Impossible de prĂ©dire : Le modĂšle n'a pas Ă©tĂ© chargĂ©.")
        return None, None
        
    try:
        input_features = preprocess_audio_for_inference(audio_file_path)
    except FileNotFoundError as e:
        print(f"\n⚠ {e}")
        return None, None
        
    print(f"\n🔬 DĂ©but de l'analyse pour le fichier : {audio_file_path}")
    
    # Prédiction
    probability = model.predict(input_features, verbose=0)[0][0]
    
    # Verdict
    predicted_id = int(probability >= 0.5) 
    predicted_label = id_to_label[predicted_id]
    
    # Confiance
    confidence = probability if predicted_id == 1 else (1.0 - probability)
    
    # Affichage
    print("\n--- Résultat de la Prédiction ---")
    print(f"Probabilité de 'Décalé' (Classe 1) : **{probability:.4f}**")
    print(f"Verdict : La musique est **{predicted_label.upper()}**")
    print(f"Confiance : {confidence:.2f}")
    
    return predicted_label, probability

## --- EXÉCUTION DU TEST ---

TEST_AUDIO_PATH = "cale-1.mp3"

predict_rhythm(model, TEST_AUDIO_PATH)

Runs of Clemylia Musica2 on huggingface.co

71
Total runs
0
24-hour runs
0
3-day runs
5
7-day runs
71
30-day runs

More Information About Musica2 huggingface.co Model

More Musica2 license Visit here:

https://choosealicense.com/licenses/mit

Musica2 huggingface.co

Musica2 huggingface.co is an AI model on huggingface.co that provides Musica2's model effect (), which can be used instantly with this Clemylia Musica2 model. huggingface.co supports a free trial of the Musica2 model, and also provides paid use of the Musica2. Support call Musica2 model through api, including Node.js, Python, http.

Clemylia Musica2 online free

Musica2 huggingface.co is an online trial and call api platform, which integrates Musica2's modeling effects, including api services, and provides a free online trial of Musica2, you can try Musica2 online for free by clicking the link below.

Clemylia Musica2 online free url in huggingface.co:

https://huggingface.co/Clemylia/Musica2

Musica2 install

Musica2 is an open source model from GitHub that offers a free installation service, and any user can find Musica2 on GitHub to install. At the same time, huggingface.co provides the effect of Musica2 install, users can directly use Musica2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Musica2 install url in huggingface.co:

https://huggingface.co/Clemylia/Musica2

Url of Musica2

Provider of Musica2 huggingface.co

Clemylia
ORGANIZATIONS

Other API from Clemylia

huggingface.co

Total runs: 439
Run Growth: 79
Growth Rate: 18.00%
Updated:September 29 2025
huggingface.co

Total runs: 364
Run Growth: 41
Growth Rate: 11.26%
Updated:October 30 2025
huggingface.co

Total runs: 316
Run Growth: 316
Growth Rate: 100.00%
Updated:December 02 2025
huggingface.co

Total runs: 263
Run Growth: 263
Growth Rate: 100.00%
Updated:November 05 2025
huggingface.co

Total runs: 214
Run Growth: 214
Growth Rate: 100.00%
Updated:November 23 2025
huggingface.co

Total runs: 197
Run Growth: 28
Growth Rate: 14.21%
Updated:October 30 2025
huggingface.co

Total runs: 168
Run Growth: 23
Growth Rate: 13.69%
Updated:October 19 2025
huggingface.co

Total runs: 162
Run Growth: 162
Growth Rate: 100.00%
Updated:October 07 2025
huggingface.co

Total runs: 162
Run Growth: 86
Growth Rate: 53.09%
Updated:November 05 2025
huggingface.co

Total runs: 131
Run Growth: 13
Growth Rate: 9.92%
Updated:October 03 2025
huggingface.co

Total runs: 127
Run Growth: 127
Growth Rate: 100.00%
Updated:November 26 2025
huggingface.co

Total runs: 126
Run Growth: 126
Growth Rate: 100.00%
Updated:November 27 2025
huggingface.co

Total runs: 106
Run Growth: 50
Growth Rate: 47.17%
Updated:November 29 2025
huggingface.co

Total runs: 97
Run Growth: 97
Growth Rate: 100.00%
Updated:November 05 2025
huggingface.co

Total runs: 94
Run Growth: 94
Growth Rate: 100.00%
Updated:November 17 2025
huggingface.co

Total runs: 85
Run Growth: 31
Growth Rate: 36.47%
Updated:November 13 2025
huggingface.co

Total runs: 84
Run Growth: -80
Growth Rate: -95.24%
Updated:December 01 2025
huggingface.co

Total runs: 81
Run Growth: 81
Growth Rate: 100.00%
Updated:November 23 2025
huggingface.co

Total runs: 71
Run Growth: 71
Growth Rate: 100.00%
Updated:November 29 2025
huggingface.co

Total runs: 67
Run Growth: 67
Growth Rate: 100.00%
Updated:December 06 2025
huggingface.co

Total runs: 61
Run Growth: 16
Growth Rate: 26.23%
Updated:November 08 2025
huggingface.co

Total runs: 57
Run Growth: 57
Growth Rate: 100.00%
Updated:November 30 2025
huggingface.co

Total runs: 55
Run Growth: 5
Growth Rate: 9.09%
Updated:November 14 2025
huggingface.co

Total runs: 54
Run Growth: 5
Growth Rate: 9.26%
Updated:November 09 2025
huggingface.co

Total runs: 54
Run Growth: 54
Growth Rate: 100.00%
Updated:November 14 2025
huggingface.co

Total runs: 52
Run Growth: 52
Growth Rate: 100.00%
Updated:November 15 2025
huggingface.co

Total runs: 46
Run Growth: 46
Growth Rate: 100.00%
Updated:November 30 2025
huggingface.co

Total runs: 42
Run Growth: -5
Growth Rate: -11.90%
Updated:November 18 2025
huggingface.co

Total runs: 37
Run Growth: 37
Growth Rate: 100.00%
Updated:November 14 2025
huggingface.co

Total runs: 36
Run Growth: 5
Growth Rate: 13.89%
Updated:November 14 2025
huggingface.co

Total runs: 32
Run Growth: 3
Growth Rate: 9.38%
Updated:December 06 2025
huggingface.co

Total runs: 26
Run Growth: 26
Growth Rate: 100.00%
Updated:October 11 2025
huggingface.co

Total runs: 24
Run Growth: -29
Growth Rate: -120.83%
Updated:November 26 2025
huggingface.co

Total runs: 22
Run Growth: 5
Growth Rate: 22.73%
Updated:September 24 2025
huggingface.co

Total runs: 17
Run Growth: 8
Growth Rate: 47.06%
Updated:December 19 2025
huggingface.co

Total runs: 16
Run Growth: 3
Growth Rate: 18.75%
Updated:February 02 2026
huggingface.co

Total runs: 14
Run Growth: 1
Growth Rate: 7.14%
Updated:January 20 2026
huggingface.co

Total runs: 12
Run Growth: 6
Growth Rate: 50.00%
Updated:September 25 2025
huggingface.co

Total runs: 12
Run Growth: 3
Growth Rate: 25.00%
Updated:January 07 2026
huggingface.co

Total runs: 10
Run Growth: 0
Growth Rate: 0.00%
Updated:October 28 2025
huggingface.co

Total runs: 10
Run Growth: 2
Growth Rate: 20.00%
Updated:October 12 2025
huggingface.co

Total runs: 8
Run Growth: 2
Growth Rate: 25.00%
Updated:September 27 2025
huggingface.co

Total runs: 7
Run Growth: -36
Growth Rate: -514.29%
Updated:November 04 2025
huggingface.co

Total runs: 6
Run Growth: 0
Growth Rate: 0.00%
Updated:January 17 2026
huggingface.co

Total runs: 5
Run Growth: -136
Growth Rate: -2720.00%
Updated:October 18 2025
huggingface.co

Total runs: 3
Run Growth: 3
Growth Rate: 100.00%
Updated:December 14 2025
huggingface.co

Total runs: 3
Run Growth: 2
Growth Rate: 66.67%
Updated:November 29 2025
huggingface.co

Total runs: 3
Run Growth: -2
Growth Rate: -66.67%
Updated:December 13 2025
huggingface.co

Total runs: 2
Run Growth: -6
Growth Rate: -300.00%
Updated:January 17 2026
huggingface.co

Total runs: 2
Run Growth: -2
Growth Rate: -100.00%
Updated:January 24 2026