In [1]:
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir) 

from __init__ import *
import mido
import time
import numpy as np
from notemidi import TrigNote, PitchBend, Polytouch, Aftertouch, stop
rtmidi = mido.Backend('mido.backends.rtmidi')
output = rtmidi.open_output(IACDriver)

In [2]:
TrigNote('C3', 60)
PitchBend(-1000)
time.sleep(2)
TrigNote('C3', 0)


C3
C3

In [3]:
# Pitch Bend

TrigNote('C3', 60)
tt = np.linspace(0, 10, 1000)
A = 8000
p = A * np.sin(1*tt)
p = p.astype('int')
for idx, pitch in enumerate(p):
    time.sleep(0.001)
    PitchBend(pitch)
TrigNote('C3', 0)


C3
C3

In [7]:
TrigNote('C3', 80)
time.sleep(1)
Aftertouch(20)
time.sleep(1)
Aftertouch(40)

TrigNote('C2', 0)


C3
C2

In [46]:
TrigNote('C3', 60)
time.sleep(0.5)
TrigNote('C3', 0)
TrigNote('C3', 30)
time.sleep(0.5)
TrigNote('C3', 0)


C3
C3
C3
C3

In [32]:
stop()

In [36]:
TrigNote('C3',60)
tt = np.linspace(0, 10, 1000)
A = 127
p = A/2 + A/2 * np.sin(1*tt)
p = p.astype('int')
for idx, vel in enumerate(p):
    time.sleep(.01)
    Aftertouch(vel, channel=1)
print('end')
TrigNote('C3',0)


C3
end
C3

In [ ]:
while True:
    assumptions = deduce(world)     
    idea = derive(assumptions)
    contradictions = 0
    for statement_1 in idea:
        for statement_2 in idea:
            if statement_1 == !statement_2:
                contradictions += 1
    idea.consistency = 1/contradictions
    if idea.consistency > best_idea.consistency:
        best_idea = idea    
    time.sleep()

In [ ]: