Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. from __future__ import division
  2. from math import sin,cos,tan,atan2,hypot,pi
  3. from gridlang import *
  4.  
  5. myprogram=grid({},
  6.      {
  7.          (0,0):amplifierglyph(1/12,None,None,1,1), #reduce input into semitones
  8.          (1,0):addglyph(-4,None,None,1,None),#4 semitones below input
  9.          (2,0):logglyph(2,None,None,1,None),#2^(input-4)
  10.          (3,0):flowglyph(None,None,None,1),
  11.          (0,1):logglyph(2,None,None,None,1),#2^(input+)
  12.          (1,1):amplifierglyph(6/12,1),#Sweep over 6 semitones
  13.          (2,1):circleglyph(0,y),
  14.          (3,1):amplifierglyph(pi*440/44100,1),#convert to 440hz pitch 44100hz samplerate
  15.          (0,2):amplifierglyph(pi*440/44100,None,None,1,None), #convert to 440hz pitch 44100hz samplerate
  16.          (1,2):circleglyph(0,None,None,y,None),
  17.          (2,2):traceglyph("wave"),
  18.            })
  19.  
  20. import matplotlib.pyplot as plt
  21.  
  22. o=[]
  23. for i in range(44100):  
  24.     myprogram.calculatepaths((0,0))
  25.     myprogram.pipein((0,0),-24)
  26.     o.append(myprogram.traces()["wave"])
  27.     myprogram.next()  
  28.  
  29. plt.plot(o)
  30. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement