Python & Music: Performance question

David Asorey Álvarez forodejazz at yahoo.es
Mon Apr 7 09:49:41 EDT 2003


forodejazz at yahoo.es (David Asorey Álvarez) wrote in message news:
<1759581e.0304060218.164d4cd4 at posting.google.com>...
> Hello, group.
> 
> I'm developing a small music program, and I have some doubts.
> 
>  [...]

  Thanks to all.
  I've tried some test with the first version and there is not any
problem, even with thousands of notes:

class Note:
   def __init__(self, pitch, duration):
      self.pitch = pitch
      self.duration = duration
   def change_pitch(factor): pass
   def change_duration(factor): pass


if __name__ ==  '__main__':
    import time
    notes = []
    t1 = time.clock()
    for x in range(10000):
        notes.append(Note(x, x))
    t2 = time.clock()
    print t2 - t1

Pentium 800, 128 Ram, W2K: 0.16 s
Pentium 133, 40 Ram, Linux (woody): 1.67 s

For my purposes, this are acceptable values.

Again, thanks for your advices.

David




More information about the Python-list mailing list