Sunday, October 18, 2020

Audio Output on Teensy 4.x Boards

I remember learning about Teensy for the first time several years ago from a colleague. He was using Google WALT device for measuring audio latency, and WALT is based on Teensy-LC board. Back then, this board had impressed me with its tiny size, albeit providing a lot of features. Its processing power is very modest though—Teensy-LC is based ARM Cortex-M0+ processor running at 48 MHz.

Recently I've started a project of a talking ABC board for my daughter and decided to check what progress had Teensy made. I was very impressed learning that the latest (4th) version of Teensy emplys a much beefier ARM Cortex-M7 processor running at 600 MHz! This board is more powerful than the desktop computer I was using 25 years ago, and that's at a fraction of the cost of that PC, and on the footprint of a USB memory stick.

Note that Teensy is a microcontroller board which means it doesn't have an operating system. This is what makes Teensy different from Raspberry Pi, for example. This fact has a lot of advantages: first, Teensy boots instantly, second, all the processing power of its CPU is available to your own app. This also means that the board can't be used for general PC tasks like checking Facebook. However, Teensy can be used for more exciting things like building your own interactive toy.

In my case I needed Teensy to play an audio clip (pronounciation of a letter) in response to pressing of a button. Sounds easy, right? However, one thing I needed to do is to figure out how to play audio on Teensy. What I've learned is that Teensy 4.x offers a lot of ways to do that. In this post I'm comparing various ways of making sound on Teensy.

Teensy 4.0 vs 4.1

Every Teensy generation comes in two flavors: small and slightly bigger. Below is the photo of Teensy 4.1 (top) and 4.0 (bottom):

Both boards use the same processor which means their basic capabilities are the same. However, bigger size means more I/O pins available. Also, it's possible to add more memory to Teensy 4.1 by soldering additional chips on its back side. For my project, the important difference is that Teensy 4.1 has an SD card slot, whereas 4.0 only provides pins for it. I plan to use the SD card for storing sound samples–the board's flash memory is unfortunately too small for them. Storing samples on an SD card also simplifies their deployment as I can simply write them down from a PC.

The audio capabilities of 4.0 and 4.1 are thus the same, so I will be referring to the board simply as "Teensy 4" or "4.x".

Teensy Audio Library

From the programming side Teensy is compatible with the Arduino family of microcontrollers. The same Arduino IDE is used for compiling the code, and the same I/O and processing libraries can be employed.

Teensy also has a dedicated Audio library which in my opinion is very interesting. The library has a companion System Design Tool which allows to design an audio processing chain really quick by drag'n'drop, and then export it to the Arduino project.

Being a visual tool, Audio System Designer allows to explore the capabilities of the library without a need to go through a lot of documentation to get started. The documentation is built into tool. The only drawback of the docs is that they are too short. Although, this is partially compensated by numerous example programs.

The described audio capabilities are all based on the objects provided by Teensy Audio Library.

Output Power Requirements

My plan is to use an 8 Ohm 0.5 W speaker from Sparkfun for audio output in my project. Thus, I'm comparing output from audio amplifiers using an 8 Ohm resistive load and ensuring 2 VRMS output voltage (approx. 6 dBV). The goal is to achieve as "clean" output as possible.

Built-in Analog Output (MQS)

The chip that Teensy 4 is based on offers analog output solution which is called MQS for "Medium Quality Sound". Not to be confused with Mastering Quality Sound which has the same abbreviation. MQS on Teensy 4 is a proprietary technology of the chip maker (NXP). MQS allows connecting a small speaker or headphones to the chip pins directly, without any external output network.

Note the revision 3 of Teensy board has a built-in 12-bit DAC. MQS implements a 16-bit DAC with small Class-D amplifier. However, not very good ones. To me, "medium" in MQS is a stretch, coined by the marketing department, and perhaps it would be more fair to call it "LQS" for "Low Quality Sound".

Let's first take a look at a simple 1 kHz sine wave in time domain:

It definitely looks very jaggy to me. Another problem detected by using a DVM is a high DC bias offset: 1.64 VDC. It doesn't show up on the graph because the audio analyzer is AC-coupled. This amount of DC offset can pose a problem to line inputs and even to some speakers.

