OT: Celebrity advice (was: Advice to a Junior in High School?)

Anton Vredegoor anton at vredegoor.doge.nl
Sat Aug 30 13:32:35 CEST 2003


"Andrew Dalke" <adalke at mindspring.com> wrote:

>So I am not convinced that ID cards can make a government
>more efficient, or at least not all that much more efficient.

The problem is with how to measure efficiency. For example a factory
may produce goods with high efficiency, while neglecting costs
resulting from ecological damage to the environment. Not including
these and other factors into the efficiency measurement is highly
questionable.

>Chaining everyone to a stake on a limited line may make
>government potentially more efficient.  (Easy to track people
>down - don't need the change-of-address system for the postal
>service! - very hard to commit any crimes).  Doesn't mean
>it's a good idea.

Ask Michael Moore about this issue :-) (there was a documentary about
this on Dutch television some time ago, maybe it was shown on other
networks too at some other time?)

Anton

p.s. to make this thread more efficient I'm providing some code using
a mIDi-file interface that was posted here some time ago:

http://www.mxm.dk/technologies/pythonmidi/

-great work max- 

perhaps someone can improve my code that uses it, changing the notes
is one obvious way to do it :-P

import os
from MidiOutFile import MidiOutFile
from operator import add

class Track:
    
    def __init__(self,channel,instrument,volume):
        self.instrument = instrument
        self.channel = channel
        self.volume = volume
        self.notes = {}
        
    def addnote(self,start,note,duration=10):
        self.notes[start] = (note,start+duration)

def playtracks(tracks,out_file='midiout/my.mid'):
    midi_events = []
    for t in tracks:
        for start in t.notes:
            note,end = t.notes[start]
            midi_events.append((start,True,
                t.channel,t.instrument,note,t.volume))
            midi_events.append((end,False,t.channel,
                t.instrument,note,0))
    midi_events.sort()
    midi = MidiOutFile(out_file)
    midi.header()
    midi.start_of_track()
    t=0
    for event in midi_events:
        time,switch,channel,instrument,note,volume = event
        midi.update_time(time-t)
        t=time
        midi.patch_change(channel,instrument)
        midi.note_on(channel,note,volume)
    midi.update_time(0)
    midi.end_of_track()
    midi.eof()
    os.startfile(out_file)

def simpletrack(channel,instrument,timedelta,notes,volume):
    T = Track(channel,instrument,volume)
    for time,note in enumerate(notes):
        T.addnote(time*timedelta,note,100)
    return T
        
def test():
    f,n = 30,5
    L=[[55,67,70], [70,69],[64,60,62],[65,67],[64],[65,67,70],
        [69,74,64,65],[57,58,62],[57,58,53]]*2
    solonotes = reduce(add,L,[])
    basenotes = reduce(add,L[1:]+L[:1],[])
    drumnotes = [48,64,42,47,42,65]*3+[35,64,60,62]*3+\
        [48,64,42,47,42,65]*3+[35,64,54]*2
    solo = simpletrack(0,34,f,solonotes*n,127)
    drum = simpletrack(9,0,f,drumnotes*n,127)
    base = simpletrack(1,67,f,basenotes*n,127)
    playtracks([drum,base,solo])

if __name__=='__main__':
    test()




More information about the Python-list mailing list