Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import division
- from math import sin,cos,tan,atan2,hypot,pi
- from gridlang import *
- myprogram=grid({},
- {
- (0,0):amplifierglyph(1/12,None,None,1,1), #reduce input into semitones
- (1,0):addglyph(-4,None,None,1,None),#4 semitones below input
- (2,0):logglyph(2,None,None,1,None),#2^(input-4)
- (3,0):flowglyph(None,None,None,1),
- (0,1):logglyph(2,None,None,None,1),#2^(input+)
- (1,1):amplifierglyph(6/12,1),#Sweep over 6 semitones
- (2,1):circleglyph(0,y),
- (3,1):amplifierglyph(pi*440/44100,1),#convert to 440hz pitch 44100hz samplerate
- (0,2):amplifierglyph(pi*440/44100,None,None,1,None), #convert to 440hz pitch 44100hz samplerate
- (1,2):circleglyph(0,None,None,y,None),
- (2,2):traceglyph("wave"),
- })
- import matplotlib.pyplot as plt
- o=[]
- for i in range(44100):
- myprogram.calculatepaths((0,0))
- myprogram.pipein((0,0),-24)
- o.append(myprogram.traces()["wave"])
- myprogram.next()
- plt.plot(o)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement