Create 'synth' function
This commit is contained in:
@@ -10,6 +10,7 @@ from smnp.library.function.octave import withOctave
|
|||||||
from smnp.library.function.rand import random
|
from smnp.library.function.rand import random
|
||||||
from smnp.library.function.semitones import semitones
|
from smnp.library.function.semitones import semitones
|
||||||
from smnp.library.function.sleep import sleep
|
from smnp.library.function.sleep import sleep
|
||||||
|
from smnp.library.function.synth import synth
|
||||||
from smnp.library.function.tuplet import tuplet
|
from smnp.library.function.tuplet import tuplet
|
||||||
from smnp.library.function.type import objectType
|
from smnp.library.function.type import objectType
|
||||||
|
|
||||||
@@ -26,7 +27,8 @@ def createEnvironment():
|
|||||||
flat,
|
flat,
|
||||||
wait,
|
wait,
|
||||||
random,
|
random,
|
||||||
tuplet
|
tuplet,
|
||||||
|
synth
|
||||||
]
|
]
|
||||||
|
|
||||||
methods = [
|
methods = [
|
||||||
|
|||||||
@@ -1,6 +1,28 @@
|
|||||||
|
from smnp.library.model import CombinedFunction, Function
|
||||||
|
from smnp.library.signature import varargSignature, ofTypes, listOf
|
||||||
|
from smnp.synth.player import playNotes
|
||||||
|
from smnp.type.model import Type
|
||||||
|
|
||||||
def synth(args, env):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def pause(args, env):
|
def _synth1(env, vararg):
|
||||||
pass
|
notes = [arg.value for arg in vararg]
|
||||||
|
bpm = env.findVariable('bpm')
|
||||||
|
playNotes(notes, bpm)
|
||||||
|
|
||||||
|
|
||||||
|
_sign1 = varargSignature(ofTypes(Type.NOTE, Type.INTEGER))
|
||||||
|
|
||||||
|
|
||||||
|
def _synth2(env, vararg):
|
||||||
|
for arg in vararg:
|
||||||
|
_synth1(env, arg.value)
|
||||||
|
|
||||||
|
|
||||||
|
_sign2 = varargSignature(listOf(Type.NOTE, Type.INTEGER))
|
||||||
|
|
||||||
|
|
||||||
|
synth = CombinedFunction(
|
||||||
|
'synth',
|
||||||
|
Function(_sign1, _synth1),
|
||||||
|
Function(_sign2, _synth2)
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user