aliases:
intro_jonglacro:
file: "PIRATE_01-1-intro_jonglacro.mp3"
- name: Intro Jonglacro
jonglacro_suite:
file: "PIRATE_01-2-jonglacro_suite.mp3"
- name: Jonglacro suite
lancer_prisonniere:
file: "PIRATE_02-lancers_de_prisonniere.mp3"
- name: Lancer prisonnière
quete:
- file: "PIRATE_03-quete.mp3"
- name: Quête
+ file: "PIRATE_03-1-quete.mp3"
+ monstre:
+ file: "PIRATE_03-2-monstre.mp3"
entree_ondine:
file: "PIRATE_04-entree_ondine.mp3"
- name: Entrée Ondine
cour_ondine:
file: "PIRATE_05-cour_a_londine.mp3"
- name: Cour à l'Ondine
fouille_jonglage:
file: "PIRATE_07-fouille_jonglage.mp3"
- name: Fouille jonglage
liberation_prisonniere:
- file: "PIRATE_08-liberation_prisonniere.mp3"
- name: Libération prisonnière
+ file: "PIRATE_08-1-liberation_prisonniere.mp3"
+ paf:
+ file: "PIRATE_08-2-paf_tombe.mp3"
duo_pirate_ondine:
file: "PIRATE_09-duo_pirate_ondine.mp3"
- name: Duo pirate Ondine
trio_jalousie:
- file: "PIRATE_10-trios_jalousie.mp3"
- name: Trio Jalousie
+ file: "PIRATE_10-1-trios_jalousie.mp3"
+ coup:
+ file: "PIRATE_10-2-coup.mp3"
piquage_2_4:
file: "PIRATE_11-piquage_2_4.mp3"
- name: Piquage 2-4
baston:
file: "PIRATE_12-1-baston.mp3"
- name: Baston
baston_ascension:
file: "PIRATE_12-3-baston_ascension.mp3"
- name: Baston ascension
- bruit:
- file: "PIRATE_bruit.wav"
- name: Bruit
- paf:
- file: "PIRATE_paf.mp3"
- name: Paf
- coup:
- file: "PIRATE_coup.wav"
- name: Coup
+ volume: 50
ralenti:
file: "PIRATE_12-2-ralenti.mp3"
+
+music_properties:
+ "PIRATE_01-1-intro_jonglacro.mp3":
+ name: Intro Jonglacro
+ "PIRATE_01-2-jonglacro_suite.mp3":
+ name: Jonglacro suite
+ "PIRATE_02-lancers_de_prisonniere.mp3":
+ name: Lancer prisonnière
+ "PIRATE_03-1-quete.mp3":
+ name: Quête
+ "PIRATE_03-2-monstre.mp3":
+ name: Monstre
+ "PIRATE_04-entree_ondine.mp3":
+ name: Entrée Ondine
+ "PIRATE_05-cour_a_londine.mp3":
+ name: Cour à l'Ondine
+ "PIRATE_07-fouille_jonglage.mp3":
+ name: Fouille jonglage
+ "PIRATE_08-1-liberation_prisonniere.mp3":
+ name: Libération prisonnière
+ "PIRATE_08-2-paf_tombe.mp3":
+ name: Paf tombe
+ "PIRATE_09-duo_pirate_ondine.mp3":
+ name: Duo pirate Ondine
+ "PIRATE_10-1-trios_jalousie.mp3":
+ name: Trio Jalousie
+ "PIRATE_10-2-coup.mp3":
+ name: Coup
+ "PIRATE_11-piquage_2_4.mp3":
+ name: Piquage 2-4
+ "PIRATE_12-1-baston.mp3":
+ name: Baston
+ "PIRATE_12-3-baston_ascension.mp3":
+ name: Baston ascension
+ gain: 2
+ "PIRATE_12-2-ralenti.mp3":
name: Ralenti
key_properties:
'e':
- stop:
include: jonglacro_suite
- fade_out: 5
+ fade_out: 3
'r':
- play:
include: lancer_prisonniere
include: quete
value: 50
- play:
- include: bruit
+ include: monstre
- wait:
duration: 2
- volume:
'o':
- stop:
include: entree_ondine
- fade_out: 5
+ fade_out: 4
- wait:
- duration: 5
+ duration: 4
- play:
include: cour_ondine
'p':
- play:
include: liberation_prisonniere
'f':
- - volume:
- include: liberation_prisonniere
- value: 20
- play:
include: paf
+ - wait:
+ duration: 0.2
+ - volume:
+ include: liberation_prisonniere
+ value: 30
+
'g':
- stop:
include: liberation_prisonniere
include: duo_pirate_ondine
fade_out: 2
- wait:
- duration: 2
+ duration: 1.5
- play:
include: trio_jalousie
'k':
'm':
- stop:
include: piquage_2_4
- fade_out: 5
+ fade_out: 4
- wait:
- duration: 7
+ duration: 6
- play:
include: baston
'w':
- stop:
include: baston
- fade_out: 1
+ fade_out: 0.5
- wait:
- duration: 1
+ duration: 0.5
- play:
include: ralenti
'x':
- stop:
include: ralenti
- fade_out: 2
+ fade_out: 1.5
'c':
- play:
include: baston_ascension
+# - volume:
+# include: baston_ascension
+# value: 100
'v':
- stop:
include: baston_ascension
fade_out: 2
+# 'n':
+# - play:
+# include: baston_ascension
'ESC':
- stop: ~
- stop_all_actions: ~
if argument == 'file':
filename = action[action_name]['file']
if filename not in seen_files:
- if 'name' in action[action_name]:
- seen_files[filename] = MusicFile(filename, file_lock, channel_id, name = action[action_name]['name'])
+ if filename in config['music_properties']:
+ seen_files[filename] = MusicFile(
+ filename,
+ file_lock,
+ channel_id,
+ **config['music_properties'][filename])
else:
- seen_files[filename] = MusicFile(filename, file_lock, channel_id)
+ seen_files[filename] = MusicFile(
+ filename,
+ file_lock,
+ channel_id)
channel_id = channel_id + 1
action_args['music'] = seen_files[filename]
import threading
import pydub
import pygame
+import math
class MusicFile:
- def __init__(self, filename, lock, channel_id, name = None):
+ def __init__(self, filename, lock, channel_id, name = None, gain = 1):
self.filename = filename
self.channel_id = channel_id
self.name = name or filename
self.raw_data = None
+ self.gain = gain
self.loaded = False
self.flag_paused = False
def load_sound(self, lock):
lock.acquire()
print("Loading « {} »".format(self.name))
- audio_segment = pydub.AudioSegment.from_file(self.filename).set_frame_rate(44100)
+ volume_factor = 20 * math.log10(self.gain)
+ audio_segment = pydub.AudioSegment.from_file(self.filename).set_frame_rate(44100).apply_gain(volume_factor)
self.sound_duration = audio_segment.duration_seconds
self.raw_data = audio_segment.raw_data
print("Loaded « {} »".format(self.name))