#!/usr/bin/python """The Karplus-Strong string synthesis algorithm. This is intended as a challenge for PID control. """ import os def main(n=72): s = range(n) for i in range(2**14): s.append(s[-n] * .9 + s[-1] * .1) os.popen("aplay", "wb").writelines(map(chr, map(int, s))) if __name__ == '__main__': main()