From 9978e4ab0a1dad104409fef8143758bd387e5b4e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Jan 2017 13:45:10 +0100 Subject: [PATCH] Added dx7lv2sounds2preset: A script which creates manifest.ttl and presets.ttl. Added options to dx7sysex2lv2: "-b" (for adding bank-name to voice-name) and -n (for adding voice-number to voice-name). Smaller fixes. --- bin/dx7lv2sounds2preset | 99 +++++++++++++++++++++++++++++++++++++++++ bin/dx7sysex2lv2 | 54 +++++++++++++++++----- doc/mpb.txt | 3 ++ src/Makefile | 2 +- src/dexed.mk | 2 +- 5 files changed, 148 insertions(+), 12 deletions(-) create mode 100755 bin/dx7lv2sounds2preset diff --git a/bin/dx7lv2sounds2preset b/bin/dx7lv2sounds2preset new file mode 100755 index 0000000..d5363ab --- /dev/null +++ b/bin/dx7lv2sounds2preset @@ -0,0 +1,99 @@ +#!/usr/bin/perl +# +# dx7lv2sounds2preset - create a presets.ttl and add this to manifest.ttl for +# Dexed.lv2 - LV2 plugin +# +# This generator builds the presets-ttl and a suitable manifest.ttl +# +# (c) by H. Wirtz +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# + +open(MANIFEST,">manifest.ttl")||die("Cannot open manifest.ttl for writing: $!\n"); +print MANIFEST "\@prefix lv2: .\n"; +print MANIFEST "\@prefix pset: .\n"; +print MANIFEST "\@prefix rdfs: .\n"; +print MANIFEST "\@prefix ui: .\n"; +print MANIFEST "\@prefix mdap: .\n"; +print MANIFEST "\@prefix pset: .\n"; +print MANIFEST "\@prefix doap: .\n"; +print MANIFEST "\@prefix foaf: .\n"; +print MANIFEST "\n"; +print MANIFEST "\n"; +print MANIFEST " a lv2:Plugin, doap:Project, lv2:SynthPlugin ;\n"; +print MANIFEST " rdfs:seeAlso ;\n"; +print MANIFEST " rdfs:seeAlso .\n"; +print MANIFEST "\n"; + +open(PRESETS,">presets.ttl")||die("Cannot open presets.ttl for writing: $!\n"); +print PRESETS "\@prefix lv2: .\n"; +print PRESETS "\@prefix pset: .\n"; +print PRESETS "\@prefix rdfs: .\n"; +print PRESETS "\n"; + +while($voice=shift(@ARGV)) +{ + insert_data($voice); +} + +close(PRESETS); +close(MANIFEST); + +sub insert_data +{ + my($voice)=@_; + + open(M_VOICE,"<".$voice."/manifest.ttl")||die("Cannot open ".$voice."/manifest.ttl: $!\n"); + while($l=) + { + if($l=~/^\s*rdfs:label \"(.+)\"/) + { + $voice_name=$1 + } + elsif($l=~/\s*rdfs:seeAlso <(.+)>/) + { + $file=$1; + } + } + close(M_VOICE); + + if($voice_name eq "" || $file eq "") + { + print "Voice data for ".$voice."/manifest.ttl is not consistent\n"; + print "voice: [$voice_name] file: [$file]\n"; + return; + } + + print MANIFEST "\n"; + print MANIFEST " a pset:Preset ;\n"; + print MANIFEST " rdfs:label \"".$voice_name."\"\n"; + print MANIFEST " lv2:appliesTo ;\n"; + print MANIFEST " rdfs:seeAlso .\n"; + print MANIFEST "\n"; + + print PRESETS "\n"; + + open(VOICE,"<".$voice."/".$file)||die("Cannot open ".$voice."/".$file.": $!"); + while($l=) + { + next if($l=~/^\s*$/); + next if($l=~/^[^ ]/); + print PRESETS $l; + } + close(VOICE); + + print PRESETS "\n"; +} diff --git a/bin/dx7sysex2lv2 b/bin/dx7sysex2lv2 index 6bb8d8b..a831411 100755 --- a/bin/dx7sysex2lv2 +++ b/bin/dx7sysex2lv2 @@ -3,7 +3,7 @@ # dx7sysex2lv2presets - SysEx patchset to LV2 converter for # Dexed.lv2 - LV2 plugin # -# This generator builds the presets-ttl and a suitable manifest.ttl +# This generator converts DX7 SYSEX to LV2 suitable sounds for Dexed # # (c) by H. Wirtz # @@ -33,14 +33,34 @@ $LV2_BUNDLE_NAME="dexed.lv2"; $LV2_URI="https://github.com/dcoredump/".$LV2_BUNDLE_NAME; $LV2_INSTALL_PATH="/zynthian/zynthian-my-plugins/lv2"; +@CMD_OPTION=@ARGV; +while($option=shift(@CMD_OPTION)) +{ + if($option=~/^-(.+)\s*/) + { + if($1=~/b/i) + { + $option{'bank'}=1; + } + elsif($1=~/n/i) + { + $option{'voice_no'}=1; + } + } +} + while($SYSEX=shift(@ARGV)) { + next if($SYSEX=~/^-/); + $BANK=$SYSEX; $BANK=~s{.*/}{}; # removes path $BANK=~s{\.[^.]+$}{}; # removes extension $_LV2_BUNDLE_NAME="dexed_lv2"; + $voice_no=0; + open(SYSEX,"$DXSYX -y $SYSEX |") || die ("Cannot open \'$DXSYX -y $SYSEX\': $!"); while($s=) { @@ -51,6 +71,7 @@ while($SYSEX=shift(@ARGV)) if($s=~/^\s+voice_name:\s+(.+)\s*/) { my($voice)=$1; + $voice_no++; $voice=~s/\s+$//; # right trim my($voice_name)=$voice; $voice=~tr/[ %ยง&-*+\"\'`\!\$\%\?\/\<\>\[\]\^\{\}]\|/_/; @@ -63,13 +84,26 @@ while($SYSEX=shift(@ARGV)) $voice=~s/%7d/_/i; $voice=~s/%7c/_/i; + if(defined($option{'voice_no'}) && defined($option{'bank'})) + { + $voice=$BANK."__".$voice_no."__".$voice; + } + elsif(defined($option{'bank'})) + { + $voice=$BANK."__".$voice; + } + elsif(defined($option{'voice_no'})) + { + $voice=$voice_no."__".$voice; + } + if($deeaxe_voice) { print $deeaxe_voice " ] .\n"; close($deeaxe_voice); } - my($path)=$LV2_INSTALL_PATH."/".$_LV2_BUNDLE_NAME."-".$BANK."_".$voice.".lv2"; + my($path)=$LV2_INSTALL_PATH."/".$_LV2_BUNDLE_NAME."-".$voice.".lv2"; if(!-d $LV2_INSTALL_PATH) { @@ -80,11 +114,11 @@ while($SYSEX=shift(@ARGV)) mkdir($path) || die("Cannot create dir \'$path\':$!\n"); } - print "Writing ".$path."/".$BANK."_".$voice.".ttl\n"; + print "Writing ".$path."/".$voice.".ttl\n"; write_manifest($path,$voice); - open($deeaxe_voice,">".$path."/".$BANK."_".$voice.".ttl") || die ("Cannot open \'".$path."/".$BANK."_".$voice.".ttl\': $!"); + open($deeaxe_voice,">".$path."/".$voice.".ttl") || die ("Cannot open \'".$path."/".$voice.".ttl\': $!"); write_preset_header($voice,$voice_name); next; } @@ -117,11 +151,11 @@ sub write_preset_header print $deeaxe_voice "\@prefix state: .\n"; print $deeaxe_voice "\@prefix xsd: .\n"; print $deeaxe_voice "\n"; - #print $deeaxe_voice "<".$LV2_URI."#".$BANK."_".$voice.">\n"; + #print $deeaxe_voice "<".$LV2_URI."#".$voice.">\n"; print $deeaxe_voice "<>\n"; print $deeaxe_voice " a pset:Preset ;\n"; print $deeaxe_voice " lv2:appliesTo <".$LV2_URI."> ;\n"; - #print $deeaxe_voice " rdfs:label \"".$BANK."-".$voice_name."\" ;\n"; + #print $deeaxe_voice " rdfs:label \"".$voice_name."\" ;\n"; print $deeaxe_voice " lv2:port [\n"; print_lv2_port("cutoff","1.0"); print $deeaxe_voice " ] , [\n"; @@ -182,13 +216,13 @@ sub write_manifest print MANIFEST "\@prefix xsd: .\n"; print MANIFEST "\n"; - #print MANIFEST "<".$LV2_URI."#".$BANK."_".$voice.">\n"; - print MANIFEST "<".$BANK."_".$voice.".ttl>\n"; + #print MANIFEST "<".$LV2_URI."#".$voice.">\n"; + print MANIFEST "<".$voice.".ttl>\n"; print MANIFEST " lv2:appliesTo <".$LV2_URI."> ;\n"; #print MANIFEST " a pset:Bank $BANK ;\n"; print MANIFEST " a pset:Preset ;\n"; - print MANIFEST " rdfs:label \"".$BANK."-".$voice."\" ;\n"; - print MANIFEST " rdfs:seeAlso <".$BANK."_".$voice.".ttl> .\n"; + print MANIFEST " rdfs:label \"".$voice."\" ;\n"; + print MANIFEST " rdfs:seeAlso <".$voice.".ttl> .\n"; close(MANIFEST); } diff --git a/doc/mpb.txt b/doc/mpb.txt index c644593..e4334ec 100644 --- a/doc/mpb.txt +++ b/doc/mpb.txt @@ -2,6 +2,9 @@ docker pull moddevices/mod-plugin-builder docker run -ti --name mpb -p 9000:9000 -v ~/src/mod/local-mod-folder:/tmp/local-mod-folder moddevices/mod-plugin-builder docker start -i mpb +Create archive: +cd ~/mod-workdir/plugins/ +tar cvzf /tmp/local-mod-folder/dexed.lv2.tar.gz dexed.lv2 Install: curl http://web1.moddevices.com/shared/mod-loopswitch4.lv2.tar.gz | base64 | curl -F 'package=@-' http://192.168.51.1/sdk/install diff --git a/src/Makefile b/src/Makefile index 536f047..86ead0e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -68,7 +68,7 @@ endif all: $(BUNDLE) Makefile clean: Makefile - rm -f *.o *~ *.bak *.gch dexed_ttl.h *.so *.gch msfa/*.gch + rm -f *.o *~ *.bak *.gch *.so *.gch msfa/*.gch rm -rf $(BUNDLE) install: $(BUNDLE) diff --git a/src/dexed.mk b/src/dexed.mk index 4eef30a..1bed203 100644 --- a/src/dexed.mk +++ b/src/dexed.mk @@ -5,7 +5,7 @@ ###################################### DEXED_DEPENDENCIES = lvtk -DEXED_VERSION = e95b8626cd2a6a3175df5238ca4efb05e470e4ef +DEXED_VERSION = 9700333fbe2b1388963b32672c6966cf21fd6232 DEXED_BUNDLES = dexed.lv2 DEXED_SITE = $(call github,dcoredump,dexed,$(DEXED_VERSION)) DEXED_TARGET_MAKE = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) MOD=1