[beast/bug-433531: 7/9] Extended the test signal generator to produce signals with AD envelope.
- From: Stefan Westerfeld <stw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/bug-433531: 7/9] Extended the test signal generator to produce signals with AD envelope.
- Date: Sun, 25 Apr 2010 12:25:00 +0000 (UTC)
commit c15b5fa996f0a13ca7a30b52539e9bce4c5c8b18
Author: Stefan Westerfeld <stefan space twc de>
Date: Thu Mar 4 11:20:11 2010 +0100
Extended the test signal generator to produce signals with AD envelope.
tools/scripts/blip.py | 21 ++++++++++++++++++++-
tools/scripts/blip.sh | 12 ++++++++++++
2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/tools/scripts/blip.py b/tools/scripts/blip.py
index 8e73bf1..0ab4838 100755
--- a/tools/scripts/blip.py
+++ b/tools/scripts/blip.py
@@ -65,12 +65,31 @@ def repeat (block, n):
out.append (block[j])
return out
+def ad_envelope (block, attack): # attack in range 0 .. 1
+ out = array.array('f')
+ decay = 1.0 - attack
+ volume = 0
+ for i in range (len (block)):
+ pos = i * 1.0 / len (block)
+ if pos < attack:
+ volume += 1.0 / (attack * len (block))
+ else:
+ volume -= 1.0 / (decay * len (block))
+ out.append (block[i] * volume)
+ return out
+
out_psq = pseudo_square (48000, 440)
out_psq.tofile (open ("pseudo-square-440", "w"))
out_psaw = pseudo_saw (48000, 440)
out_psaw.tofile (open ("pseudo-saw-440", "w"))
-#out_psq_psaw = repeat (interleave (out_psq, out_psaw), 50)
out_psq_psaw = interleave (out_psq, out_psaw)
out_psq_psaw.tofile (open ("pseudo-stereo-440", "w"))
+
+out_psq_env = ad_envelope (repeat (pseudo_square (48000, 440), 50), 0.1)
+out_psq_env.tofile (open ("pseudo-square-env-440", "w"))
+
+out_pstereo_env = interleave (ad_envelope (repeat (pseudo_square (48000, 440), 50), 0.1),
+ ad_envelope (repeat (pseudo_saw (48000, 440), 50), 0.1))
+out_pstereo_env.tofile (open ("pseudo-stereo-env-440", "w"))
diff --git a/tools/scripts/blip.sh b/tools/scripts/blip.sh
index 56da855..08fa387 100755
--- a/tools/scripts/blip.sh
+++ b/tools/scripts/blip.sh
@@ -42,3 +42,15 @@ bsewavetool add-raw-chunk pseudo-stereo.bsewave -f 440.366972477 -F float -R 480
LOOP_END=216
bsewavetool xinfo pseudo-stereo.bsewave -f440.36 loop-type=jump loop-start=0 loop-end=$LOOP_END loop-count=1000000
bsewavetool xinfo pseudo-stereo.bsewave --wave play-type=adsr-wave-2
+
+rm pseudo-square-env.bsewave
+bsewavetool create pseudo-square-env.bsewave 1
+bsewavetool add-raw-chunk pseudo-square-env.bsewave -f 440.366972477 -F float -R 48000 pseudo-square-env-440
+bsewavetool xinfo pseudo-square-env.bsewave --wave play-type=plain-wave-1
+bsewavetool oggenc pseudo-square-env.bsewave
+
+rm pseudo-stereo-env.bsewave
+bsewavetool create pseudo-stereo-env.bsewave 2
+bsewavetool add-raw-chunk pseudo-stereo-env.bsewave -f 440.366972477 -F float -R 48000 pseudo-stereo-env-440
+bsewavetool xinfo pseudo-stereo-env.bsewave --wave play-type=plain-wave-2
+bsewavetool oggenc pseudo-stereo-env.bsewave
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]