Browse Source

Merge pull request #379 from fancycode/reduce_end_sound_volume

Reduce volume of "end1" sound by 50%.
pull/380/head
Joachim Bauch 9 years ago committed by GitHub
parent
commit
882b826674
  1. 14
      src/audio/_build.py
  2. BIN
      src/audio/sprite1.mp3
  3. BIN
      src/audio/sprite1.ogg
  4. BIN
      src/audio/sprite1.wav
  5. 40
      static/js/controllers/uicontroller.js
  6. BIN
      static/sounds/sprite1.mp3
  7. BIN
      static/sounds/sprite1.ogg

14
src/audio/_build.py

@ -1,5 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import audioop
import wave import wave
import os import os
import glob import glob
@ -9,6 +10,11 @@ import math
silenceDuration = 0.05 # Seconds of silence between merged files silenceDuration = 0.05 # Seconds of silence between merged files
outfile = "sprite1.wav" # Output file. Will be saved in the path below. 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"): def main(folder="./files"):
currentTime = 0 currentTime = 0
@ -18,7 +24,7 @@ def main(folder="./files"):
output = wave.open(outfile, 'wb') output = wave.open(outfile, 'wb')
# Loop through files in folder and append to outfile # 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 # Open file and get info
w = wave.open(infile, 'rb') w = wave.open(infile, 'rb')
@ -32,7 +38,11 @@ def main(folder="./files"):
silenceFrames = "".join(wave.struct.pack('h', item) for item in silenceData) silenceFrames = "".join(wave.struct.pack('h', item) for item in silenceData)
# Output sound + silence to file # 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) output.writeframes(silenceFrames)
w.close() w.close()

BIN
src/audio/sprite1.mp3

Binary file not shown.

BIN
src/audio/sprite1.ogg

Binary file not shown.

BIN
src/audio/sprite1.wav

Binary file not shown.

40
static/js/controllers/uicontroller.js

@ -103,29 +103,37 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'web
urls: ['sounds/sprite1.ogg', 'sounds/sprite1.mp3'], urls: ['sounds/sprite1.ogg', 'sounds/sprite1.mp3'],
sprite: { sprite: {
"connect1": [ "connect1": [
0, 0,
5179], 5179
],
"end1": [ "end1": [
12892, 5228,
6199], 6199
],
"entry1": [ "entry1": [
8387, 11476,
3000], 3000
],
"leaving1": [ "leaving1": [
5228, 14526,
2126], 2126
],
"message1": [ "message1": [
19140, 16701,
816], 816
],
"question1": [ "question1": [
20006, 17567,
3313], 3313
],
"ringtone1": [ "ringtone1": [
7403, 20929,
935], 935
],
"whistle1": [ "whistle1": [
11437, 21913,
1405] 1405
]
} }
}, null, { }, null, {
"ring": "whistle1", "ring": "whistle1",

BIN
static/sounds/sprite1.mp3

Binary file not shown.

BIN
static/sounds/sprite1.ogg

Binary file not shown.
Loading…
Cancel
Save