uniqx avatar uniqx committed 1b56dba

live.py added for live experimenting

Comments (0)

Files changed (1)

algorithmic-oneline-music/live.py

+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#
+#           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+#                   Version 2, December 2004
+#
+#  Copyright (C) 2011 uniqx
+#   Metalab, 1010 Vienna, Austria
+#  Everyone is permitted to copy and distribute verbatim or modified
+#  copies of this license document, and changing it is allowed as long
+#  as the name is changed.
+#
+#             DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+#    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+#
+#   0. You just DO WHAT THE FUCK YOU WANT TO.
+#
+
+import sys
+import os
+import array
+import time
+
+if __name__ == '__main__':
+  
+  if len(sys.argv) == 2 and os.path.exists(sys.argv[1]):
+     
+    start_time = time.time()
+    t = 0
+    while True:
+      x = []
+      f = open(sys.argv[1],'r')
+      func_str = f.readline()
+      for tt in range(4000):
+        x.append( eval(func_str,None,{'t': 4000*t+tt}) % 256 )
+      
+      f.close()
+      
+      while time.time()-0.2 < start_time + t*(4000.0/8000.0):
+        time.sleep(0.01)
+      
+      sys.stdout.write(array.array('B',x).tostring())
+      
+      t += 1
+    
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.