MLP: a MATLAB toolbox for rapid and reliable auditory threshold

Here we present MLP, a MATLAB toolbox implementing the maximum likelihood adaptive procedure for auditory threshold estimation developed by Green (1990, 1993). This adaptive procedure is particularly appealing for those psychologists that need to estimate auditory thresholds with a good degree of accuracy and in a short time. MLP comes with a graphical interface and it is provided with several built-in, classic psychoacoustics experiments ready to use at mouse click.

System requirements and install

MLP has been developed to work with MATLAB 7.0 or higher. In the current web page, the user will find the complete list of the toolbox’s functions and the most updated list of the available experiments together with a brief description of them. MLP works with any operative system and does not require additional MATLAB toolboxes. All MLP functions are compressed in a zip archive ( that the user needs to expand and copy into the MATLAB “toolbox” folder. The user needs also to “add with subfolder” all the toolbox contents in the MATLAB path. All functions have a command line help. The help can be seen typing “help” followed by the function name at the MATLAB prompt. Note that the MLP toolbox is distributed together with the STAIRCASE toolbox that implements the classic nonparametric staircase adaptive procedure.

Once the toolbox has been installed, to start an experiment type MLP at the MATLAB prompt. This call visualizes the following graphical interface. You can now select the experiment you want to run.

The algorithm to estimate the subject's threshold

MLP implements the maximum likelihood procedure for the threshold estimation (Green, 1990, 1993).  In the following link you fill find the MATLAB functions that enable to implement this particular technique.
Click here to see the list of the functions involved in the threshold search.

The built-in experiments

The majority of built-in experiments are classic psychoacoustics experiment. Some are “translations” for the ML adaptive procedure of a subset of experiments performed by Kidd, Watson and Gygi (2007). These authors run nine-teen classic psychoacoustics experiments on a large (N=340) number of adult subjects. The MLP user running these experiments can thus compare his/hers’ own results with those reported in that study. All built-in experiments come with default parameters. The user can, however, change parameters at will. If changes are made and saved they will be kept until the next “SAVE DEFAULTS” command will be called. When the user presses “START” the experiment begins and the stimuli are presented to the subject. PLEASE REMEMBER TO PRESS THE "UPDATE P-TARGET" BUTTON BEFORE STARTING THE EXPERIMENT.
Click here to see the list of the available experiments.

How to to respond

In all built-in experiment the subject responds by pressing the key-numbers of the computer keyboard. In nI-nAFC experiments the subject reports the temporal position of the variable stimulus. For example, in a 4AFC task, if the subject thinks that the variable stimulus was the third stimulus presented s/he has to press “3”. In yes/no task, the “1” number corresponds to the answer “yes, I perceived/detect” and any other number (e.g, “0”) corresponds to the “no, I don’t perceive/detect” answer. Key pressures must be followed by the “return” key.

The MLP datafiles

MLP saves two data files (tab-delimited, flat format, text files) in the MATLAB current directory. The first is an extended data file that contains all experiments’ events: i.e., subject number, name, sex, age and note, block number, trial number, level of the stimulus presented, subject’s response, threshold estimated after each trial and estimated false alarm rate γ (please note this last estimate is for yes/no tasks only). In this file the subjects’ responses are coded as “1” (“yes”, or correct) and “0” (“no”, or wrong). The name of this file can be set by the user through the graphical interface. The second data file contains only the subject’s threshold and it is saved after each subject. By default, the name of this file is the subject’s name. If the user do not input the subject’s name the file is called “untitled.txt”

How to change the experiment parameters

In the case the specifics of the built-in experiments do not match the experimenter’s needs s/he can edit them and adapt them to his/hers own needs. The characteristics of the sounds of each experiments are written at the beginning of the experiment.m files and can be easily changed. See the following picture

For example, let suppose we want to change the fundamental frequency of the tone to do4 (i.e., 261,6 Hz) and the duration to 500-ms:

More advanced MATLAB users can write their own experiments by take as example any of the built-in experiments.

How to write a new experiment

All experiments file have the same structure and develop in four steps. It is here that sounds are generated and least one sound needs to have a variable parameter: i.e., the stimulus level that we adaptively change during the ML procedure. In all built-in experiments the variable parameter is called “var_level”. The experiment function must also play the sound(s) to the subject and must contain is a variable that tells the toolbox which keyboard-key corresponds to a positive answer (i.e., “pos_ans” in all built-in experiments). In yes/no tasks this variable informs the toolbox about which key the subject has to press in order to provide a yes response. In nAFC tasks, this variable informs the toolbox about the key the subject has to press to give the correct response. Moreover, it is within the experiment function that we write the experimental question the subject has to answer. The question will be echoed on screen to the subject during each trial. The last fundamental step when writing the experiment.m function pertains multiple intervals nAFC tasks only. In this kind of task the temporal order of variable and standard sound must be randomized in each trial.
Click here to see one of the experiments currently implemented with the toolbox.

Signal Generators

MLP is provided with several signal generators and modifiers. Signal generators and modifiers are used by built-in experiment to create the sounds for the experiment. These functions can also used to create the sounds for your own experiment.
Click here to see the list of the available signal generators and modifiers.

Toolbox calibration

If you have a sound level meter and/or an artificial ear you can calibrate the toolbox. First of all, it is important to know that the level of all sounds used in the toolbox is manipulated in dB FS. That said, if you want to calibrate one experiment you need to proceed as follow. Let's suppose you want to calibrate the absolute threshold experiment. Firstly, look at the level of the sound you want to calibrate. In the absolute threshold experiment, the sound is a 1 kHz pure tone and the "starting level" of this tone is set to -10 dB FS (default value). Successively, synthesize an identical level (but longer) 1 kHz pure tone with the following commands:
    % sf = 44100;   % sample frequency
    % f = 1000;     % tone's frequency (Hz)
    % d = 10000;    % tone's duration (ms)
    % level = -10;  % tone's level (dB FS)
    % synthesize the tone
    calibration_tone = GenerateTone(sf, d, f);
    % set the level of the tone to "level"
    calibration_tone = AttenuateSound(calibration_tone, level);
Now, get your level meter, play the calibration tone and read how many dB SPL (or dBA) is displaying. To play the calibration tone in matlab use the following command:
    % play the tone with the matlab "sound" command
    sound(calibration_tone, sf)
Let's suppose your level meter is displaying "60 dB SPL". You now know the difference linking the dB FS (used within the toolbox) with the dB SPL scale (used by your sound level meter) which is +70 dB (i.e., 60 dB SPL - (-10 dB FS)). Now, run the experiment. If the threshold results -50 dB FS, the threshold expressed in dB SPL is 20 dB SPL (i.e., -50+70).

Bug/problem report

If you find a bug (or you come across a problem) when you are using the toolbox write us an email. What to write in this email:

"Please! Don't thank us. Cite us."

The toolbox is freely distributed. However, we would be happy if you would acknowledge the use of MLP when you publish your research [e.g., "experiments used a classic adaptive procedure (Green, 1990, 1993) implemented by the MLP MATLAB toolbox (Grassi & Soranzo, 2009)]. Here is the full reference for the MLP's companion paper:
The the paper can be viewed here.

Download MLP

Click here to download the toolbox: you will download the latest version of MLP and STAIRCASE toolbox.

Authors' note

MLP is constantly under development. Check  the current web page for the most updated version of MLP. We will be happy to upload your experiments in the toolbox for free distribution.
Massimo Grassi and Alessandro Soranzo