Colorful source code in Terminal

Often it is quicker to take a look at a source code file in Terminal using the cat or less commands, instead of starting up an editor, especially if you don’t need to make changes. However, like myself, most developers are used to syntax highlighting, or presenting source code in various colours. It makes the different elements in the source code stand out, and helps with comprehension. I find that the older I become, the more I need syntax highlighting, and I think back to a time when it was not so common, amazed that I could make sense of anything. (Of course younger brains have more cycles to burn.)

An easy way to get syntax highlighting to your macOS Terminal is to install Pygments. It is a Python-based source code colorizer library with a command-line interface.

First, if necessary, install Python 3 with Homebrew, make sure your pip3 tool is up to date, and then install Pygments:

brew install python3
pip3 install --upgrade pip setuptools
pip3 install pygments

Now you should have the pygmentize command in your system, and

pygmentize -h

will give you an overview.

Pygments supports many programming languages and has several built-in styles. Since I work with Xcode a lot, I like to see similar syntax highlighting in the Terminal, so a typical command for me would use the ‘xcode’ style like this:

pygmentize -f terminal256 -O style=xcode -g somefile.py

Pygments tries to infer the correct formatting from the file extension, but the -g flag makes it also look at the contents of the file. The -f terminal256 option directs Pygments to output 256-color ANSI escape sequences.

These options are a little too much to type every time I need syntax highlighting, so I’ve defined an alias in my ~/.bash_profile file:

alias pcat='pygmentize -f terminal256 -O style=xcode -g'

so that I can just say pcat somefile.py.

If you need paging, you’ll probably use the less utility, but you need to use the -R option to interpret the ANSI codes emitted by Pygments:

pcat somefile.py | less -R

If this doesn’t make your Terminal colourful enough, you can always install lolcat!

Make multisamples on your iPad with SynthJacker

Featured

Picture this: a friend of yours has bought a nice vintage synth with great sounds, and wouldn’t you like to use those sounds in your own music-making? If only you could sample those sounds, but it seems like too much trouble… You would need to persuade your friend to let you borrow the synth, or you would need to visit them with your music-making setup, which nowadays is basically an iPad and an iOS-compatible audio interface.

Turns out that iPad and audio interface are just what you need for making multisamples of any MIDI-compatible synth, with very little effort. You only need to:

  • Find a cool sound you want to sample on the synth
  • Connect the synth to your audio interface
  • Connect your audio interface to your iPad
  • Start SynthJacker, select the notes and velocities you want to sample, and tap the Record button

SynthJacker plays the notes you selected, at the velocities you selected, through the audio interface and captures the result in real-time. But that is just the beginning: it then goes away and slices the audio into individual audio files, one for each note/velocity combination, and saves them on your iPad. When you switch to the iOS Files application, they are there, just waiting to be imported to a sampler or DAW of your choice.

Watch the SynthJacker demo video on YouTube  – it shows the app in action, and details the synth connections you need.

SynthJacker works on the iPad and on the iPhone, and requires an iOS-compatible audio interface (I use the Steinberg UR22mkII).

Why SynthJacker?

I developed SynthJacker for iPad and iPhone as a way to easily create a set of multisamples from my trusty old Kawai K4 and K5000S synths, but also the much newer KORG minilogue and IK Multimedia UNO Synth. With these, I have no shortage of great sounds on the iPad. Any synth you can get access to can be sampled in just a few minutes.

If you have a monophonic synth like the UNO, you can make it polyphonic (well, not actually) by sampling its sounds and using them in a DAW.

If you have a Mac, you can get Apple’s MainStage from the Mac App Store and use it to create sampler instrument in EXS format. However, it requires a Mac, and it can be difficult to retrieve the individual samples if you want to use them with other virtual instruments than Apple’s own EXS24mkII.

Coming soon: Inter-App Audio

The first version of SynthJacker is intended for hardware MIDI synths, but I’m also looking to add Inter-App Audio and/or Audiobus, and possibly also Audio Unit v3 support. This would allow you to sample the iOS synths on your iPad, which has been requested by many.

Let me know what you need from SynthJacker, and I’ll see if it can be supported. Many early adopters have already sent great development ideas, so please keep them coming.

Enjoy multisampling with SynthJacker!