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 @@ @@ -1,5 +1,6 @@
#!/usr/bin/python
import audioop
import wave
import os
import glob
@ -9,6 +10,11 @@ import math @@ -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"): @@ -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"): @@ -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()

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 @@ -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",

BIN
static/sounds/sprite1.mp3

Binary file not shown.

BIN
static/sounds/sprite1.ogg

Binary file not shown.
Loading…
Cancel
Save