From: Stefano Rivera Date: Sat, 17 May 2014 14:34:25 +0000 (+0200) Subject: We're generating single-channel sounds. Tell oggenc that X-Git-Tag: 0.1~96^2~4 X-Git-Url: https://git.ctpug.org.za/?p=naja.git;a=commitdiff_plain;h=55898b3dcd9938f2ced73157d57340dfaaee7075 We're generating single-channel sounds. Tell oggenc that --- diff --git a/data/sounds/__init__.py b/data/sounds/__init__.py index 48f3e20..5773cb3 100644 --- a/data/sounds/__init__.py +++ b/data/sounds/__init__.py @@ -5,34 +5,34 @@ from naja.gen_sound import Chunk, scale def grind(): - yield Chunk('sine', freq=100, length=0.01, volume=25) + yield Chunk('sine', freq=200, length=0.01, volume=25) tones = [] - for freq in (100, 150, 200, 350, 120, 170, 300): - tones.append(Chunk('sine', freq=freq, length=0.01, volume=25)) + for freq in (200, 300, 400, 700, 240, 340, 600): + tones.append(Chunk('sine', freq=freq, length=0.005, volume=25)) for i in range(75): yield random.choice(tones) - yield Chunk('sine', freq=100, length=0.01, volume=25) + yield Chunk('sine', freq=200, length=0.01, volume=25) SOUNDS = { 'chirp': scale(1650, 1449, -200, length=0.05, volume=50), 'error': Chunk('sine', freq=1000, length=0.25), 'grind': grind(), - 'shutdown': scale(800, 199, -200), + 'shutdown': scale(1600, 399, -400, length=0.1), 'silence': Chunk('silence', length=2), - 'startup': scale(200, 801, 200), - 'zoop': scale(500, 800, 20, length=0.01, volume=50), - 'zzzzz': Chunk('sine', freq=100, length=0.5, volume=50), + 'startup': scale(400, 1601, 400, length=0.1), + 'zoop': scale(1000, 1600, 40, length=0.005, volume=50), + 'zzzzz': Chunk('sine', freq=200, length=0.25, volume=50), 'yipee': itertools.chain( - scale(800, 1001, 50, length=0.1, volume=50), - scale(900, 1001, 50, length=0.1, volume=50), + scale(1400, 1801, 100, length=0.05, volume=50), + scale(1600, 1801, 100, length=0.05, volume=50), ), 'awwww': ( - Chunk('sine', freq=400, volume=50), - Chunk('sine', freq=250, length=0.5, volume=50), + Chunk('sine', freq=800, length=0.1, volume=50), + Chunk('sine', freq=500, length=0.2, volume=50), ), 'aha': ( - Chunk('sine', freq=1100, length=0.2, volume=50), - Chunk('sine', freq=1200, length=0.1, volume=50), + Chunk('sine', freq=2000, length=0.1, volume=50), + Chunk('sine', freq=2200, length=0.05, volume=50), ), } diff --git a/data/sounds/aha.ogg b/data/sounds/aha.ogg index 84b3d0b..49589e0 100644 Binary files a/data/sounds/aha.ogg and b/data/sounds/aha.ogg differ diff --git a/data/sounds/awwww.ogg b/data/sounds/awwww.ogg index 7e91d97..2ab41d9 100644 Binary files a/data/sounds/awwww.ogg and b/data/sounds/awwww.ogg differ diff --git a/data/sounds/chirp.ogg b/data/sounds/chirp.ogg index da5ef18..249d004 100644 Binary files a/data/sounds/chirp.ogg and b/data/sounds/chirp.ogg differ diff --git a/data/sounds/error.ogg b/data/sounds/error.ogg index ac62c6b..3200428 100644 Binary files a/data/sounds/error.ogg and b/data/sounds/error.ogg differ diff --git a/data/sounds/grind.ogg b/data/sounds/grind.ogg index 7fc1626..800e7b5 100644 Binary files a/data/sounds/grind.ogg and b/data/sounds/grind.ogg differ diff --git a/data/sounds/shutdown.ogg b/data/sounds/shutdown.ogg index c704890..6bd99a8 100644 Binary files a/data/sounds/shutdown.ogg and b/data/sounds/shutdown.ogg differ diff --git a/data/sounds/silence.ogg b/data/sounds/silence.ogg index 9675519..93bfcc8 100644 Binary files a/data/sounds/silence.ogg and b/data/sounds/silence.ogg differ diff --git a/data/sounds/startup.ogg b/data/sounds/startup.ogg index ad2f39b..0a4ca4f 100644 Binary files a/data/sounds/startup.ogg and b/data/sounds/startup.ogg differ diff --git a/data/sounds/yipee.ogg b/data/sounds/yipee.ogg index 4e2c4f2..d4930a7 100644 Binary files a/data/sounds/yipee.ogg and b/data/sounds/yipee.ogg differ diff --git a/data/sounds/zoop.ogg b/data/sounds/zoop.ogg index bee8aeb..eb28c59 100644 Binary files a/data/sounds/zoop.ogg and b/data/sounds/zoop.ogg differ diff --git a/data/sounds/zzzzz.ogg b/data/sounds/zzzzz.ogg index 2a185c1..cf61dc8 100644 Binary files a/data/sounds/zzzzz.ogg and b/data/sounds/zzzzz.ogg differ diff --git a/naja/gen_sound.py b/naja/gen_sound.py index 8ad0479..f324c8c 100644 --- a/naja/gen_sound.py +++ b/naja/gen_sound.py @@ -36,7 +36,7 @@ class Chunk(object): def raw(self): if self.type == 'silence': - for i in xrange(int(176400 * self.length)): + for i in xrange(int(88200 * self.length)): yield '\x00' if self.type == 'sine': diff --git a/tools/gen_sound.py b/tools/gen_sound.py index a852119..94bf3d1 100755 --- a/tools/gen_sound.py +++ b/tools/gen_sound.py @@ -13,7 +13,8 @@ def gen_raw(description): def encode(filename, data): print "Writing %s" % filename - p = Popen(('oggenc', '-o', filename, '--raw', '--quiet', '-'), + p = Popen(('oggenc', '-o', filename, '--raw', '--raw-chan=1', + '--quiet', '-'), stdin=PIPE, cwd='data/sounds') for blob in data: p.stdin.write(blob)