Move 'note' module

This commit is contained in:
Bartłomiej Pluta
2019-07-09 22:09:10 +02:00
parent b91cc46d44
commit ef99c4d6e2
9 changed files with 12 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import smnp.module.mic
import smnp.module.note
functions = [ *mic.functions ]
methods = [ *mic.methods ]
functions = [ *mic.functions, *note.functions ]
methods = [ *mic.methods, *note.methods ]

View File

@@ -0,0 +1,4 @@
from smnp.module.note.function import tuplet, transpose, semitones, pause, octave, duration
functions = [ pause.function, semitones.function, transpose.function, tuplet.function ]
methods = [ duration.function, octave.function ]

View File

View File

@@ -2,6 +2,7 @@ from smnp.library.model import Function
from smnp.library.signature import signature, ofType
from smnp.type.model import Type
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
def _function(env, note, duration):
return Type.note(note.value.withDuration(duration.value))

View File

@@ -2,6 +2,7 @@ from smnp.library.model import Function
from smnp.library.signature import signature, ofType
from smnp.type.model import Type
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
def _function(env, note, octave):
return Type.note(note.value.withOctave(octave.value))

View File

@@ -3,6 +3,7 @@ from smnp.library.signature import varargSignature, ofTypes, listOf
from smnp.note.model import Note
from smnp.type.model import Type
_signature1 = varargSignature(ofTypes(Type.NOTE, Type.INTEGER))
def _function1(env, vararg):
withoutPauses = [note.value for note in vararg if note.type == Type.NOTE]

View File

@@ -2,6 +2,7 @@ from smnp.library.model import CombinedFunction, Function
from smnp.library.signature import varargSignature, ofTypes, listOf
from smnp.type.model import Type
_signature1 = varargSignature(ofTypes(Type.INTEGER, Type.NOTE), ofTypes(Type.INTEGER))
def _function1(env, value, vararg):
transposed = [Type.note(arg.value.transpose(value.value)) if arg.type == Type.NOTE else arg for arg in vararg]

View File

@@ -2,6 +2,7 @@ from smnp.library.model import CombinedFunction, Function
from smnp.library.signature import signature, listOf, ofTypes, varargSignature
from smnp.type.model import Type
_signature1 = varargSignature(ofTypes(Type.NOTE), ofTypes(Type.INTEGER), ofTypes(Type.INTEGER))
def _function1(env, n, m, vararg):
t = [Type.note(arg.value.withDuration(int(arg.value.duration * n.value / m.value))) for arg in vararg]