Exemple #1
0
    ### Cold == temperature 0
    ### Darkness == brightness 0.0
    ### Light == brightness, what is light? baby don't hurt me

    #### Each analyse add 1 unit to the total
    tmp_type_of_analyse = 2  # temperature, brightness

    #### How long should be the song?
    tmp_periods_to_play = 3

    tmp_temperature = colorToUse.temperature()
    tmp_max_luminosity = 1
    tmp_luminosity = colorToUse.brightness() * (1 / tmp_max_luminosity)
    tmp_emotion_levels = len(emotion_levels)
    tmp_emotion_unit = 100 / tmp_emotion_levels
    tmp_is_people = detector.hasFaces()

    #### Mood on a scale of -100..100 with 100:happy and -100:sad
    #### Add up of positive values
    mood_value = (tmp_temperature + tmp_luminosity) / tmp_type_of_analyse * 100
    # print(mood_value)

    # Make music !
    # sentiment = (mood_value / tmp_emotion_unit)
    sentiment = 0
    for i in range(0, tmp_emotion_levels + 1):
        if options_verbose:
            print("### Mood : ")
        if tmp_is_people:
            sentiment = 5
            if options_verbose: