Computer music project centered around Euterpea. The new batch processor automates orchestration in a sense - applying found SoundFont Instruments to songs and batch-producing sharable music files.
For more on music educational software and Euterpea, see https://www.euterpea.com and obtain its textbook Haskell School of Music.
All of Euterpea is available to the Haskell programming user for creating or transcribing, and playing, compositions. New Passages capability adds better control over dynamics within a song.
For the "production" end, download PCommand Windows 64-bit executable from Releases. Invoke it in an empty folder to start cold. It will prompt you to supply Midi files and SoundFonts to run a true batch job.
Have fun and be creative 🎵 with interesting sounds for your instruments. Study sampled sound content via batch processor reports.
- install https://www.haskell.org/ghcup/ to obtain cabal and ghc.
- clone this repository into a primary folder
- clone, beside that, https://github.com/georgefst/Euterpea2 (a fork of Euterpea avoiding build blockers).
- in primary folder, edit provided cabal.project to put in above path to Euterpea2 source
- "cabal build" to make PCommand (along with Parthenopea lib)
- takes input files from, and sends output files to, the runtime start directory
- some Euterpea-coded sample tunes are provided -- Beethoven's string quartet Opus 131 in C Sharp Minor, the opening fugue, showcases the use of Passages dynamics annotation.
- input:
- SoundFont files (*.sf2)
- MIDI files (*.mid and/or *.midi) to be rendered
- your Euterpean compositions
- output:
- music files (*.wav currently supported)
- report files
Listen to your new song files with initially generated Instrument mappings. Iterate and improve choices.
First of all, do collect many SoundFont files. The variety is breathtaking. And PCommand's capacity has been tested up to 500 SoundFont files totalling 46 GB 😲 !
The batch processor conducts tournaments to curate the most suitable mined Instruments. Stats and scores driving the result are printed out. Take a look at Tournament Report in Sample Reports.
Note that mixing unrelated SoundFont Instruments can sound off when played. But interesting anyway to listen to your tunes varying Instrument mappings.
Implements a wavetable type offline synthesizer. Wavetable because all SoundFont instruments are sample-based. Offline because rendering is not in real time.
The batch processor synth is written using Signal Functions ala Euterpea.
In Euterpea, filterLowPass and filterLowPassBW Signal Functions are sweepable, but neither provides resonance (Q). To address this lack, a new Signal Function was developed -- namely, a State Variable filter (SVF). See https://karmafx.net/docs/karmafx_digitalfilters.pdf and https://ccrma.stanford.edu/~jos/svf/svf.pdf. Reference procSVF in the code.
SoundFont file Authors, one way or another, specify envelope parameter values for shaping notes. batchProcessor interprets/modifies the parameters going into Euterpea's envLineSeg Signal Function for timed amplitude control. Priorities for the interpretation logic are:
- produce a reasonable note
- (try to) honor Author design intent
(See refineEnvelope in the code)
Files taken from the wild have many flaws that tripped us up at first. Examples:
- unprintable characters in Sample or Instrument names -- renames the bad identifiers.
- unusable settings like zero Sample Rate 🙃 -- disqualifies affected Instruments
Tools like https://www.polyphone.io/ also function fine when opening those flawed files. In batchProcessor, glitches encountered and addressed are documented in a Scan Report.
Sampling a natural Instrument over many small ranges of Pitch and/or Velocity yields nice spacious sound. But Authors often split Zones among distinct SoundFont Instruments. Naive implementations, mapping Instruments one to one, loses the advantage 😟 if Instrument is distributed. So prior to synthesis, partial Instruments are in effect combined into one that has all the Zones. 😌
Don't like to search, at note synthesis time, through an Instrument's Zones to isolate one whose Pitch and Velocity ranges peg the two incoming note parameters. Lazily computes winners' cache instead -- search is thus reduced to an array lookup.
(See Smashing Module in the code).
Don't ask 🙄 ! The bottlenecks are:
- parsing SoundFont files (https://hackage.haskell.org/package/HCodecs-0.5.2/docs/Codec-SoundFont.html)
- rendering - evaluating Signal Functions modeling the audio clock rate
Heavy batch runs have clocked in at ten hours.
Euterpe is the name of a Muse from Greek mythology. Parthenope was a Siren, the daughter of a Muse.