aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrissess <grissess@nexusg.org>2016-06-14 12:29:35 -0400
committerGrissess <grissess@nexusg.org>2016-06-14 12:29:35 -0400
commite385feff7e1e187a7c74ba2ea6261be46e3e157a (patch)
tree68927aa13971e6c294afbe5b22c3bccad0ec82b7
parent6dece0e714544e63fac5f08b2d3b7dcc50092321 (diff)
Fixed/broke a scaling parameter
-rw-r--r--client.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/client.py b/client.py
index 6f9937e..e33c228 100644
--- a/client.py
+++ b/client.py
@@ -294,14 +294,14 @@ def samps(freq, amp, phase, cnt):
global RATE
samps = [0]*cnt
for i in xrange(cnt):
- samps[i] = int(amp / float(STREAMS) * max(-1, min(1, options.volume*generator((phase + 2 * math.pi * freq * i / RATE) % (2*math.pi)))))
+ samps[i] = int(amp / math.sqrt(STREAMS) * max(-1, min(1, options.volume*generator((phase + 2 * math.pi * freq * i / RATE) % (2*math.pi)))))
return samps, (phase + 2 * math.pi * freq * cnt / RATE) % (2*math.pi)
def to_data(samps):
return struct.pack('i'*len(samps), *samps)
def mix(a, b):
- return [i + j for i, j in zip(a, b)]
+ return [min(MAX, max(MIN, i + j)) for i, j in zip(a, b)]
def gen_data(data, frames, tm, status):
global FREQS, PHASE, Z_SAMP, LAST_SAMP, LAST_SAMPLES
@@ -315,6 +315,7 @@ def gen_data(data, frames, tm, status):
if FREQ != 0:
if time.clock() > EXPIRATION:
FREQ = 0
+ FREQS[i] = 0
if FREQ == 0:
PHASES[i] = 0
if LAST_SAMP != 0: