douglasjarquin / logic-automator

A collection of scripts to automate tasks in Logic Pro X for music production.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logic Automator

This has scripts for automating various tasks in Logic Pro X.

Setup

  • Make sure you have python3 installed and sourced in your .zprofile file (if you are using zsh as your shell).
  • Make sure Xcode is installed fully.
  • Run pip install pyobjc atomacos

Running

  • Transpose: to transpose a song and bounce it by N semitones, run the following command. It exports to MP3 with default settings and overwrites existing files, if any.
python3 transpose.py <path_to_logic_project> <transpose_by> <output_name>
# Example: python3 transpose.py '/path/to/some\ project.logicx' 3 transposed_output
  • Write MIDI: to create a midi file with a custom sequence of notes, as specified by their MIDI note numbers, use the following command:
python3 write_midi.py <notes_array> <output_name>
# Example: python3 write_midi.py '[0, 4, 5]' '/path/to/some\ midi.mid'
  • Bounce MIDI: to export a midi file as an MP3 file, use this:
python3 bounce_midi.py \
    <path_to_logic_project> \
    <path_to_midi_file> \
    <output_name> \
    (<instrument> (<preset>))
# Example: python3 bounce_midi.py \
#   '/path/to/some\ project.logicx' \
#   '/path/to/some\ midi.mid' \
#   'out' \
#   '["AU Instruments", "Native Instruments", "Kontakt", "Stereo"]' \
#   'my_preset'

Development

Unfortunately, the package this depends on (atomacos) has a number of major issues and Logic's interface keeps changing to make this code obsolete. Since this script has fulfilled my needs to date, I am leaving things here. If you have fixes that crop up moving forward, feel free to submit a pull request.

Known issues:

  • When importing a MIDI file, atomacos sometimes replaces slashes with question marks and crashes. This is not always the case, but it occasionally occurs. This is a bug in atomacos, not this. A workaround is necessary in the future.
  • Sometimes the bounce menu does not appear.

Linting

First, set up the git hooks:

git config --local core.hooksPath .githooks/

Then, install dev dependencies so you can lint your files as you go:

pip install black

Acknowledgements

Most of the code for bouncing files is adapted from psobot's solution, but it is updated to work with Python 3 and newer versions of Logic.

About

A collection of scripts to automate tasks in Logic Pro X for music production.


Languages

Language:Python 98.7%Language:Shell 1.3%