Another drawback of MQS is that the chip doesn't provide muting for the power-on thump. This can be worked around by adding a relay, after all it's trivial to control it using a PWM output pin, however if you have to use external parts, I would recommend using an external DAC instead.

Below are a couple more measurement graph revealing shocking simplicity of this output. First, as we can see on the frequency domain graph, there is no antialiasing filter, so we can see the mirror image of the original 1 kHz frequency and its first harmonic between 42–44 kHz followed by a direct copy. That means, the DAC/amp on the chip likely uses 44.1 kHz sampling rate.

Frequency response in the audible range is rather flat:

When I tried to achieve the required 0.5 W into 8 Ohm I could only squeeze out 1/100 of that (note that the graph is A-weighted):

In my opinion, due to absence of any filtering, turn on click protection, high DC bias, and low power, MQS output should only be used during development and testing—it's indeed convenient that a speaker can be attached directly to the board for a quick sound check.

External Output Devices via I2S

Since built-in analog output has serious limitations, I've started looking for external boards. Thankfully, Teensy supports I2S input and output. Teensy actually supports plenty of those interfaces, offering great possibilities for multi-channel audio I/O.

For my project mono output is enough. I tried a couple of inexpensive external boards to check how much the audio output improves compared to the built-in output.

MAX98357A DAC/Amp

I bought a breakout board from Sparkfun to try this IC. The datasheet calls the chip "PCM Class D Amplifier with Class AB Performance." Note that it's a mono amplifier which either sums its stereo input, or just uses only one of the two input channels.

Hooking it up to Teensy is extremely easy. One needs to connect the clocks: LRCLK and BCLK to the corresponding pins on Teensy, then connect I2S data (OUT1x, I used OUT1A), and of course power, which can be also sourced from Teensy. Then just use i2s or i2s2 output block in the Audio Designer. There is no volume control on this breakout board, only the amplifier gain can be changed.

MAX98357A IC can accept a variety of sampling rates and bit depts, however Teensy normally produces 44.1/16 audio signal. Looking at the white noise output we can see that the MAX IC employs a proper brickwall audio band filter at the DAC side:

The frequency response in the audible range is rather flat:

Another good feature of the IC compared to MQS is proper output muting on power on to prevent pops. The speaker output has almost no DC offset.

As for the jitter, the IC seems to employ clever synchronization tricks. Initially after powering on the jitter is gross and the noise floors is very high:

However, after 5–15 sec the IC seems to stabilize its input and drastically improve its output quality:

The MAX98357A was able to deliver the required 0.5 W albeit with a 10% distortion (this graph was obtained with the amplifier configured for 12 dB gain):

It's interesting that the 5th harmonic is dominating.

Considering the price of the chip, I would say that MAX98357A IC is a good choice if only mono output is needed and has a lot of advantages over the MQS output.

Audio Adapter Board

Since the times of Teensy 3 its creators were offering an "audio shield" board which is designed to cover the smaller version of Teensy completely. Due to some changes in pin assignments on Teensy 4 the design of the Audio Adapter Board was updated.

The audio part of the Adapter board is based on the SGTL5000 chip which in addition to ADC/DAC and amplifiers also offers some basic DSP functionality.

The Adapter board has line input and output, mic input, and headphone output. It uses I2S interface for communicating with Teensy. The board also offers an SD card slot and a controller for it. Note that although Teensy 4 has an on-chip SD card controller, there is no SD card slot on the 4.0 board. Adding it requires soldering a cable to the corresponding pins on the back side of the board, because the pin spacing and overall space is a bit tight for soldering an SD card socket directly. Thus, for a Teensy-based audio project it might be beneficial to attach the audio shield as it provides both analog audio I/O and an SD card.

One thing many users of this board noted is that is must be connected to Teensy using very short wires. The reason is due to use of an additional (compared to MAX98357A) high-frequency master clock input (MCLK) which runs at the frequency of several MHz.

The resulting jitter of the DAC is quite low, staying below 94 dB the carrier signal:

Surely, the SGTL5000 chip is advanced enough to have protection against the power-on thump. The level of distortions is tolerable (since it's a line output, I had connected it directly to the analyzer's input):

