diff --git a/src/audio/_build.py b/src/audio/_build.py index 63d670e2..f5a7051b 100755 --- a/src/audio/_build.py +++ b/src/audio/_build.py @@ -1,5 +1,6 @@ #!/usr/bin/python +import audioop import wave import os import glob @@ -9,6 +10,11 @@ import math silenceDuration = 0.05 # Seconds of silence between merged files outfile = "sprite1.wav" # Output file. Will be saved in the path below. +# Map containing volume adjustments for some of the files. +AUDIO_FACTORS = { + 'end1.wav': 0.5, +} + def main(folder="./files"): currentTime = 0 @@ -18,7 +24,7 @@ def main(folder="./files"): output = wave.open(outfile, 'wb') # Loop through files in folder and append to outfile - for i, infile in enumerate(glob.glob(os.path.join(folder, '*.wav'))): + for i, infile in enumerate(sorted(glob.glob(os.path.join(folder, '*.wav')))): # Open file and get info w = wave.open(infile, 'rb') @@ -32,7 +38,11 @@ def main(folder="./files"): silenceFrames = "".join(wave.struct.pack('h', item) for item in silenceData) # Output sound + silence to file - output.writeframes(w.readframes(w.getnframes())) + samples = w.readframes(w.getnframes()) + factor = AUDIO_FACTORS.get(os.path.basename(infile), None) + if factor is not None: + samples = audioop.mul(samples, w.getsampwidth(), factor) + output.writeframes(samples) output.writeframes(silenceFrames) w.close() diff --git a/src/audio/sprite1.mp3 b/src/audio/sprite1.mp3 index 45be868f..d965a27e 100644 Binary files a/src/audio/sprite1.mp3 and b/src/audio/sprite1.mp3 differ diff --git a/src/audio/sprite1.ogg b/src/audio/sprite1.ogg index 7ff04fd0..4a814feb 100644 Binary files a/src/audio/sprite1.ogg and b/src/audio/sprite1.ogg differ diff --git a/src/audio/sprite1.wav b/src/audio/sprite1.wav index 863336ff..d073f3e8 100644 Binary files a/src/audio/sprite1.wav and b/src/audio/sprite1.wav differ diff --git a/static/js/controllers/uicontroller.js b/static/js/controllers/uicontroller.js index 595dbd2c..36a9db8e 100644 --- a/static/js/controllers/uicontroller.js +++ b/static/js/controllers/uicontroller.js @@ -103,29 +103,37 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'web urls: ['sounds/sprite1.ogg', 'sounds/sprite1.mp3'], sprite: { "connect1": [ - 0, - 5179], + 0, + 5179 + ], "end1": [ - 12892, - 6199], + 5228, + 6199 + ], "entry1": [ - 8387, - 3000], + 11476, + 3000 + ], "leaving1": [ - 5228, - 2126], + 14526, + 2126 + ], "message1": [ - 19140, - 816], + 16701, + 816 + ], "question1": [ - 20006, - 3313], + 17567, + 3313 + ], "ringtone1": [ - 7403, - 935], + 20929, + 935 + ], "whistle1": [ - 11437, - 1405] + 21913, + 1405 + ] } }, null, { "ring": "whistle1", diff --git a/static/sounds/sprite1.mp3 b/static/sounds/sprite1.mp3 index 45be868f..d965a27e 100644 Binary files a/static/sounds/sprite1.mp3 and b/static/sounds/sprite1.mp3 differ diff --git a/static/sounds/sprite1.ogg b/static/sounds/sprite1.ogg index 7ff04fd0..4a814feb 100644 Binary files a/static/sounds/sprite1.ogg and b/static/sounds/sprite1.ogg differ