Created
February 26, 2020 15:05
-
-
Save mattintosh4/339b865dc0d3f819a909cf1ba44e6764 to your computer and use it in GitHub Desktop.
AIきりたんラッパー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
set -u | |
neutrinoDir=${1} | |
shift | |
set -- -b "${1}" -s "${2}" -n "${3}" -m "${4}" -p "${5}" -f "${6}" | |
bundleIdentifier=com.github.mattintosh4.easywine | |
bundlePath=$(osascript -e $'use framework "AppKit"\non run argv\nPOSIX path of ((current application\'s NSWorkspace\'s sharedWorkspace()\'s URLForApplicationWithBundleIdentifier:(item 1 of argv)) as string)\nend run' -- ${bundleIdentifier}) | |
PATH=${bundlePath}Contents/Resources/wine/bin:/usr/bin:/bin/usr/sbin:/sbin | |
WINE=$(which nihonshu) | |
test -x "${WINE}" | |
export WINEPREFIX=${HOME}/Library/Caches/Wine/prefixes/default64 | |
export WINEDEBUG=-all | |
while getopts b:f:m:n:p:s: arg | |
do | |
case ${arg} in | |
b) | |
basename=${OPTARG} | |
;; | |
f) | |
formantShift=${OPTARG} | |
;; | |
m) | |
modelDir=${OPTARG} | |
;; | |
n) | |
numThreads=${OPTARG} | |
;; | |
p) | |
pitchShift=${OPTARG} | |
;; | |
s) | |
suffix=${OPTARG} | |
;; | |
esac | |
done | |
basename=${basename:-sample1} | |
numThreads=${numThreads:-0} | |
suffix=${suffix:-musicxml} | |
modelDir=${modelDir:-KIRITAN} | |
pitchShift=${pitchShift:-1.0} | |
formantShift=${formantShift:-1.0} | |
cd "${neutrinoDir}" | |
"${WINE}" bin/musicXMLtoLabel.exe \ | |
score/musicxml/${basename}.${suffix} \ | |
score/label/full/${basename}.lab \ | |
score/label/mono/${basename}.lab | |
# NEUTRINO - predict timing & acoustic features from label | |
# | |
# usage: | |
# NEUTRINO.exe full.lab timing.lab output.f0 output.mgc output.bap model_directory [option] | |
# options : description [default] | |
# -n i : number of parallel [MAX] | |
# -s : skip predict timing [off] | |
# -a : skip predict acoustic features [off] | |
# -t : view information [off] | |
"${WINE}" bin/NEUTRINO.exe \ | |
score/label/full/${basename}.lab \ | |
score/label/timing/${basename}.lab \ | |
output/${basename}.f0 \ | |
output/${basename}.mgc \ | |
output/${basename}.bap \ | |
model/${modelDir}/ \ | |
-n ${numThreads} -t | |
# WORLD - synthesis from f0, mgc, bap | |
# | |
# usage: | |
# WORLD.exe Input.f0 Input.mgc Input.bap [option] | |
# options: | |
# -s i : sampling rate (Hz) [48000] | |
# -f f : pitch shift (positive number) [1.0] | |
# -m f : formant shift (positive number) [1.0] | |
# -n i : number of parallel [MAX] | |
# -s i : hi-speed synthesis [0] | |
# -o name : output wav filename [output.wav] | |
# -t : view information [off] | |
"${WINE}" bin/WORLD.exe \ | |
output/${basename}.f0 \ | |
output/${basename}.mgc \ | |
output/${basename}.bap \ | |
-f ${pitchShift} \ | |
-m ${formantShift} \ | |
-o output/${basename}_syn.wav \ | |
-n ${numThreads} -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment