Free Custom Open-Source IR for Your Acoustic Guitar and Its Pickup
Python3.11 Version of jf45v4 script now available
Due to the large selection of Python interpreters and integrated development environments, and almost unavoidable terminal window actions, I’m making no attempt to offer a tutorial on how to use it. The Octave version below includes a usage tutorial (Octave is a “walled garden” and appears the same Mac, PC, or Linux). Just for reference, I am using IDLE from python.org which can be installed on all major platforms as an app. At a terminal window I loaded the required libraries with PIP3, which is included with IDLE. “jf45irv4.py” requires the numpy, scipy, matplotlib.pyplot, soundfile, and os libraries. To run I open a terminal window, change directory to the one with the script and the wav file sample, then invoke Python with the command line below. You need to close the window that opens with the frequency plot of the IR for the script to finish and a terminal prompt to appear. You can still send me your .wav files and I’ll run them for you. Link to Python3.11 version, jf45irv4.py:
After installing Python and all the required libraries, place this script in the same directory as your guitar recording. Open a terminal window, change directory to the one with the script and recording, and then type the following at the command line prompt:
The script will ask for the name of the .wav file with the sample to be processed (see below for file specifications).
- Octave script now requires only a 30 second sample
- For use with inexpensive cabinet IR loaders with no mix function the script generates 5 bypass blended IR options
- .wav File, pickup left, mic right, open position strumming is best
- The latest script name is jf45irv4.m
- The attached screenshots are for the older script jf45ir.m, Octave 5.2, Windows 10
Check out this very brief demo that shows where you can take a bottom-of-the-line piezo under saddle transducer with the cheapest of guitar cabinet IR loaders:
The Easy Way to Generate a Custom IR for Your Guitar
Email me (firstname.lastname@example.org), a Dropbox or Google Drive link to your recordings.
If your .WAV file is less than 25 MB it can be sent as an email attachment. If you zip up your recordings, you can include several in a less than 25 MB email attachment.
Generating the IR takes only seconds in Octave. Octave is the free open-source GNU MATLAB clone. MATLAB is a math software integrated development environment used in almost every technical field.
If you want, send a few recordings with different mic placements. 8” from the neck/body joint is a good starting point. In the years since this script has been released, I’ve concluded simple open position strumming does as good a job as anything you could choose to play. Listen to your mic recording, that is the IR’s target and the IR will not be better than what it is used to calculate it.
- .WAV file at least 30 seconds long. My program only uses the first 30 seconds of the recording.
- Pickup left, Mic right, set your DAW for the two to be about equal in volume.
- No clipping.
- Try to keep your peaks within 15 dB of clipping (decent SNR, peaks above mid-scale on your recording software linear scale is best).
- The IRs generated will be at the same sample rate as the recording. To my knowledge all IR loader PC/Mac programs support resample on download and will translate the sample rate to the one required by the IR pedal you’ve chosen. A 44.1 kHz (CD) sample rate has a slight advantage over a 48 kHz (DVD) sample rate recording.
I will email you back the IRs for each recording (IRs are 4KB files). Check the file naming convention here:
The Do-It-Yourself Way (this is not hard at all!)
The primary advantage of doing this yourself at home is the ability to add your own EQ to the mic recording before generating the IR. This way you can cook your EQ choices into the IR. Compared to commercial acoustic guitar IR generators, the lack of pre or post processing EQ might be unique to jf45ir.m. In my opinion, those EQ decisions really belong to the end user and not the IR software writer. If you buy new guitars, mic’s, and pickups with any regularity, you can independently generate your own custom IRs.
- Download the Octave version of my IR generator, jf45irv4.m, using this Google Drive link:
- Download the free GNU math development environment Octave and follow the installation instructions:
For a Mac App 6.2 is the latest available “DMG” and more than good enough (I use Homebrew at a command prompt to install the latest Octave version). The 6.2 App is for an Intel Mac and will run under Rosetta for an M series CPU Mac. The first time you run it on an M series Mac Rosetta will recompile the app and it will take about one minute. After that it will still not be blisteringly fast…
The Octave interface has its roots in Unix from many decades ago. If you are finding its user interface unfamiliar, skip down to the screen shots link below. Place your guitar pickup/mic recordings in the same directory as my latest script jf45irv4.m and double clip (run) jf45irv4.m. The GUI version of Octave will open in that directory. Alternately, after installing Octave, run the GUI version and change the current directory to the one in which you placed my script and your recordings.
If your recording is called mgit.wav, for example, then type the following in the Octave command window followed by a carriage return. Regrettably WordPress is ignoring my font selection and you must use vertical single quotes. Do not include the .wav extension. Don’t forget to pan the pickup left and the mic right in your DAW before exporting mgit.wav.
Octave will then generate the IRs plus the frequency plot. They will be in the same directory.
Old screenshots for Octave 5.2, Windows 10, and jf45ir.m, but still relevant:
How Does jf45ir Work?
Reading this section is purely optional!
Unlike ToneDexter or the Baggs Voiceprint, I am only trying to solve the IR generation problem. You still need a pedal for playback in performance. Since I am not trying to shoehorn IR generation into a pedal, I am taking full advantage of the math power of a modern Intel PC/Mac processor.
I am taking a purely mathematical approach to the problem of coming up with an IR that makes the left channel (pickup) of the sample sound like the right channel (mic). There are no assumptions about the instrument, pickup, or mic being made. This simplified approach seems to work well and does not have hidden optimizations which might interfere with your guitar, pickup, or mic selection.
The script itself should make sense to anyone with two semesters of college calculus and access to Wikipedia to get a basic understanding of a Fourier Transform and a Window Function.
You can think of the system we are analyzing as two parallel IRs. One takes the real guitar and gives you the pickup output, and the other takes the real guitar and creates the mic output. Since both systems are assumed to be linear and time invariant, there should be a third IR that can take you directly from the pickup to the mic. It is that third IR we are attempting to calculate.
First, I extract segments of the recorded pickup and mic. I tried 1, 2, 4, 8, and 10 segments of lengths 2^15, 2^16, 2^17, 2^18, 2^19. Too short a sample sounded not as good as longer, and after a certain point longer was not better. The math of Discrete Fourier Transforms has a quantization noise problem that favors longer segments.
I settled on 4 segments, 2^17 samples (~3 seconds) long. I skip 6 seconds into the source wav file and grab a segment. I check it for clipping and having a peak lower than -15 dB down from clipping. The segment is rejected for clipping or low SNR. I then skip ahead 3 seconds and grab the next segment and repeat the clip/SNR test. I do this up to 7 times to yield 4 segments of your sample.
Those of you who are familiar with how clipping distortion creates sharp edges and generates harmonics would probably not be surprised that taking a segment out of a longer sample does something similar at the beginning and end of the sample. A window function takes your segment and slowly raises the volume from zero and back to zero. I chose Blackman. The math again prefers a longer segment for less windowing harmonic generation.
Next all the segments get Fast (Discrete) Fourier Transformed (FFT). The mic FFT is divided by the pickup FFT. The four division results are averaged together and then an Inverse Discrete Fourier Transform (IFFT) generates the IR.
The big picture is sort of pickup (output of your guitar), times mic divided by pickup IR (the calculated IR running in your pedal), equals mic. I’m avoiding that convolution word.
Minimum phase is an option mentioned in the ToneDexter patent and I also calculated minimum phase versions. I confirmed with frequency plots that the code works correctly. I could not hear any difference and gave up on that approach. This IR approach does not gain up the bass response and I am thinking without the bass boost of other IRs the minimum phase version is not that important.
My one piece of unique intellectual property (as far as I know) was a “no near zero” criteria in the pickup FFT. Dividing by zero is a bad idea and the IR can’t create something from nothing. I search the pickup FFT for coefficients (frequency bands) where the magnitude is more than 65 dB down from the peak. Those coefficients get replaced with “1” in both the pickup and mic FFTs (the resulting IR has a 0 dB gain for those frequencies). This produces a better sounding result with a better-behaved frequency plot (no motivation to add Tone Match to this algorithm). High and low cut filtering often needed by other IR generation techniques are not needed here. Post processing to notch resonant peaks in the lowest few 100 Hz for live performance feedback control is also not required with this algorithm.
To summarize, I am producing the IRs from four 2^17 sample segments, no near zeros with a 65 dB down criteria, no minimum phase transformation, truncated to 2048 and 1024 sample versions, along with a selection of IR/pickup blended IRs.