On Sun, 7 Feb 2010, Philippe Hezaine wrote:
I'm looking for randomize Note On from a midi
file.
I have two way for sending this file, a standard file generated by
Lilypond or a text file by midicomp.
Here is an excert from midicomp file:
062:00:000 On ch=10 note=f#3 vol=105
063:-1:-576 Off ch=10 note=f#3 vol=64
063:-1:-384 On ch=10 note=f#3 vol=95
063:-1:-192 Off ch=10 note=f#3 vol=64
063:-1:000 On ch=10 note=f#3 vol=127
063:00:-576 Off ch=10 note=f#3 vol=64
068:00:000 On ch=10 note=f#3 vol=127
069:-1:-576 Off ch=10 note=f#3 vol=64
074:00:000 On ch=10 note=f#3 vol=127
074:00:192 Off ch=10 note=f#3 vol=64
074:00:384 On ch=10 note=f#3 vol=95
074:00:576 Off ch=10 note=f#3 vol=64
074:01:000 On ch=10 note=f#3 vol=105
074:01:192 Off ch=10 note=f#3 vol=64
I'm looking for randomizing the third column: 192 or -576...
between + or -3 units for instance. ( 000 is a special case)
Try the attached python filter and see how it suits you.
You can use it in a pipe like this:
$ cat that-data-quoted-above.txt | python timerander.py
However, if you're tryint to "humanize" the data, you might
consider replacing the line that has random.randint(min,
max) with something like:
c = int(c) + int(random.gauss(0.0, 1.0))
HTH,
Gabriel