The utilities linked and described above Also, Cool Edit Pro (but anything else like Audacity would be fine) for minor editing like cropping the impulse response, smoothly fading it in and out at the ends, and scaling the amplitude so that it has approximately 0 dB gain (= -81.4 dB on the FFT plot) at 1 kHz.
I generate the MLS with the 'testgen' utility, and an input file like this:
mls 0 35 10010000000000000000 0.25 0
The length might be overkill, a shorter sequence could still give good enough results. The last two numbers are the amplitude on each channel, so, in this example, only the left channel is driven. The volume is set such that a 0 dBFS tone produces ~1 Vrms output level, which translates to about 100 dB SPL with the headphones tested. So, the SPL of the MLS is roughly 90 dB. It is not shown here, but I also include two long sine sweeps (for 90 and 100 dB SPL) that can be analyzed with 'thd_test' for THD vs. frequency plots and cleaner (less noisy than with MLS) frequency response.
The following command then creates the test signal in WAV format:
testgen mls.txt mls.wav 96000 16
The next (and most difficult) step is to actually perform the measurement. Here, I used a Behringer ECM8000 microphone temporarily turned into an ear bud (that also has a useful side effect of blocking the loud test signals), but this method has poor and inconsistent frequency response in the treble range, and is not really suitable for any serious measurements above a couple kHz. The ECM8000 is rather noisy as well. The microphone is connected to a DIY pre-amplifier and 24V phantom power supply, and finally to the line input of the same sound card that was used for playback as well. If the DAC and ADC were not on the same device, then further measurements (using a constant frequency tone and the 'sinetest' utility) would be needed for correcting the clock frequency mismatch.
Once the recording is done, the impulse response(s) can be extracted from the MLS with
convolve mls.wav ir.wav 10010000000000000000 -inv=1
The sample rate correction factor measured with 'sinetest' could be added with the -m parameter if it was necessary, but with a complex test file containing multiple signals it is better to resample and synchronize it with 'resample'. Since the ADC and DAC shared the same clock here, no correction was needed.
The impulse response file is then edited as described above to remove the unneeded parts.