Coder Social home page Coder Social logo

color_your_music_mood's Introduction

color_your_music_mood

This demo records sound and - when music is detected - it estimates the underlying mood (emotion) and based on that it generates a respective color. If available, it can even set your Yeelight Bulb color (again based on the detected musical mood)

Checkout this hackernoon article for more details on the implemented methodology and experimentation

Image description

Video Demo

IMAGE ALT TEXT HERE

How it works

The basic steps of this demo are the following:

  1. Sound is recorded from the computer's microphone.
  2. Every 5 seconds, the recorded audio segment is fed as input to two music emotion classifiers:
    • Valence, that expresses if the emotion is negative or positive
    • Energy, that expresses how strong an emotion is
  3. Valence and Energy are represented in a 2D plane where Valence is the x-axis and Energy the y-axis.
  4. A set of predefined points and colors is used do build the 2D colorspace. This set is defined as follow:
    • each pair of (point, color) is used to "paint" the 2D colorspace
    • all intermediate points are painted using a normalized linear combination of the predefined colors (based on the intermediate points' eucledian distances from the predefined colors)
  5. The estimated Valence-Arousal pair for each 5-second music segment can be now represented with a particular color based on the 2D colored space.
  6. The same color can be used to illuminate the smart Yeelight Bulbs, if available.

Some details on the used classifiers

  • A music vs non-music classifier is applied as a first step
  • Estimation of music emotional energy and valence is achieved through a simple SVM model
  • The music classifiers have been trained on hand-crafted audio features, based on around 5000 audio training samples.
  • All trained models are included in this repo.

Dependencies

color_your_music_mood's People

Contributors

tyiannak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

color_your_music_mood's Issues

when I try to run your code , there is something wrong , do you know why?


AttributeError Traceback (most recent call last)
in
1 [clf_energy, mu_energy, std_energy, class_names_energy,mt_win_en, mt_step_en, st_win_en, st_step_en, _] = aT.load_model("energy")
2 fv_2 = (f_2[:, 0] - mu_energy) / std_energy
----> 3 [res_energy, p_en] = aT.classifier_wrapper(clf_energy, "svm_rbf", fv_2)
4 # win_class_energy = class_names_energy[int(res_energy)]

/data/miniconda2_python2.7/envs/py36_wy/lib/python3.6/site-packages/pyAudioAnalysis/audioTrainTest.py in classifier_wrapper(classifier, classifier_type, test_sample)
90 - model: regression model
91 - model_type: "svm" or "knn" (TODO)
---> 92 - test_sample: a feature vector (numpy array)
93 RETURNS:
94 - R: regression result (estimated value)

/data/miniconda2_python2.7/envs/py36_wy/lib/python3.6/site-packages/sklearn/svm/_base.py in predict(self, X)
583 """
584 check_is_fitted(self)
--> 585 if self.break_ties and self.decision_function_shape == 'ovo':
586 raise ValueError("break_ties must be False when "
587 "decision_function_shape is 'ovo'")

AttributeError: 'SVC' object has no attribute 'break_ties'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.