Note a noise peak at 60 Hz. I'm pretty sure it's the result of insufficient shielding on this board because the measurement was taken using differential input of the analyzer. This normally cancels out any EMF noise induced on the probe wires.

The headphone output of the adapter board isn't powerful enough to drive the load required for my project. So in addition to the adapter board an external power amplifier has to be used.

External Analog Amplifiers

I've tested two boards from Sparkfun: a mono Class-D amp, and a classic Class-AB amplifier named "Noisy Cricket". These amplifiers can be connected to the line output of the audio adapter board.

Mono Class-D Amp (TPA2005D1)

This is a low power IC amplifier for which Sparkfun has a breakout board. This is a rather old chip TPA2005D1 from Texas Instruments which advertises a 10% THD on its specs sheet.

And indeed it does have a 10% THD+N when driven up to the required output power (the graph is A-weighted):

Note that I tested this chip on its own, providing an input from the audio analyzer, and powering it using a bench power supply. Despite being tested under these "laboratory" conditions, the chip didn't show a stellar performance. I also tried supplying a differential input from the analyzer, and raising the input voltage up to the accepted maximum of 5.5 VDC but it didn't improve its performance.

It's interesting though, that being an unfiltered Class-D amplifier with 250 kHz switching frequency, this chip offers bandwidth which is enough to serve the full range of the QA401 DAC at 192 kHz sampling rate:

So it seems that there shouldn't be a big difference in terms of audio quality when using the MAX98357A chip via I2S directly, or TPA2005D1 via the line output of the audio shield.

Noisy Cricket (LM4853)

This is another IC amplifier from TI on a good quality breakout board by Sparkfun, which even includes a volume control. The IC is LM4853 amplifier chip (not just an op-amp). It can work either as a stereo amplifier, or as a mono amplifier in bridged mode.

The specs sheet of LM4853 shows much better distortion figures than for TPA2005D1. I had configured the board in mono mode and tested it in the same setup as TPA2005D1: powered from a bench power supply (at 3.4 VDC) and driven by QA401 signal generator. The results were much better:

The 3rd harmonic is 50 dB below the carrier level. For my toy project this is good enough.

Looking at the frequency response, we see some roll-off in the bass range, but I'm pretty sure that the speaker I'm going to use can't go that low anyway, so it's not a big deal:

So, Noisy Cricket is a good choice for me. Hopefully I will be able to achieve close to natural voice reproduction on my talking ABC.

Conclusions

Despite that boards based on Class-D chips are more compact and likely consume less power, when using a speaker of a classic cone construction it seems better to use a classic Class-AB DAC/Amp combination built from the Audio Adapter board and Noisy Cricket.

I'm putting a big rechargeable battery into this talking ABC, so higher power consumption isn't a problem for me. Additional convenience of using the audio shield comes from the fact that it has mounting holes and an SD card for storing audio samples.

If a more sensitive speaker could be used which requires less driving power, then an alternative solution is to use Teensy 4.1 which already has the SD card slot on board, and connect the MAX98357A DAC/Amp chip to Teensy's I2S output.


Bonus: Built-in Digital Output—S/PDIF

I have moved this section to the end because this output finds no application in my project. However, it's a new feature of Teensy 4 which also might be useful sometimes.

On the previous generations of the board, thanks to the efforts of the Audio Library contributors, it was possible to emit signal in the S/PDIF and ADAT formats programmatically. The nicety of the hardware support added in Teensy 4 is that it consumes less power and allows yielding the CPU to more interesting tasks.

The hardware S/PDIF output is as simple to use as MQS—it only requires connecting an RCA output to the board pins. This output only supports Audio CD output format: 44.1 kHz, 16-bit. I must note that although the built-in S/PDIF worked for me on the Teensy 4.0, on its bigger version 4.1 the S/PDIF sampling rate for some reason was setting itself to 48 kHz which made it unusable since Teensy Audio Library doesn't seem to support it. Thus, I could only test the built-in S/PDIF on Teensy 4.0.

Apparently, with a digital input there are no concerns about filtering or non-linearity in analog domain. One thing I was curious to check was the amount of jitter. I hooked up Teensy 4 to the S/PDIF input of RME Fireface UCX interface and then used the same J-Test 44/16 test signal generated using REW 5.20. RME was set to use the S/PDIF clock. I played the same J-Test signal on Teensy and via USB ASIO to be able to compare them. Here is what I've got—the blue graph is from USB, the red one is from Teensy:

As we can see, the output of Teensy has much more stronger jitter-induced components around the carrier frequency, whereas there are practically none for RME's own output.

Note that the peaks on the left side (up to 6.5 kHz) is some artefact of using 16-bit test signal on a 24-bit device (RME). I tried another DAC (Cambridge Audio DacMagic Plus), another computer, switched from PC to Mac, tried 16-bit J-Test sample from HydrogenAudio forum, but these spikes on the left were always there as long as I was using 16-bit J-Test signal, and they were completely gone on 24-bit test signal. I suspect there must be something in the process of expansion of a 16-bit signal to 24-bit that makes them appear.

Sunday, August 2, 2020

On Keyboards

I want to tell a story about my current computer keyboard. A couple of weeks ago I switched to Kinesis Advantage2 keyboard. This device looks very unusual compared to most regular keyboards:

As you can see, the design brings the ergonomics to the extreme and fulfills several goals:

  • provide integrated wrist rests;
  • make better use of thumbs by putting more keys under them;
  • achieve more natural wrist positions;
  • provide similar path length from main 4 fingers to alphabet keys.

However, with this design a lot of keys were moved away from their usual positions. The most notable differences are for the arrow keys, brackets, and the keys that are located at periphery positions on traditional keyboards like functional keys, tilde, and plus.

I'm not new to ergonomic keyboards. For a very long period I used another keyboard by Kinesis called "Freestyle2":

As you can see, this keyboard is also ergonomic—it consists of two halves that can be positioned at various angles. However, its layout is more traditional and even somewhat superfluous—I've never made a good use of the "shortcut" keys on the left (mostly because I use actual shortcuts for all the actions these keys intend to provide, and I can't use them for anything else as the keyboard doesn't allow for remapping).

I'm in fact a big fan of keyboard shortcuts and learn them in any application I use more or less frequently. I can't imagine using GMail without shortcuts—at my job I receive from 100 to 200 emails per day. While I was still using Freestyle2 I started noticing that my right hand is aching after I had been using the bracket keys while going through my inbox (the bracket keys are used in GMail to archive the current email and go to the next one) and after active use of the arrow keys for navigating in Emacs.

