By Philipp Paul Klose (https://www.linkedin.com/in/philipp-paul-klose-280813145 https://kurzschlussklose.wordpress.com)
Disclaimer: This is an advanced application note requiring knowledge in command line tool usage, convolution and advanced acoustics. Note that topics/software used here are without any support from the miniDSP support team or the author. It's a starting point to the exciting field of analyzing Psychoacoustic parameters and we hope you enjoy it!
You have probably used your miniDSP microphone(s) for acoustic measurement of loudspeakers and sound equipment. Besides that, the microphones can also be used for other interesting purposes!
Measuring the psychoacoustic sound quality of audio sources is one of them. The human perception works different and is more complex than the parameters we use to describe acoustic and electro-acoustic quality (frequency response, distortion, RT60, etc.). For psychoacoustic analysis, a set of metrics like loudness, tonality roughness and sharpness (among others) is being used to describe the sound quality. These require their own set of software tools for calculation.
This tutorial will show you how to measure the perceived loudness, roughness and sharpness of audio files with MOSQITO and the miniDSP USB microphones.
1. Getting Started - What You Need
- python3. Download the software from org
- pip3 packet manager. If you need pip, download and find install instructions from https://pip.pypa.io/en/stable/
- MOSQITO: https://github.com/Eomys/MoSQITo. Download and install via pip through the terminal command that can be found here https://pypi.org/project/mosqito/
- An audio recording appg. https://www.ocenaudio.com
- Room EQ Wizard (REW) https://www.roomeqwizard.com
- A convolution audio plugin (e.g. https://www.meldaproduction.com/MConvolutionEZ)
2. Record An Audio Signal With ocenaudio
Connect your equipment and record an audio file. MOSQITO can handle different bit depths, but the sample rate must be 48 kHz and one track (mono)! Here, I have recorded a kitchen machine and here is the original file for download.
With right-click on the recorded file in ocenaudio, split the file to two mono files. Save the files.
3. Burn-In Correction Filter
In order to apply the needed calibration to the recorded files, the deficiency correction of the measurement microphone must be applied to the recorded audio signal. Since this not a “regular” frequency range and distortion analysis in the frequency-domain (like it is done e.g. in REW or Dirac Live), the calibration cannot be applied through the import of a text file. It must be applied (burnt-in) directly via convolution into the audio recording.
- Import your calibration file into REW
- Generate a minimum phase response
- Export filter IR (normalised)
- Apply that created filter via a convolution plugin (e.g. in ocenaudio via MconvolutionEZ plugin or via the ReaVerb plugin in REAPER) and export with the effect applied.
Here is the end result at this stage as a wav file you can download here.
4. Calibration
Preparation
To find the right calibration factor in MOSQITO, we first need to check in REW the „Peak input before clipping in REW“. It can be found in the bottom row of the app.
0 dBFS = 107 dBSPL. That is our calibration relation. Note that if you change your gain on your microphone, that figure will change and the cal factor must be adapted!
Calibration must be chosen accordingly to the calibration relation in MOSQITO. A 1kHz 0 dBFS input file is interpreted with the used calibration factors as the following dBSPL:
1.0 = 91 dBSPL = 1kHz 0 dBFS
2.0 = 96.97 dBSPL = 1kHz 0 dBFS
3.0 = 100.5 dBSPL = 1kHz 0 dBFS
4.0 = 102.9 dBSPL = 1kHz 0 dBFS
5.0 = 104.97 dBSPL = 1kHz 0 dBFS
6.0 = 106.5 dBSPL = 1kHz 0 dBFS
7.0 = 107.83 dBSPL = 1kHz 0 dBFS
8.0 = 109 dBSPL = 1kHz 0 dBFS
9.0 = 110 dBSPL = 1kHz 0 dBFS
10.0 = 111 dBSPL = 1kHz 0 dBFS
11.0 = 111.8 dBSPL = 1kHz 0 dBFS
12.0 = 112.57 dBSPL = 1kHz 0 dBFS
6.3 is the cal factor we need in our case, since 0 dBFS in our recording equals 107 dBSPL.
To control the calibration setup, we generate a sine wave with a level that equates to the level of 94 dBSPL (= -13 dBFS) and max level 107 dBSPL (= 0 dBFS).
Since REW currently only generates two-channel files (as of now with v5.20.4), the generated file must be split (like the stereo recording done before) into mono files e.g. with ocenaudio.
To start validation of our measurement system, we use the terminal/shell/powershell and start python via command “python3” and the paste the code: NOTE: You have to change the sys.path.append, path of audio signal for and calibration factor your own analysis!
Is -13 dBFS = 94 dBSPL? Yes!
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
analysisSignal = Audio(
"/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/1k_-13dBFS.wav",
calib=6.3,
)
analysisSignal.compute_level(nb_points=1000,start=0.0,stop=1)
analysisSignal.level.plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
)
Is 0 dBFS = 107 dBSPL? Yes!
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
analysisSignal = Audio(
"/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/1k_0dBFS.wav",
calib=6.3,
)
analysisSignal.compute_level(nb_points=1000,start=0.0,stop=1)
analysisSignal.level.plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
)
5. Example analysis
As an example, I have recorded a kitchen machine from ca. 1m distance.
SPL over time
Start python via the terminal or console via the command “python3”.
The SPL over time is plotted to understand what is going on in the time domain and to check if analysis boundary times (start and stop times) are right.
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
analysisSignal = Audio(
"/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/kitchenmachineL.wav",
calib=6.3,
)
analysisSignal.compute_level(nb_points=1000,start=0.0,stop=5.2)
analysisSignal.level.plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
)
Loudness over time
From here we can go straight to the perceived loudness over time with the code:
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
path = "/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/kitchenmachineL.wav"
analysisSignal = Audio(
path,
calib=6.3,
)
analysisSignal.compute_loudness(field_type="free")
analysisSignal.loudness_zwicker.plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
)
Roughness
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
signal = Audio(
"/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/kitchenmachineL.wav")
signal.compute_roughness()
signal.roughness["Daniel Weber"].plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
y_min=0,
y_max=1.4,
)
Sharpness
import sys
sys.path.append('/opt/homebrew/lib/python3.9/site-packages/mosqito')
from mosqito import COLORS
from mosqito.classes.Audio import Audio
analysisSignal = Audio(
"/Users/philipppaulklose/Desktop/miniDSP Article Sound Quality/kitchenmachineL.wav",
calib=6.3,
)
analysisSignal.compute_sharpness(method="din", skip=0.2)
analysisSignal.sharpness["din"].plot_2D_Data(
"time",
type_plot="curve",
color_list=COLORS,
)
That’s it! Hope you had fun! The documentation in the github repository from Eomys includes even more tutorials.
6. Further reading
- MOSQITO Tutorials https://github.com/Eomys/MoSQITo/tree/master/tutorials
- https://eomys.com/e-nvh/technical-notes-on-electromagnetically-excited-noise-and-vibrations/article/what-is-psychoacoustic?lang=en/
- https://en.wikipedia.org/wiki/Psychoacoustics
- http://www.cochlea.eu/en/sound/psychoacoustics