コード例 #1
0
ファイル: nSTest01.py プロジェクト: jaakkopee/neuronSeq
                        duration=0.3,
                        channel=1,
                        activation=0.6,
                        addToCounter=0.00000000000000763,
                        threshold=1.0)
hihat = neuronSeq.NNote(id="Hihat",
                        note=42,
                        velocity=83,
                        duration=0.3,
                        channel=1,
                        activation=0.1,
                        addToCounter=0.000078,
                        threshold=1.0)

#Kick and snare evade each other, the tend not to play at the same time because of the negative weights in connections
drumConnection00 = neuronSeq.Connection(kick, snare, -0.111, -0.111)

#Hihat does not react to kick at all (weight 0.0). Kick dodges the hihat.
drumConnection01 = neuronSeq.Connection(kick, hihat, 0.0, -0.0000911)

#Snare and hihat do not like to play at the same time.
drumConnection02 = neuronSeq.Connection(snare, hihat, -0.1, -0.00000111)

#Bassline instruments (neurons).
bass01 = neuronSeq.NNote(id="Bass, note 1",
                         note=16,
                         duration=0.6933,
                         velocity=100,
                         channel=2,
                         activation=0.0,
                         addToCounter=0.0000113,
コード例 #2
0
ファイル: neuronSeqRun4.py プロジェクト: jaakkopee/neuronSeq
import neuronSeq
import time

kick = neuronSeq.NNote(note=36, duration=0.03, channel=1, velocity=127)
snare = neuronSeq.NNote(note=42, duration=0.03, channel=1, velocity=127)
hihat = neuronSeq.NNote(note=52, duration=0.06, channel=1, velocity=127)
syn01 = neuronSeq.NNote(note=32, duration=0.6, channel=2, velocity=127)
tempokick = neuronSeq.NNote(note=36, duration=0.03, channel=3, velocity=127)

kick.setNNParams(0.0, 0.0000092, 1.0)
snare.setNNParams(0.0, 0.000024, 1.0)
hihat.setNNParams(0.0, 0.000008, 1.0)
syn01.setNNParams(0.0, 0.00000016, 1.0)
tempokick.setNNParams(0.0, 0.0000064, 1.0)

conn01 = neuronSeq.Connection(kick, snare, -0.00002, -0.00002)
conn02 = neuronSeq.Connection(kick, hihat, -0.0000008, -0.0000008)
conn03 = neuronSeq.Connection(kick, syn01, 0.000008, 0.00008)
conn04 = neuronSeq.Connection(tempokick, kick, 0.000002, 0.000002)

conn01.start()
conn02.start()
conn03.start()
conn04.start()

time.sleep(120.0)

conn01.stopSeq()
conn02.stopSeq()
conn03.stopSeq()
conn04.stopSeq()
コード例 #3
0
                          duration=0.0000001,
                          channel=1,
                          activation=0.9,
                          addToCounter=0.0009,
                          threshold=19210.0)

somedrum = neuronSeq.NNote(id="somedrum",
                           note=39,
                           velocity=127,
                           duration=0.03,
                           channel=1,
                           activation=0.0009,
                           addToCounter=0.000009,
                           threshold=4825.0)

drumConnection00 = neuronSeq.Connection(kick, snare01, -0.0000000061009,
                                        -0.00614120000009)

drumConnection01 = neuronSeq.Connection(somedrum, snare01, 0.00005,
                                        -0.00614120000009)

drumConnection02 = neuronSeq.Connection(somedrum, kick, -0.0000000061009,
                                        -0.00614120000009)

drumConnection00.start()
drumConnection01.start()
drumConnection02.start()

playForSeconds(10)

drumConnection00.stopSeq()
drumConnection01.stopSeq()
コード例 #4
0
#The fundamental instruments (neurons eg. NNote-objects).
kick = neuronSeq.NNote(id="Kick",
                       note=36,
                       velocity=127,
                       duration=0.3,
                       channel=1,
                       activation=0.0,
                       addToCounter=0.00000009,
                       threshold=1920.0)
snare01 = neuronSeq.NNote(id="snare01",
                          note=42,
                          velocity=127,
                          duration=0.0000001,
                          channel=1,
                          activation=0.0,
                          addToCounter=0.00000009,
                          threshold=1920.0)

drumConnection00 = neuronSeq.Connection(kick, snare01, 0.0000000000009, 0.09)

drumConnection00.start()

playForSeconds(45)

drumConnection00.stopSeq()
drumConnection00.join()

time.sleep(2)

drumConnection00.cleanup()
コード例 #5
0
import neuronSeq
import time
import rtmidi

#an alias for the sleep-function of module time                                                                                                                                   
playForSeconds = time.sleep

