Skip to content

Commit

Permalink
corrected parallel effects chain handling
Browse files Browse the repository at this point in the history
  • Loading branch information
prof-spock committed Sep 15, 2024
1 parent b365a88 commit 69f5130
Show file tree
Hide file tree
Showing 54 changed files with 14,738 additions and 560 deletions.
132 changes: 131 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,131 @@
# LilypondToBandVideoConverter
# LilypondToBandVideoConverter

## Introduction

The LilypondToBandVideoConverter is a python script that orchestrates
existing command line tools to convert a music piece written in the
lilypond notation to

- a *PDF score* of the whole piece,

- several *PDF voice extracts*,

- a *MIDI file with all voices* (with some preprocessing
applied for humanization),

- *audio mix files* with several subsets of voices (specified
by configuration), and

- *video files* for several output devices visualizing the
score notation pages and having the mixes as mutually
selectable audio tracks as backing tracks.

For processing a piece one must have

- a *lilypond fragment file* with the score information
containing specific lilypond identifiers, and

- a *configuration file* giving details like the voices
occuring in the piece, their associated midi instrument,
target audio volume, list of mutable voices for the audio
tracks etc.

Based on those files the python script -- together with some
open-source command-line software like ffmpeg or fluidsynth --
produces all the target files either incrementally or altogether.

The tool-chain has several processing phases that can be run as
required and produce the several outputs incrementally. The following
figure shows the phases and their results and how the phases depend on
each other.

![LilypondToBandVideoConverter phases](lilytobvc-flow.png)

The files (in yellow) are generated by the phases (in magenta), the
configuration file (in green) and the lilypond fragment file (in blue)
are the only manual inputs into the processing chain.

Those phases are:

- *extract:* generates PDF notation files for single voices as
extracts (might use compacted versions if specified),

- *score:* generates a single PDF file containing all voices as a
score,

- *midi:* generates a MIDI file containing all voices with specified
instruments, pan positions and volumes,

- *silentvideo:* generates (intermediate) silent videos containing
the score pages for several output video file kinds (with
configurable resolution and size),

- *rawaudio:* generates unprocessed (intermediate) audio files for
all the instrument voices from the midi tracks,

- *refinedaudio:* generates (intermediate) audio files for all the
instrument voices with additional audio processing applied,

- *mix:* generates final compressed audio files with submixes of all
instrument voices based on the refined audio files with a
specified volume balance and some subsequent mastering audio
processing (where the submix variants are configurable), and

- *finalvideo:* generates a final video file with all submixes as
selectable audio tracks and with a measure indication as subtitle

## Installation and Requirements

The script and its components are written in python and can be
installed as a single python package. The package requires either
Python 2.7 or Python 3.3 or later.

Additionally the following software has to be available:

- *[lilypond][]*: for generating the score pdf, voice
extract pdfs, the raw midi file and the score images used
in the video files,

- *[ffmpeg][]*: for video generation and video
postprocessing,

- *[fluidsynth][]*: for generation of voice audio files from
a midi file plus some soundfont (e.g. [FluidR3_GM.sf3][]),

- *[sox][]*: for instrument-specific postprocessing of audio
files for the target mix files as well as the mixdown,
and

Optionally the following software is also used:

- *[qaac][]*: the AAC-encoder for the final audio mix file
compression.

- *[mp4box][]*: the MP4 container packaging software

The location of all those commands as well as a few other
settings has to be defined in a global configuration file
for the LilypondToBandVideoConverter.

Installation is done from the PyPi repository via

pip install lilypondToBandVideoConverter

Make sure that the scripts directory of python is in the path for
executables on your platform.

## Further Information

A longer description is available [here][notation-video] and the
detailed manual is available [here].

