Last updated:

ReaScripts Pack: Analyse selected audio items pitch

Introduction

This pack contain a script designed to analyze “average” pitch of selected audio items in REAPER, and process the info to correct the offset (by changing rate or by doing a take pitch offset, which uses REAPER built-in pitch correction algorithm), and/or rename the item accordingly.

Content

Development

The common virtual sampled-based instruments creation process involves editing long series of single notes sounds, for which the pitch will then need to be identify, and even corrected in some cases. There is various ways to do that but it is usually a long manual process.

I already take a shot at this with my Virtual Instrument Editing ReaScripts Pack, which contains some scripts to determine average pitch of items. It uses track FX to do that, and the speed process is basically the length of the audio files, which is quite slow (but still better than manual).

Thanks to Soundiron and their sponsoring, I was able to take a second look at this issue, and propose a way more efficient and flexible solution. I compared various pitch detection algorithm integration possibility, and designed an algorithm to determine the “average pitch” of an audio section (indeed, most of things I tried proposed instant pitch, which is not what is need there). After testing on various materials, it appeared that the solution was quite good and efficient enough to be used for their next Kontakt Libraries building.

The current best solutions I found to do the pitch detection come from aubio, a free open source suite of small CLI softwares to do various audio analyses tasks, which can be called from external softwares. The script I propose i a wrapper for this software so that the results of the audio analyses is processed right inside REAPER.

Thanks to the folks at aubio for providing this algorithm !

Concept

Here is how it works:

  1. The script render items. This allows to process on edited files (if you already had take rate change, FX, envelopes, gates or anything). Render can be at item level or process track FX as well.
  2. The script calls aubio in the background. It offers you access of various pitch detection algorithm and settings but I advice you to leave the default : YinFast algorithm provided by aubio is quite efficient.
  3. Analyses are sent back to REAPER and the scripts process the data to rename and/or pitch correct the items. Correction via take rate seems to be quite interesting to avoid artifacts which can occurs in some pitch correction algorithms (as corrections are not extreme to go to closest pitch, it is a quite reasonable solution).

The script is very fast. It can process a tons of samples in few minutes. Perfect for Kontakt libraries makers !

Demo

Here is a demo showing pitch analyzing and retuning of a detuned piano using two methods: take pitch offset (which uses REAPER build-in pitch algorithm, Elastique v3 Pro in this case) and simply take rate offset.

As you can see, it works pretty neat in such materials, compared to the referenced pitched samples (before detuning), we get maximum 2 cents of variations, which is far from enough for most cases.

If manual offset has to be made, you can use reaper native Pitch Offset actions, or if you prefer to correct with rate offset, use X-Raym_Set or offset selected takes rate by semitone adjusting item length and fades and clearing preserve pitch.lua script, shared for free in my reapack repo.

Update : GUI (2021-03-01)

Release very soon, a GUI version of this script, to allow modification of pitch envelope!

Here is the prototype:

Stay tuned!
Thanks Soundiron for the dev sponsoring!

Tutorial

You can see the script in action on David Hilowitz video below (thanks to him for the showcase!):

Installation

This pack can be installed and auto-updated with the free ReaPack REAPER extension with a custom link related to your licence, or via regular Zip download. After purchase, detailed installation instructions will be provided here and on the dedicated Purchase Confirmation page. License are valid lifetime. You will be able to enjoy updates and new scripts added to the pack.

Aubio dependency

To do the audio analyses, the script use an external free open source small software call aubio. It is fast and efficient, but need to be put in the right place so the script can find it.

Windows

You can install aubio with this reapack repo: Aubio-for-REAPER.

MacOS

You can install aubio via the terminal with the homebrew aubio package.

If this doesn’t work (obsolete MacOS version for eg), you can also use the Python version. For this, you need to install Python (last version), Pip python package manager, and then Aubio via Pip. Then run the script X-Raym_Define aubio path in ExtState.lua and point to the aubio folder.

Purchase

  • Personnal use, you are an individual, a student, or a non-profit organization, and you will not use this pack on commercial projects.

  • Your work for a small business company or commercial projects.

  • You are a big business company with a team of more than 5 people.