From 85a178e802971bbbe7fb71633989c787070f7fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Przemys=C5=82aw=20Pluta?= Date: Mon, 6 Apr 2020 20:34:06 +0200 Subject: [PATCH] Create smnp.music.commands module --- modules/music-commands/build.gradle | 0 modules/music-commands/gradle.properties | 7 +++++++ .../kotlin/io/smnp/ext/audio/MusicCommandsModule.kt | 9 +++++++++ modules/music-commands/src/main/resources/main.mus | 12 ++++++++++++ settings.gradle | 1 + 5 files changed, 29 insertions(+) create mode 100644 modules/music-commands/build.gradle create mode 100644 modules/music-commands/gradle.properties create mode 100644 modules/music-commands/src/main/kotlin/io/smnp/ext/audio/MusicCommandsModule.kt create mode 100644 modules/music-commands/src/main/resources/main.mus diff --git a/modules/music-commands/build.gradle b/modules/music-commands/build.gradle new file mode 100644 index 0000000..e69de29 diff --git a/modules/music-commands/gradle.properties b/modules/music-commands/gradle.properties new file mode 100644 index 0000000..b37860a --- /dev/null +++ b/modules/music-commands/gradle.properties @@ -0,0 +1,7 @@ +version=0.0.1 + +pluginVersion=0.1 +pluginId=smnp.music.commands +pluginClass= +pluginProvider=Bartłomiej Pluta +pluginDependencies= \ No newline at end of file diff --git a/modules/music-commands/src/main/kotlin/io/smnp/ext/audio/MusicCommandsModule.kt b/modules/music-commands/src/main/kotlin/io/smnp/ext/audio/MusicCommandsModule.kt new file mode 100644 index 0000000..d39077f --- /dev/null +++ b/modules/music-commands/src/main/kotlin/io/smnp/ext/audio/MusicCommandsModule.kt @@ -0,0 +1,9 @@ +package io.smnp.ext.audio + +import io.smnp.ext.provider.LanguageModuleProvider +import org.pf4j.Extension + +@Extension +class MusicCommandsModule : LanguageModuleProvider("smnp.music.commands") { + override fun dependencies() = listOf("smnp.collection") +} \ No newline at end of file diff --git a/modules/music-commands/src/main/resources/main.mus b/modules/music-commands/src/main/resources/main.mus new file mode 100644 index 0000000..a166a9e --- /dev/null +++ b/modules/music-commands/src/main/resources/main.mus @@ -0,0 +1,12 @@ +function vel(value: float) { + return { velocity -> value }; +} + +function cresc(begin: float, end: float, ...notes: ) { + return cresc(begin, end, notes); +} + +function cresc(begin: float, end: float, notes: list) { + return (notes as (item, index) ^ [vel((index+1) * (end-begin)/notes.size + begin), item]).flatten(); +} + diff --git a/settings.gradle b/settings.gradle index 671dd52..dfd0510 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,4 +16,5 @@ include 'modules:music' include 'modules:math' include 'modules:mic' include 'modules:dsp' +include 'modules:music-commands' include 'modules:music-tools' \ No newline at end of file