[ffmpeg]: http://ffmpeg.org/
[FluidR3_GM.sf3]: https://github.com/musescore/MuseScore/raw/2.1/share/sound/FluidR3Mono_GM.sf3
[fluidsynth]: http://www.fluidsynth.org/
[here]: http://www.tensi.eu/thomas/iPod/lilypondToBandVideoConverter.pdf
[lilypond]: http://lilypond.org/
[lilypondFileSyntax]: http://tensi.eu/thomas
[mp4box]: https://gpac.wp.imt.fr/mp4box/mp4box-documentation/
[notation-video]: http://www.tensi.eu/thomas/iPod/notation-video.html
[qaac]: https://sites.google.com/site/qaacpage/
[sox]: http://sox.sourceforge.net/
100 changes: 70 additions & 30 deletions config/ltbvc-global.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
-- -*- mode: Conf; coding: utf-8-unix -*-
-- global configuration file for ltbvc.py and submodules
-- note that the paths defined here must be adapted for your local
-- configuration

-- #######################
-- # AUXILIARY VARIABLES #
-- #######################

_programDirectory = "C:/Programme_TT/Multimedia"
_programDirectory = "C:/Program Files/Multimedia"
_audioProgramDirectory = _programDirectory "/Audio"
_midiProgramDirectory = _programDirectory "/MIDI"
_videoProgramDirectory = _programDirectory "/Video"

_targetVideoDirectory = "C:/VideoDateien"
_targetVideoDirectory = "C:/Video Files"
_tempDirectory = "C:/temp"

-- path of directory for the soundfonts
_soundFontDirectoryPath = _midiProgramDirectory "/soundfonts"

_soundFonts = _soundFontDirectoryPath "/FluidR3_GM.SF2"

_soxTargetFormat="-b 32"

-- sox command
_soxCommand = \
_audioProgramDirectory "/sox/sox.exe --buffer 100000 --multi-threaded"

-- ###########################
-- # CONFIGURATION VARIABLES #
Expand All @@ -21,35 +35,46 @@ _targetVideoDirectory = "C:/VideoDateien"
-- ==============

-- location of aac encoder command (optional, otherwise ffmpeg is used)
aacCommandLine = _audioProgramDirectory \
"/QuicktimeAACEncoder/qaac64.exe" \
" -V100 -i $1 -o $2"
aacCommandLine = \
_audioProgramDirectory \
"/QuicktimeAACEncoder/qaac64.exe" " -V100 ${infile} -o ${outfile}"

-- location of ffmpeg command
ffmpegCommand = _videoProgramDirectory "/ffmpeg/bin/ffmpeg.exe"

-- location of fluidsynth command
fluidsynthCommand = _midiProgramDirectory "/QSynth/fluidsynth.exe"
-- complete midi to wav rendering command line
-- " -f " _tempDirectory "/fluidsynthsettings.txt"
midiToWavRenderingCommandLine = \
_midiProgramDirectory "/QSynth/fluidsynth.exe -n -i -g 1" \
" -R 0" \
" -F ${outfile} " _soundFonts " ${infile}"

-- location of lilypond command
lilypondCommand = _midiProgramDirectory "/LilyPond/usr/bin/lilypond.exe"

-- location of mp4box command
mp4boxCommand = _videoProgramDirectory "/MP4Box/mp4box.exe"

-- location of sox command
soxCommandLinePrefix = _audioProgramDirectory "/sox/sox.exe" \
" --buffer 100000 --multi-threaded"
-- audio processing command lines
audioProcessor = "{" \
"mixingCommandLine:" \
"'" _soxCommand " -m [-v ${factor} ${infile} ] "\
_soxTargetFormat " ${outfile}' ," \
"amplificationEffect: 'gain ${amplificationLevel}'," \
"paddingCommandLine:" \
"'" _soxCommand " ${infile} " \
_soxTargetFormat " ${outfile} pad ${duration}' ," \
"refinementCommandLine:" \
"'" _soxCommand " ${infile} " \
_soxTargetFormat " ${outfile} ${effects}'" \
"}"

-- ======================
-- === FILE LOCATIONS ===
-- ======================

-- path of file containing the processing log
loggingFilePath = "/temp/logs/lilypondToBandVideoConverter.log"