#The fundamental instruments (neurons eg. NNote-objects).                                                   
kick = neuronSeq.NNote(id = "Kick", note = 36, velocity = 127, duration = 0.3, channel = 1, activation = 0.09, addToCounter = 0.09, threshold = 1920.0)
snare01 = neuronSeq.NNote(id = "snare01", note = 42, velocity = 127, duration = 0.0000001, channel = 1, activation = 0.9, addToCounter = 0.000009, threshold = 1920.0)

drumConnection00 = neuronSeq.Connection(kick, snare01, -0.0000000061009, -0.00614120000009)

drumConnection00.start()

playForSeconds(10)

drumConnection00.stopSeq()
drumConnection00.join()

time.sleep(2)

drumConnection00.cleanup()

コード例 #6
0
                            duration=0.8,
                            channel=2,
                            activation=0.2,
                            addToCounter=0.00000000006666,
                            threshold=93000.0)

somedrum = neuronSeq.NNote(id="somedrum",
                           note=39,
                           velocity=127,
                           duration=0.03,
                           channel=1,
                           activation=0.0009,
                           addToCounter=0.00000009,
                           threshold=14825.0)

drumConnection00 = neuronSeq.Connection(kick, snare01, -0.0000000061009,
                                        -0.000614120000009)

drumConnection01 = neuronSeq.Connection(somedrum, snare01, 1.0,
                                        -0.00614120000009)

drumConnection02 = neuronSeq.Connection(somedrum, kick, -0.000061009,
                                        -0.000614120000009)

hidastusConn00 = neuronSeq.Connection(hidastaja, kick, -0.05, -0.06)
hidastusConn01 = neuronSeq.Connection(hidastaja, snare01, -0.008, -0.012)

drumConnection00.start()
drumConnection01.start()
drumConnection02.start()

hidastusConn00.start()
コード例 #7
0
snare2 = neuronSeq.NNote(note=55, duration=0.03, velocity=127, channel=1)
hihat = neuronSeq.NNote(note=42, duration=0.03, velocity=64, channel=1)

#set neural network parameters
#    being: starting activation, activation increase per iteration
#                            and threshold
#The smaller the activation increase (addToCounter) -value,
#the slower the oscillation.
kick.setNNParams(0.1, 0.0001, 1.0)
snare.setNNParams(0.0, 0.0001, 1.0)
snare2.setNNParams(0.5, 0.0002, 1.8)
hihat.setNNParams(0.0, 0.0003, 1.9)

#two-way connections. +/- excites/inhibits
#+ results to simultaneous and - to alternating
conn1 = neuronSeq.Connection(kick, snare, 0.0000001, 0.0000001)
conn2 = neuronSeq.Connection(kick, snare2, 0.00000062, 0.000000199)
conn3 = neuronSeq.Connection(snare2, snare, 0.00000008, -0.00000023)

#one-way connections: set either weight to 0.0, other to >0.0
conn3_1 = neuronSeq.Connection(snare, snare2, 0.0000000001, 0.0)

#just playing with parameters
conn4 = neuronSeq.Connection(hihat, kick, -0.002, -0.001)
conn5 = neuronSeq.Connection(hihat, snare, 0.0002, -0.000001)

#Bassline on a new channel
bass01 = neuronSeq.NNote(note=16, duration=0.3, velocity=100, channel=2)
bass02 = neuronSeq.NNote(note=18, duration=0.3, velocity=100, channel=2)

bass01.setNNParams(0.0, 0.00001, 1.0)
コード例 #8
0
snare.setNNParams(0.0, 0.00000124, 1.0)
hihat.setNNParams(0.0, 0.0000008, 1.0)
syn01.setNNParams(0.0, 0.00000016, 1.0)
tempokick.setNNParams(0.0, 0.0000064, 1.0)

#new style
strings = neuronSeq.NNote(id="Strings",
                          note=72,
                          velocity=127,
                          duration=0.6,
                          channel=4,
                          activation=0.0,
                          addToCounter=0.0000019,
                          threshold=1.0)

conn01 = neuronSeq.Connection(kick, snare, 0.00002, -0.0000002)
conn02 = neuronSeq.Connection(kick, hihat, 0.000008, -0.00000008)
conn03 = neuronSeq.Connection(kick, syn01, 0.0000008, 0.0000008)
conn04 = neuronSeq.Connection(tempokick, kick, 0.000002, -0.000002)
conn05 = neuronSeq.Connection(syn01, strings, 0.000000001, -0.00000001)

conn01.start()
conn02.start()
conn03.start()
conn04.start()
conn05.start()

time.sleep(120.0)

conn01.stopSeq()
conn02.stopSeq()