The Advantage2 keyboard was sitting in my drawer for a long time (at the beginning of the COVID lockdown I had managed to get it at my company's expense) but I was hesitating to start using it due to its unorthodox layout. And as I've got the hand ache from using Freestyle2 I decided that it's a good opportunity to give Advantage2 a try.

I must admit, it took about 2 weeks until I could finally use it without an extra mental effort for finding keys. The most infuriating was "re-learning" the key combinations in Emacs. For a lot of them over the years I simply forgot what the actual keys are and was invoking them using muscle memory exclusively. Since the key layout on Advantage2 is different, I had to recall what are the keys used for the combinations and had to learn where to find them on this keyboard.

Now I can clearly see benefits of using Advantage2: no wrist or arm aching and typing feels more comfortable than on a traditional keyboard. Also, unlike Freestyle2 the Advantage2 keyboard is programmable, meaning that you can remap keys and even record macros. I actually did a couple of key remappings to make my typing more comfortable.

Key Remappings

First, I remapped the back space key (it's under the left thumb, mirroring the space key under the right thumb) to serve as the second space key. This is after my habit of having two separate space keys on Freestyle2—I noticed that I end up pressing the back space key on Advantage2 when I wanted to type a space.

OK, but the back space is a really useful key after all—where should it go? I moved it to the nearby "Delete" key. It is still convenient for an active operation. Good, but "Delete" is also useful in various file managers as it allows deleting stuff. I found that on the left side Advantage2 has an "extra" key—another copy of the backslash key:

It's also used as the "Insert" key when you turn on virtual numeric keypad. So I thought it's a good semantical link between "Insert" and "Delete", and assigned the latter to this extra backslash key.

Finally, if you use Unix shells a lot you'll notice that the tilde key is used very frequently. On traditional keyboards it's located to the left from the number row. On Advantage2 for some reason this place was given to the "+/=" key and the tilde key was moved to the bottom:

The natural solution is to swap these two keys. So this is the layout I ended up using:

And yet another cool feature of this keyboard is that all remappings and macros are available as text files exposed on keyboard's internal USB drive. For example, this is how my remappings are specified:

[=]>[`]
[`]>[=]
[intl-\]>[delete]
[delete]>[bspace]
[bspace]>[space]

This is what makes this keyboard a truly professional one.

Practicing Typing

For a long time I practice my typing on Tipp10 site. I know, there are myriads of similar touch-type training sites. What I like about Tipp10 is their scoring system which penalizes for typos. This stimulates you to type slower but with less mistakes and build up speed slowly. The site also allows for uploading your own typing lessons.

Building typing speed is something that doesn't come easy for me. I'm trying to find any book or instruction that would be based on a research on neuro-motor skills, but so far found none. The closest thing I found is this free book on playing piano called "Fundamentals of Piano Practice." It gives some practical advises on the exercises for developing finger muscles and improving finger coordination, which helps to build up speed and accuracy.

Of course, typing and playing piano are very different activities, however I believe that they share some goals. I've learned a couple of things from this book.

First is what they call "Hand Separate" practice. I've found that my right hand is somewhat weaker and less accurate than the left one, partially because I'm left-handed, and also because I had a minor injury of my right hand resulted from winter biking. So it helped to train this hand more intensely. This is where the design of Advantage2 is a real advantage—the hand zones are clearly separated.

The second technique is what the book calls "Parallel Sets" (PS for short). Their strong side is that they can serve both as diagnostic tests for the finger movement fluidness and as an exercise for developing it. The practice of the parallel sets is described to length in the book, so I will not repeat it here. This is just an example of custom typing exercises that I had created for myself in Tipp10 (for QWERTY layout):

PS Exercise 1

aaaa x8, jjjj x8, ssss x8, kkkk x8, for all front row keys.

PS Exercise 2

asdf fdsa asdf fdsa asdf fdsa asdf fdsa
as as as as sa sa sa sa
sd sd sd sd ds ds ds ds
df df df df fd fd fd fd
asd asd dsa dsa asd asd dsa dsa
sdf sdf fds fds sdf sdf fds fds

And similar sequences for the right hand. There is also a variation where I type left and right hand interleaved, for example:

ajsk ajsk ajsk ajsk ajsk ajsk
skdl skdl skdl skdl skdl skdl

PS Exercise 3

ad ds sf ad ds sf ad ds sf ad ds sf
ads dsf ads dsf ads dsf ads dsf
adsf adsf adsf adsf adsf adsf adsf adsf

And similar sequences for the right hand. This exercise is actually challenging. I've found that it really helps to do it for each hand in isolation first.


In fact, all these exercises help to feel difference between keyboards. I was doing them in parallel on Advantage2 and Freestyle2 keyboards, and I immediately felt the convenience of curved hand wells of Advantage2 that helped to make the glide of fingers more fluid.

Conclusions

I'm glad that I have switched to this keyboard. Among positive sides I would specify:

  • great ergonomic design;
  • flexibility in configuration which makes this keyboard a real professional tool.

And on the flipside:

  • unorhodox layout which can interfere with muscle memory developed while writing program code and using code editors. This isn't a bummer, just requires some time for updating your muscle memory;
  • high price (but good quality).

I think Kinesis had understood these problems and at some point they have introduced "Freestyle Pro" keyboard which has the design of Freestyle2 and the customization engine of Advantage2. It is also cheaper than Advantage2, so seems like a good alternative to me.

Thursday, July 9, 2020

DIY Headphone Equalization

Motivation

Back in time I already experimented with commercial packages for headphone equalization: Morphit by Toneboosters and Reference by Sonarworks. They offer means for correcting the frequency response of selected models of headphones in order to bring the sound closer to either a "reference" target curve or to the sound of some other model of headphones.

Although I still own Morphit I decided to try to devise my own way for headphone equalization. I had the following reasons for this:

  1. Although the range of headphone models measured by Toneboosters is quite wide, some of the models I do use: Audeze EL-8 Closed and Open are missing.

  2. I intend to use parametric equalizers with limited number of filters available—the equalizer built into MOTU AVB card. I also want to avoid using computers to save myself from the noise of their fans.

  3. I wanted to be sure that I apply correction that is relevant to my pair of headphones and to my head. Sonarworks emphasize that there are variations between different pairs of the same model and offers a service to measure your pair, or to sell you a pair of headphones which they have measured on their rig. I would also add that the low end performance of over-ear cans would differ depending on the state of the pads and the shape of the head of the person wearing them.

Thus my plan was to perform my own measurements of the headphones I have and try to bring their sound closer to each other. The practical task I had at hand was to bring the sound of Beyerdynamic T90 and Shure SRH1540 to the sound of Audeze EL-8 I mentioned above. Why to do that? One word—comfort. Let's compare how much do weight the headphones I own (with cable):

Model Weight, grams
Audeze EL-8 Closed 576
Audeze EL-8 Open 533
Beyerdynamic T90 394
Shure SRH1540 331
Massdrop 6XX 317
AKG K240 Studio 290

Although I really love the sound of EL-8 (both variants) their weight is killing me! So my plan was to equalize T90 to sound like the open model and SRH1540 to sound like the closed model. I chose T90 and Shure because their sound feels as "spacious" as in EL-8s, and it's only their tuning that feels wrong to me: T90 have too much highs, and it's unnatural and fatiguing, while SRH1540 have a very pronounced V-shaped tuning which I wanted to "flatten".

Measurement Methods

I used two methods I had previously mentioned in this post: moving microphone averaging (MMA) and on-head measurement using Sennheiser Ambeo Headset. Since the time I've made that post I've got a couple of updates on them.

Clock Drift with Ambeo Headset

One problem I had with Ambeo Headset is that due to lack of external synchronization use of Ambeo's ADC for input and an external DAC for output resulted in clock drift which creates a spectral shift when doing long (lasting several seconds) sweep measurements.

I have partially solved this problem by using the feature of Mac OS X audio system called "Aggregate Device". It allows combining two or more digital audio devices into a single one, and what's important, takes care of synchronizing their clocks:

This actually fixes the problem with shift of the measured amplitude across spectrum. However, because the drift correction only happens at certain periods, there is still phase shift occuring, especially at high frequencies. Due to this care must be taken when averaging multiple measurements.

MMA and Ambeo On-Head Methods Accuracy

Recall that I tried using the MMA method for reverse engineering the equalization applied by Audeze Cipher Cable for EL-8. Recently I cross-checked these measurements by performing an electrical measurement of this cable into a dummy load. Here is the FR graph acquired by QA401:

It confirms that there is a bass boost, but no other modifications, whereas my MMA measurements were also showing a "scoop" at middle frequencies. So turns out that scoop is a measurement error.

I decided to figure out the accuracy and usable range of both methods by doing several measurements in a row, averaging the result, then repeating the same process and comparing the averages. For the MMA method I came up with the following graph:

As we can see, the usable range is from 200 Hz and the variance is within +/- 0.5 dB. While on-head measurement using Ambeo headset gives the following:

So, the usable range is up to 4 kHz with the same variance. That means, the range from 200 Hz to 4 kHz can be used for judicious merging of the curves. Note that the resulting curve can't be compared with measurements obtained using standard headphone rigs. However, it can be used for comparing the tuning of various on-ear headphones and deriving equalization between them.

Note that even measurements done using different "standardized" head and torso simulators still can't be compared directly, as it can be seen from the past exchanges between Tyll Hertsens (ex-Innerfidelity) and Head-Fi, and Audeze.

Also note that before averaging the measurements done using Ambeo Headset I had to convert them to minimum phase first, because the clock drift I mentioned above produces skewed phase:

Thus we can only average the magnitude data. But that's OK considering that the MMA method, being a single channel measurement also provides magnitude data only.

The Equalization Process

This is the process I used:

  1. Obtain an averaged measurement of the headphones' left driver from 5 MMA measurements. I was performing these measurements by waving slowly the headphone earcup playing pink noise in front of the Beyerdynamic MM-1 microphone while capturing RTA 1/48 octave measurements in REW with infinite aveaging until I've reached 100 averages.

  2. Obtain an averaged measurement of the same driver from 5 on-head reseatings, this time using a 1M measurement sweep from the headphone into Sennheiser Ambeo Headset microphone.

  3. Merge the averaged measurements somewhere between 1 kHz and 2 kHz. I understand that this brings uncertainty in the process. However, the point can actually be found by comparing the slopes of the two curves. I applied 1/12 octave smoothing to both curves to simplify the process.

  4. Repeat the same process with another pair of headphones.

  5. Calculate the equalization curve by performing "A / B" operation in REW, where A is the curve of the target headphones and B is the curve of the headphones being equalized.

  6. Approximate this curve by adjusting PEQ in MOTU AVB equalizer.

Now here is an example of applying these steps to equalize Beyerdynamic T90 to sound like Audeze EL-8 Open back.

Below are the averaged graphs obtained for T90 from MMA and on-head measurements:

The merge point is at 2 kHz. And below are the averaged graphs for Audeze EL-8 Open:

Note that the 5–8 kHz drop that Tyll and Audeze were arguing about is absent from the MMA measurement. Whereas the notch around 5–6 kHz seen in on-head measurements done using Ambeo headset is the artefact of this headset, it appears on almost all measurements I've done using this technique.

And after we have obtained two merged curves it's time to divide them and obtain the suggested equalization curve. Below this curve is superimposed with the actual curve I've ended up using applying using the parametric equalizer of MOTU AVB. It doesn't follow the suggested curve precisely, it's a compromise that takes into account capabilities of the DSP on MOTU and my subjective judgement obtained by fast switching between these headphones on various tracks:

As we can see the equalization does shave off some high frequency from the factory tuning of T90 making them sounding more neutral.

And the similar procedure has been applied to equalize Shure SRH1540 to sound more like Audeze EL-8 Closed back. The suggested and resulting equalization curves are below:

The major correction here is to "straighten" the V-shape of the factory tuning.

The downside of the equalization done using IIR PEQ filters is non-uniform group delay. Ideally we would want to use linear phase filters. This is something to consider for future improvements.

Conclusions

Personally I liked the result of re-tuning which allowed me to combine the comfort of one pair of headphones with the sounding of another pair. As with any equalization we need to understand its limits. Of course, the properties of the drivers used in the headphones have great influence on the perceived sound "quality". As an example, initially I tried to make Massdrop 6XX to sound like EL-8 Open (recall that 6XX are second lightest headphones among those I have), however I was missing the sense of spatiousness and of having the soundstage wider than the headphones. T90 replicates this feeling better.

What are the alternatives for the approach I used here?

  1. Use ready-made equalization toolkit like Morphit. Pros are obvious: you just select the source and the target headphones and start "morphing". However, its database is not complete, and after all, you don't know how close your two pairs of headphones are to their measurements.

  2. Use some database provided by an enthusiast. Similar to the previous one but this time the equalization curve must be derived by yourself. This is doable if the database provides the data in some numerical format, not just pictures. Here the same concern about the variability between headphone instances applies. Be sure not to mix measurements provided from different sources. I know it appears compelling to compile graphs from various sources in order to create the most complete database, but this just doesn't make sense since curves from different rigs are not directly comparable. Reading this post by Crinacle explains a lot of things that can deviate from rig to rig.

  3. Order calibration for your headphones from a company like Sonarworks. I would do that if I were using headphones for professional music production, but for entertaiment purposes this seems like an overkill. Also, at least Sonarworks provide calibration data in a proprietary format only usable with their software. And fulfillment of measurement orders takes weeks, so it would be wise to approximate the equalization on your own before committing to that.

  4. Buy or build a complete measurement rig. Yes, that's the way to go if you intend to perform measurements and equalizations routinely. Here the question is about the reliability of measurements. For example, I've heard from owners of the miniDSP EARS rig that it's not very accurate at high frequencies, thus either a lot of averaging is required, or use of a different method like MMA is needed for obtaining measurements in that region. Whereas rigs from GRAS and other established measurement companies are pricey.