aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrissess <grissess@nexusg.org>2016-06-14 02:56:53 -0400
committerGrissess <grissess@nexusg.org>2016-06-14 02:56:53 -0400
commit2cb9c95ea18906258a4fc2df1fe229d191ae5e31 (patch)
treeb042131c201687b7de1523586fa226ff64e00c69
parentbb38c09530d7e66182c0db5205c15b143f3d5a9b (diff)
Bugfixes
-rw-r--r--broadcast.py2
-rw-r--r--client.py2
-rw-r--r--mkiv.py15
3 files changed, 10 insertions, 9 deletions
diff --git a/broadcast.py b/broadcast.py
index 1fcf5a8..91b4e71 100644
--- a/broadcast.py
+++ b/broadcast.py
@@ -473,7 +473,7 @@ for fname in args:
for note in nsq:
ttime = float(note.get('time'))
pitch = float(note.get('pitch')) + options.transpose
- ampl = float(note.get('ampl', note.get('vel', 127.0) / 127.0))
+ ampl = float(note.get('ampl', float(note.get('vel', 127.0)) / 127.0))
dur = factor*float(note.get('dur'))
while time.time() - BASETIME < factor*ttime:
self.wait_for(factor*ttime - (time.time() - BASETIME))
diff --git a/client.py b/client.py
index 1680017..766b639 100644
--- a/client.py
+++ b/client.py
@@ -355,7 +355,7 @@ while True:
elif pkt.cmd == CMD.PLAY:
dur = pkt.data[0]+pkt.data[1]/1000000.0
FREQ = pkt.data[2]
- AMP = MAX * (pkt.as_float(3))
+ AMP = MAX * max(min(pkt.as_float(3), 1.0), 0.0)
signal.setitimer(signal.ITIMER_REAL, dur)
elif pkt.cmd == CMD.CAPS:
data = [0] * 8
diff --git a/mkiv.py b/mkiv.py
index a3bc42a..e5d06a2 100644
--- a/mkiv.py
+++ b/mkiv.py
@@ -15,6 +15,7 @@ import midi
import sys
import os
import optparse
+import math
TRACKS = object()
PROGRAMS = object()
@@ -286,9 +287,9 @@ for fname in args:
ev_cnts[tidx][ev.channel] += 1
if options.verbose:
- print 'Track name, event count, final banks, bank changes, final programs, program changes:'
+ print 'Track name, event count, final banks, bank changes, final programs, program changes, final modwheel, modwheel changes:'
for tidx, tname in enumerate(tnames):
- print tidx, ':', tname, ',', ','.join(map(str, ev_cnts[tidx])), ',', ','.join(map(str, cur_bank[tidx])), ',', ','.join(map(str, chg_bank[tidx])), ',', ','.join(map(str, cur_prog[tidx])), ',', ','.join(map(str, chg_prog[tidx]))
+ print tidx, ':', tname, ',', ','.join(map(str, ev_cnts[tidx])), ',', ','.join(map(str, cur_bank[tidx])), ',', ','.join(map(str, chg_bank[tidx])), ',', ','.join(map(str, cur_prog[tidx])), ',', ','.join(map(str, chg_prog[tidx])), ',', ','.join(map(str, cur_mw[tidx])), ',', ','.join(map(str, chg_mw[tidx]))
print 'All programs observed:', progs
print 'Sorting events...'
@@ -324,9 +325,9 @@ for fname in args:
if modwheel is not None:
self.modwheel = modwheel
def Deactivate(self, mev):
- self.history.append(DurationEvent(self.active, self.realpitch, self.active.ev.velocity / 127.0, .abstime - self.active.abstime, self.modwheel))
+ self.history.append(DurationEvent(self.active, self.bentpitch, self.active.ev.velocity / 127.0, mev.abstime - self.active.abstime, self.modwheel))
self.active = None
- self.realpitch = None
+ self.bentpitch = None
def WouldDeactivate(self, mev):
if not self.IsActive():
return False
@@ -335,7 +336,7 @@ for fname in args:
if isinstance(mev.ev, midi.PitchWheelEvent):
return mev.tidx == self.active.tidx and mev.ev.channel == self.active.ev.channel
if isinstance(mev.ev, midi.ControlChangeEvent):
- return mev.tidx == self.active.tidx and mev.ev.channel = self.active.ev.channel
+ return mev.tidx == self.active.tidx and mev.ev.channel == self.active.ev.channel
raise TypeError('Tried to deactivate with bad type %r'%(type(mev.ev),))
class NSGroup(object):
@@ -434,7 +435,7 @@ for fname in args:
print ' Group %r:'%(group.name,)
for stream in group.streams:
print ' Stream: %r'%(stream.active,)
- elif options.modres <= 0 and isinstance(mev.ev, midi.ControlChangeEvent):
+ elif options.modres > 0 and isinstance(mev.ev, midi.ControlChangeEvent):
found = False
for group in notegroups:
for stream in group.streams:
@@ -476,7 +477,7 @@ for fname in args:
dt = 0.0
events = []
while dt < dev.duration:
- events.append(DurationEvent(dev, realpitch + options.modfdev * math.sin(options.modffreq * (dev.abstime + dt)), realamp + options.modadev * math.sin(options.modafreq * (dev.abstime + dt)), dev.duration, dev.modwheel))
+ events.append(DurationEvent(dev, realpitch + options.modfdev * math.sin(options.modffreq * (dev.abstime + dt)), realamp + options.modadev * (math.sin(options.modafreq * (dev.abstime + dt)) - 1.0) / 2.0, dev.duration, dev.modwheel))
dt += options.modres
ns.history[i:i+1] = events
i += len(events)