SRC: Music Synthesizer written in 100% Python

Michal Wallace sabren at manifestation.com
Sun Aug 27 19:50:36 EDT 2000


Tyler,

This is cool! I don't have the ability to run it right this
second, but I look forward to checking it out.

A quick observation regarding style:

On Sun, 27 Aug 2000, Tyler Eaves wrote:

> def pitchhz(note):
>  if note=="A0":
>   return 13.75
>  if note=="A1":
>   return 27.5
>  if note=="A2":
>   return 55.0
>  if note=="A3":
>   return 110.0


how about something more along the lines of:

def pitchhz(note):
   return {
       "A0" : 13.75,
       "A1" : 27.5,
       "A2" : 55.0,
       ...
   }[note]

.. or even just do the calculation in real time based on 
the note and octave?

Cheers,

- Michal
------------------------------------------------------------------------
www.manifestation.com  www.sabren.com  www.linkwatcher.com  www.zike.net
------------------------------------------------------------------------








More information about the Python-list mailing list