-- path of directory for the soundfonts
soundFontDirectoryPath = _midiProgramDirectory "/soundfonts"
loggingFilePath = _tempDirectory "/logs/lilypondToBandVideoConverter.log"

-- path of directory where all generated files go
targetDirectoryPath = "generated"
Expand All @@ -58,7 +83,7 @@ targetDirectoryPath = "generated"
intermediateFileDirectoryPath = "temp"

-- path of directory for temporary audio files
tempAudioDirectoryPath = "/temp/MIDI-Rendering-Demo/_current"
tempAudioDirectoryPath = _tempDirectory "/MIDI-Rendering-Demo/_current"

-- path of temporary lilypond file
tempLilypondFilePath = "temp/temp.ly"
Expand All @@ -76,9 +101,10 @@ tempLilypondFilePath = "temp/temp.ly"
-- defines video scaling factor for antialiasing and frame rate for
-- the target video

_directoryA = "'" _targetVideoDirectory "/_ipod-Videos'"
_directoryB = "'" _targetVideoDirectory "/Notenvideos'"
_directoryA = "'" _targetVideoDirectory "/_ipad_videos'"
_directoryB = "'" _targetVideoDirectory "/_ipod_videos-temp'"
_directoryC = "'" _targetVideoDirectory "/_internet-Videos'"
_directoryD = "'" _targetVideoDirectory "/_notation_videos'"
-- subtitleColor = 0X8800FFFF
_subtitleColor = "2281766911"

Expand All @@ -98,14 +124,15 @@ videoTargetMap = "{" \
" subtitleFontSize: 20," \
" subtitlesAreHardcoded: true }," \
\
"lumia: { resolution: 282," \
" height: 770," \
" width: 1280," \
" topBottomMargin: 3," \
" leftRightMargin: 5," \
"ipod: { resolution: 163," \
" height: 240," \
" width: 320," \
" topBottomMargin: 2," \
" leftRightMargin: 2," \
" scalingFactor: 4," \
" frameRate: 10.0," \
" systemSize: 15," \
" systemSize: 10," \
" mediaType: 'Movie'," \
" subtitleColor: " _subtitleColor "," \
" subtitleFontSize: 30," \
" subtitlesAreHardcoded: true }," \
Expand All @@ -120,6 +147,18 @@ videoTargetMap = "{" \
" systemSize: 25," \
" subtitleColor: " _subtitleColor "," \
" subtitleFontSize: 20," \
" subtitlesAreHardcoded: true }," \
\
"lumia: { resolution: 282," \
" height: 770," \
" width: 1280," \
" topBottomMargin: 3," \
" leftRightMargin: 5," \
" scalingFactor: 4," \
" frameRate: 10.0," \
" systemSize: 15," \
" subtitleColor: " _subtitleColor "," \
" subtitleFontSize: 30," \
" subtitlesAreHardcoded: true }" \
"}"

Expand All @@ -131,23 +170,24 @@ videoFileKindMap = "{" \
" fileNameSuffix: '-i-v'," \
" voiceNameList: 'vocals' }," \
\
"lumia: { target: lumia," \
"ipod: { target: ipod," \
" directoryPath: " _directoryB "," \
" fileNameSuffix: '-l-h'," \
" fileNameSuffix: '-i-h'," \
" voiceNameList: 'vocals' }," \
\
"internet: { target: internet," \
" directoryPath: " _directoryC "," \
" fileNameSuffix: '-n-h'," \
" voiceNameList: 'vocals' }," \
\
"lumia: { target: lumia," \
" directoryPath: " _directoryD "," \
" fileNameSuffix: '-l-h'," \
" voiceNameList: 'vocals' }" \
"}"

-- ============
-- === MISC ===
-- ============

-- comma-separated list of soundfont names (all located in soundfont
-- directory)
-- "FluidR3_GM.SF2"

soundFontNames = "FluidR3_GM.SF2, Ultimate_Drums.sf2"
lilypondVersion = "2.19.82"
Loading

0 comments on commit 69f5130

Please sign in to comment.