Move 'note' module
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import smnp.module.mic
|
import smnp.module.mic
|
||||||
|
import smnp.module.note
|
||||||
|
|
||||||
functions = [ *mic.functions ]
|
functions = [ *mic.functions, *note.functions ]
|
||||||
methods = [ *mic.methods ]
|
methods = [ *mic.methods, *note.methods ]
|
||||||
4
smnp/module/note/__init__.py
Normal file
4
smnp/module/note/__init__.py
Normal 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 ]
|
||||||
0
smnp/module/note/function/__init__.py
Normal file
0
smnp/module/note/function/__init__.py
Normal file
@@ -2,6 +2,7 @@ from smnp.library.model import Function
|
|||||||
from smnp.library.signature import signature, ofType
|
from smnp.library.signature import signature, ofType
|
||||||
from smnp.type.model import Type
|
from smnp.type.model import Type
|
||||||
|
|
||||||
|
|
||||||
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
|
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
|
||||||
def _function(env, note, duration):
|
def _function(env, note, duration):
|
||||||
return Type.note(note.value.withDuration(duration.value))
|
return Type.note(note.value.withDuration(duration.value))
|
||||||
@@ -2,6 +2,7 @@ from smnp.library.model import Function
|
|||||||
from smnp.library.signature import signature, ofType
|
from smnp.library.signature import signature, ofType
|
||||||
from smnp.type.model import Type
|
from smnp.type.model import Type
|
||||||
|
|
||||||
|
|
||||||
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
|
_signature = signature(ofType(Type.NOTE), ofType(Type.INTEGER))
|
||||||
def _function(env, note, octave):
|
def _function(env, note, octave):
|
||||||
return Type.note(note.value.withOctave(octave.value))
|
return Type.note(note.value.withOctave(octave.value))
|
||||||
@@ -3,6 +3,7 @@ from smnp.library.signature import varargSignature, ofTypes, listOf
|
|||||||
from smnp.note.model import Note
|
from smnp.note.model import Note
|
||||||
from smnp.type.model import Type
|
from smnp.type.model import Type
|
||||||
|
|
||||||
|
|
||||||
_signature1 = varargSignature(ofTypes(Type.NOTE, Type.INTEGER))
|
_signature1 = varargSignature(ofTypes(Type.NOTE, Type.INTEGER))
|
||||||
def _function1(env, vararg):
|
def _function1(env, vararg):
|
||||||
withoutPauses = [note.value for note in vararg if note.type == Type.NOTE]
|
withoutPauses = [note.value for note in vararg if note.type == Type.NOTE]
|
||||||
@@ -2,6 +2,7 @@ from smnp.library.model import CombinedFunction, Function
|
|||||||
from smnp.library.signature import varargSignature, ofTypes, listOf
|
from smnp.library.signature import varargSignature, ofTypes, listOf
|
||||||
from smnp.type.model import Type
|
from smnp.type.model import Type
|
||||||
|
|
||||||
|
|
||||||
_signature1 = varargSignature(ofTypes(Type.INTEGER, Type.NOTE), ofTypes(Type.INTEGER))
|
_signature1 = varargSignature(ofTypes(Type.INTEGER, Type.NOTE), ofTypes(Type.INTEGER))
|
||||||
def _function1(env, value, vararg):
|
def _function1(env, value, vararg):
|
||||||
transposed = [Type.note(arg.value.transpose(value.value)) if arg.type == Type.NOTE else arg for arg in vararg]
|
transposed = [Type.note(arg.value.transpose(value.value)) if arg.type == Type.NOTE else arg for arg in vararg]
|
||||||
@@ -2,6 +2,7 @@ from smnp.library.model import CombinedFunction, Function
|
|||||||
from smnp.library.signature import signature, listOf, ofTypes, varargSignature
|
from smnp.library.signature import signature, listOf, ofTypes, varargSignature
|
||||||
from smnp.type.model import Type
|
from smnp.type.model import Type
|
||||||
|
|
||||||
|
|
||||||
_signature1 = varargSignature(ofTypes(Type.NOTE), ofTypes(Type.INTEGER), ofTypes(Type.INTEGER))
|
_signature1 = varargSignature(ofTypes(Type.NOTE), ofTypes(Type.INTEGER), ofTypes(Type.INTEGER))
|
||||||
def _function1(env, n, m, vararg):
|
def _function1(env, n, m, vararg):
|
||||||
t = [Type.note(arg.value.withDuration(int(arg.value.duration * n.value / m.value))) for arg in vararg]
|
t = [Type.note(arg.value.withDuration(int(arg.value.duration * n.value / m.value))) for arg in vararg]
|
||||||
Reference in New Issue
Block a user