Login processing...

Trial ends in Request Full Access Tell Your Colleague About Jove


Semi-Automated Analysis of Peak Amplitude and Latency for Auditory Brainstem Response Waveforms Using R

Published: December 9, 2022 doi: 10.3791/64737


This article describes the semi-automated measurement of the amplitudes and latencies of the first five peaks and troughs in the auditory brainstem response waveform. An additional routine compiles and annotates the data into a spreadsheet for experimenter analysis. These free computer routines are executed using the open-source statistical package R.


Many reports in the last 15 years have assessed changes in the auditory brainstem response (ABR) waveform after insults such as noise exposure. Common changes include reductions in the peak 1 amplitude and the relative latencies of the later peaks, as well as increased central gain, which is reflected by a relative increase in the amplitudes of the later peaks compared to the amplitude of peak 1. Many experimenters identify the peaks and troughs visually to assess their relative heights and latencies, which is a laborious process when the waveforms are collected in 5 dB increments throughout the hearing range for each frequency and condition. This paper describes free routines that may be executed in the open-source platform R with the RStudio interface to semi-automate the measurements of the peaks and troughs of auditory brainstem response (ABR) waveforms. The routines identify the amplitudes and latencies of peaks and troughs, display these on a generated waveform for inspection, collate and annotate the results into a spreadsheet for statistical analysis, and generate averaged waveforms for figures. In cases when the automated process misidentifies the ABR waveform, there is an additional tool to assist in correction. The goal is to reduce the time and effort needed to analyze the ABR waveform so that more researchers will include these analyses in the future.


The auditory brainstem response (ABR) is frequently used to determine hearing thresholds in animal subjects and human infants. As the ABR is an electroencephalogram (EEG) record of the first responses of the nervous system to auditory stimuli, it carries additional information that reflects the coordinated firing of cochlear spiral ganglion neurons and early signal processing in the auditory brainstem, including bilateral processing1. These responses may be affected by noise trauma. For example, noise exposure that is sufficient to induce a temporary threshold shift in mice can also permanently reduce the amplitude of ABR peak 12. Moreover, such trauma may reduce the interpeak latencies and increase the relative amplitudes of the later peaks3, possibly due to a loss of inhibitory regulation4. In addition to these findings, specific genetic mutations have been shown to alter the ABR waveform in the absence of trauma5,6,7. Thus, the routine analysis of ABR waveforms can provide insight into the auditory system in experimental models.

There has also been interest in using ABR waveforms as a diagnostic tool for patients. Previous reports have assessed whether the ABR peak 1 is reduced in human patients after noise exposure or in tinnitus patients8,9. Notably, migraine attacks have been reported to temporarily increase the interpeak latencies for several weeks, after which the ABR waveform returns to normal in affected individuals10. COVID-19 has been reported to drive long-term alterations in ABR interpeak latencies11,12, although another study reported different results13. Hearing loss is often co-morbid with dementia in aging, and individuals with greater hearing loss tend to experience dementia that advances more rapidly14. Researchers have investigated ABR waveform changes in neurodegenerative diseases, such as Parkinson's disease (reviewed in Jafari et al.15) and Alzheimer's disease (reviewed in Swords et al.16), as well as in normal aging17. As more researchers and clinicians investigate sensory deficits as biomarkers for common diseases in aging, techniques such as ABR may become routine in health care.

An examination of the methods sections in the literature reveals that labs often write custom scripts in MatLab for analyzing ABR waveforms. The ABR platform made by Intelligent Hearing Systems has a function for waveform analysis, but it requires an operator to manually select the peaks and troughs. Here, we have written semi-automated analysis routines for the open-source, freely available statistical environment R and the RStudio interface. This report compares the data obtained using our routines to the data obtained by having an experimenter manually identify the peaks and troughs and shows that the data from the two methods are strongly correlated. Importantly, the routines incorporate a blinding function, in which the metadata for the samples are placed in a separate file that is not incorporated until the end. These functions have streamlined waveform analysis for our lab.


All procedures performed on animals were approved in advance by the University of Rochester Committee for Animal Research. The experimental subjects were 12 wild-type F1 male and female mice at 1 month of age. These F1 mice are the product of mating a CBA/CaJ dam and a C57BL/6J sire. The mice were bred and housed in the vivarium facility with a standard 12 h light/dark cycle, unlimited food and water, and ample nesting supplies. No more than five same-sex siblings were housed together in one cage.

1. Obtaining data for analysis

NOTE: This step must comply with institutional guidelines and be pre-approved by the institutional animal welfare committee. The detailed process for generating ABR data from mice has been described elsewhere18.

  1. Record the ABR with the platform of choice.
    NOTE: In the instance shown here, the recordings were performed on mice.
    1. Use a 5 ms click stimulus beginning at a 75 dB sound pressure level and decreasing in 5 dB steps to 5 dB. Record an average of 512 sweeps for each amplitude. Reject responses if their peak to trough amplitude is greater than 31 µV at any instance between 1.3 ms and 12.5 ms after the stimulus.
      NOTE: Recordings from tone pip presentations may also be used. We anticipate that the analysis routine will work for other species, including humans.
  2. Export the ABR recording as an ASCII file.
    1. For IHS, open the computer program.
    2. Load the file of interest, and display the desired waveforms on one page.
    3. Under the Data tab, select Save Page as ASCII to obtain a .txt file.
    4. After naming the data file appropriately ("ID"), record the ID and subject information in a metadata file entitled "info.csv." Ensure that the "ID" does not include any information such as the genotype, sex, age, or treatment; this information is instead recorded in "info.csv."
      NOTE: A fair deck of playing cards can be used to randomly assign labels if needed.
    5. Repeat with all the files to be analyzed as separate "ID" files.

2. Installing the required packages and loading the data onto the working computer

  1. Download and install R (https://www.r-project.org) and RStudio (https://www.rstudio.com). 
    NOTE: The protocol described here used R ≥ 4.0.0.
  2. Install the required libraries, tidyverse, shiny, plotly, and zoo, by typing the following command in the command window of RStudio:
  3. Download the scripts FindPeaks.R and See_trace_click.R from the White lab GitHub (https://github.com/PWhiteLab/FindPeaks), as well as the associated file “Time.csv.”
  4. Create a new folder to contain all the ASCII files, "info.csv", and "Time.csv." For this example, name the folder "Test_Folder." Within "Test_Folder," place the ASCII files in a subfolder entitled "ASCII_Folder."

3. Obtaining the preliminary analysis with FindPeaks.R

  1. Open the FindPeaks.R script in RStudio.
  2. Right-click on the tab for the script in the tool bar to select Set working directory, and set it to Test_Folder (see Supplementary Figure S1A).
  3. In the script window, click Source on the upper right-hand side of the toolbar to load the program (see Supplementary Figure S1B).
  4. In the command window, use the following commands to analyze the waveforms (see Supplementary Figure S2):
    FindPeaks_single("ASCII_folder/ID.txt") for individual files (see Supplementary Figure S2A)
    FindPeaks_group("ASCII_Folder") for batch processing (see Supplementary Figure S2B)
    ​NOTE: The script will output (1) pdf files displaying the waveforms with labeled peaks and troughs (see Supplementary Figure S2C) and (2) an ID.csv file containing the numerical data for the amplitude (µV) and latency (ms). Both files will be placed in "Test_Folder".

4. Verifying the preliminary analysis

NOTE: At low sound levels, parts of the waveform may become difficult to distinguish from noise, and FindPeaks.R may misidentify the peaks or troughs compared to the experimenter's opinion. If there is a discrepancy, then the .csv file can be amended with data obtained from the script See_trace_click.R.

  1. Load the waveform data for the specific individual using the command (see Supplementary Figure S3A):
    Waveform <- ASCII_extract("ASCII_Folder/ID.txt")
  2. Open the See_trace_click.R script in RStudio.
  3. In the header on the left, click the Run App button, and wait for a new interactive (Shiny) window to appear (see Supplementary Figure S3B).
  4. In the box on the top left, input the sound level for the waveform that requires revision, and look for the waveform displayed in the window.
  5. Move the cursor around the waveform to reveal the latency and amplitude at any point.
  6. Click on the correct peak and the following trough to record the data in the table below. Copy and paste the latency data into the .csv file (see Supplementary Figure S3C).
  7. To calculate the amplitude measurement, subtract the following trough amplitude from the peak amplitude in the spreadsheet cell.

5. Compiling and visualizing the dataset

  1. Transfer the verified .csv files to a new subfolder in Test_Folder entitled "Peak_Data."
  2. Append the data into a single .csv file and name it "Peak_Data.csv."
  3. Use the following command:
    Compile ("Peak_Data")
    NOTE: This script combines the metadata from info.csv with Peak_Data.csv to label the data with group information. It also automatically calculates the interpeak latencies and amplitude ratios.
  4. Perform statistical analysis on the compiled data.
    1. Use a test for normality, such as the Shapiro-Wilks test, to assess the distribution of the data with the following function:
    2. If the Shapiro-Wilks test is not significant, the data set has a normal distribution; hence, assess the data with a parametric test such as ANOVA with the following function:
    3. If the Shapiro-Wilks test is less than p = 0.05, use the Kruskal-Wallis rank sum test (with the function below) or another appropriate non-parametric measure (see other possibilities in the discussion).
  5. To display average waveforms, use the following command:
    Average_Waveform("ASCII_Folder ", aes(x = Data_Pnt_ms, y = "dB", group = Genotype, color = Genotype))
    NOTE: This command shows the average waveforms for different genotypes in different colors. For the y variable dB, insert the number that corresponds to the desired amplitude, such as 75, without quotation marks. For other comparisons, use the corresponding group label from the metadata.

Representative Results

We tested the routines on ABR waveform responses to a click series, beginning at 75 dB and stepping down in 5 dB increments to 5 dB. These data were obtained as previously described19. We also tested the tool on tone pip data and obtained similar results. ABR data from most ABR systems can be exported as .txt (ASCII) files. We loaded ABR ASCII files onto a computer and opened them in RStudio as described in the protocol. After running the FindPeaks.R routine in batch form, we obtained sample waveforms with automated labeling (Figure 1) and a .csv file with the results. The results were reviewed to remove irrelevant peaks. To validate the automated labeling, we also used the ABR program capability to manually label the first five peaks and troughs on each waveform obtained with the click series described above. The experimenter performing this task had 2 years of experience recording and analyzing ABR data. Figure 2 shows this comparison, with the automated FindPeaks.R data in red and the manually obtained data in black. Each trace represents the data from a single mouse. The average for both methods with one standard deviation is also displayed. The results obtained by FindPeaks.R correlate strongly with results obtained manually (see Supplementary Figure S4).

Figure 1
Figure 1: Representative waveform response to a 75 dB click stimulus for a young F1 mouse. Latency in milliseconds is plotted on the x-axis, and amplitude in microvolts is plotted on the y-axis. The peaks were automatically identified with FindPeaks.R and are labeled in red, whereas the troughs are labeled in blue. Please click here to view a larger version of this figure.

Figure 2
Figure 2: Comparison of the data obtained from the manually identified peaks to the data provided by the FindPeaks.R analysis. (A,C,E,G,I) Amplitudes in microvolts and (B,D,F,H,J) latencies in milliseconds are plotted for sound levels between 5 dB and 75 dB (x-axis, all graphs) for peaks I-V in the waveforms obtained for click stimuli presented to 12 mice. The manually obtained values (black) are compared to the same datasets analyzed with FindPeaks.R (red). The averages are plotted as heavy lines, with the shaded region representing one standard deviation. No differences were seen between the methods when assessed with the Kruskal-Wallis rank sum test (A, difference = 0.0547977 ± 0.0010028, max = 0.96, p = 0.9216; B, difference = −0.0001734 ± 0.0001214, max = 0.04, p = 0.8289; C, difference = −0.0212209 ± 0.0006806, max = 0.92, p = 0.9687; D, difference = −0.0011047 ± 0.0001556, max = 0.06, p = 0.771; E, difference = −0.0323077 ± 0.0006169, max = 0.66, p = 0.899; F, difference = −0.0072189 ± 0.0001460, max = 0.04, p = 0.8644; G, difference = 0.201754 ± 0.0007407, max = 0.64, p = 0.9312; H, difference = −0.0007018 ± 0.0001717, max = 0.09, p = 0.8013; I, difference = 0.0347561 ± 0.0007343, max = 1.05, p = 0.8856; J, difference = −0.0078049 ± 0.0002762, max = 0.16, p = 0.886), and the results were highly correlated (chi-squared values: A, 0.009696; B, 0.046684; C, 0.0015395; D, 0.084742; E, 0.016102; F, 0.029153; G, 0.0074604; H, 0.063322; I, 0.020699; J, 0.020544; differences presented as mean ± SEM; max = absolute maximum difference). Please click here to view a larger version of this figure.

Supplementary Figure S1: Analysis with FindPeaks.R. (A) Selecting the working directory (see protocol step 3.2); (B) loading the program (see protocol step 3.3). Please click here to download this File.

Supplementary Figure S2: Script output and commands for the analysis of the waveforms. Commands for (A) individual files and (B) batch processing. (C) Output PDF file showing waveforms with labeled peaks and troughs. See protocol step 3.4. Please click here to download this File.

Supplementary Figure S3: Verification of the analysis. (A) Loading the waveform data (see protocol step 4.1). (B) Location of the Run App button. The sample data file is also indicated. (C) Shiny window with a waveform. In this instance, the sound level is 75 dB, as entered in the top window. Clicking on a desired peak and the following trough records the data for the amplitude and latency in the table (protocol step 4.6). Peak 3 data are shown. Please click here to download this File.

Supplementary Figure S4: Comparison of the individual data obtained from the manually identified peaks to the data provided by the FindPeaks.R analysis. (A,C,E,G,I) Amplitudes in microvolts and (B,D,F,H,J) latencies in milliseconds are plotted for sound levels between 5 dB and 75 dB (x-axis, all graphs) for peaks I-V in waveforms obtained for click stimuli presented to 12 mice. Each animal is labeled with a unique color, as shown in the legend. The data obtained with FindPeaks.R are labeled with solid colors, while the data obtained manually are labeled with less saturated versions of the same colors. While both data sets are plotted in this figure, when they are identical, only one line is apparent. Please click here to download this File.


The protocol described in this publication should help streamline the acquisition of data describing voltage amplitude ratios and latency intervals for ABRs to clicks and tone pips. By employing single commands in RStudio, an experimenter may extract, compile, and display this information in a single document for statistical analysis. By making this analysis routine, we hope that the field will discover new ways that the ABR can be altered in development, in aging, or by insult in different species. Such information could be valuable for identifying important mechanisms similar to synaptopathy from noise2. The young mice used for this experiment had highly variable responses, likely because the auditory brainstem is still maturing at this age20. Nonetheless, the two methods of quantification showed very strong correlations (Figure 2).

The script uses a file called "Time.csv" to set intervals within the data for peak identification. Briefly, a maximal voltage amplitude occurring in a specified time interval is labeled "peak 1", a voltage minimum occurring in the following interval is labeled "trough 1", and so on. We chose the intervals to encompass the latencies of both the click and tone pip responses for CBA/CaJ mice aged 1 month to 12 months old using frequencies spanning 8 kHz to 32 kHz. We successfully used the tool to also measure tone pip responses in mice. Other species, including humans, also have ABR responses within similar windows, and we anticipate that this tool can also be used for data from other species. We would recommend using the new parallel ABR method for humans21, which produces excellent waveforms. The time interval limitation restricts the use of this tool to assessing immediate ABR responses. We note, however, that the interval data in this file could be altered by users to automate the measurements of ABR responses to speech or of event-related potentials (ERPs) that characteristically occur at different times in response to sound.

Some features of the statistical treatment of this data are worth highlighting. To our knowledge, the field does not have a standardized treatment for distinguishing amplitude progressions. Early studies used ANOVA22,23. The data from the click series here (Figure 2) were non-parametric, leading to the use of the Kruskal-Wallis rank sum test. Similar to ANOVA, the Kruskal-Wallis rank sum test assesses differences in the values obtained at a given level of a stimulus; that is, it compares the lines obtained on the graph. However, other treatments are also possible. Biologically, amplitude progressions reflect the additional recruitment of higher-threshold neurons as the stimulus level increases. This suggests that the area under the curve, which represents the integrals of the lines, could be the more relevant measure. Generalized estimating equations (GEE) may be used to model individual data for an integral analysis, as in Patel et al.5. Notably, GEE analysis can take into consideration the repeated measures design of these experiments. As more researchers discuss the data analysis methods, we anticipate the emergence of a consensus on best practices.

In conclusion, this paper presents free and easy-to-use tools for measuring, compiling, and visualizing ABR waveforms. These tools can be used by novice students of RStudio by following this protocol, and they incorporate a blinding step for improved rigor and reproducibility. We foresee that routine ABR waveform analysis will enable the discovery of insults, genetic variants, and other treatments that can affect auditory function.


The authors have no conflicts of interest.


This work was supported by two grants from the NIDCD to PW: R01 DC018660 and an administrative supplementary award, R01 DC014261-05S1.


Name Company Catalog Number Comments
C57BL/6J  mice Jackson Labs 664
CBA/CaJ mice Jackson Labs 654
E-series PC Dell n/a (this equipment was discontinued) This runs the IHS system.
Mini-anechoic chamber Industrial Acoustics Company Special order number 104306 This enclosure reduces noise levels for auditory testing of animals.
Optiplex 7040 Dell i5-6500 Rstudio may also be run on a Mac or Linux system.
Universal Smart Box Intelligent Hearing Systems n/a (this equipment was discontinued) Both TDT and IHS can output hearing data as ASCII files.



  1. Gopal, K. V., Pierel, K. Binaural interaction component in children at risk for central auditory processing disorders. Scandinavian Audiology. 28 (2), 77-84 (1999).
  2. Kujawa, S. G., Liberman, M. C. Adding insult to injury: Cochlear nerve degeneration after "temporary" noise-induced hearing loss. Journal of Neuroscience. 29 (45), 14077-14085 (2009).
  3. Salvi, R. J., Wang, J., Ding, D. Auditory plasticity and hyperactivity following cochlear damage. Hearing Research. 147 (1-2), 261-274 (2000).
  4. Schrode, K. M., Muniak, M. A., Kim, Y. H., Lauer, A. M. Central compensation in auditory brainstem after damaging noise exposure. eNeuro. 5 (4), (2018).
  5. Patel, S., et al. SIRT3 promotes auditory function in young adult FVB/nJ mice but is dispensable for hearing recovery after noise exposure. PLoS One. 15 (7), 0235491 (2020).
  6. Milinkeviciute, G., Chokr, S. M., Castro, E. M., Cramer, K. S. CX3CR1 mutation alters synaptic and astrocytic protein expression, topographic gradients, and response latencies in the auditory brainstem. Journal of Comparative Neurology. 529 (11), 3076-3097 (2021).
  7. Ison, J. R., Allen, P. D., Oertel, D. Deleting the HCN1 subunit of hyperpolarization-activated ion channels in mice impairs acoustic startle reflexes, gap detection, and spatial localization. Journal of the Association for Research in Otolaryngology. 18 (3), 427-440 (2017).
  8. Chen, F., Zhao, F., Mahafza, N., Lu, W. Detecting noise-induced cochlear synaptopathy by auditory brainstem response in tinnitus patients with normal hearing thresholds: A meta-analysis. Frontiers in Neuroscience. 15, 778197 (2021).
  9. Santos-Filha, V. A., Samelli, A. G., Matas, C. G. Noise-induced tinnitus: Auditory evoked potential in symptomatic and asymptomatic patients. Clinics. 69 (7), 487-490 (2014).
  10. Kochar, K., Srivastava, T., Maurya, R. K., Jain, R., Aggarwal, P. Visual evoked potential & brainstem auditory evoked potentials in acute attack & after the attack of migraine. Electromyography and Clinical Neurophysiology. 42 (3), 175-179 (2002).
  11. Gedik, O., Husam, H., Basoz, M., Tas, N., Aksoy, F. The effect of coronavirus disease 2019 on the hearing system. Journal of Laryngology and Otology. 135 (9), 810-814 (2021).
  12. Ozturk, B., Kavruk, H., Aykul, A. Audiological findings in individuals diagnosed with COVID-19. American Journal of Otolaryngology. 43 (3), 103428 (2022).
  13. Dror, A. A., et al. Auditory performance in recovered SARS-COV-2 patients. Otology & Neurotology. 42 (5), 666-670 (2021).
  14. Lin, F. R., et al. Hearing loss and incident dementia. Archives of Neurology. 68 (2), 214-220 (2011).
  15. Jafari, Z., Kolb, B. E., Mohajerani, M. H. Auditory dysfunction in Parkinson's disease. Movement Disorders. 35 (4), 537-550 (2020).
  16. Swords, G. M., Nguyen, L. T., Mudar, R. A., Llano, D. A. Auditory system dysfunction in Alzheimer disease and its prodromal states: A review. Ageing Research Reviews. 44, 49-59 (2018).
  17. Konrad-Martin, D., et al. Age-related changes in the auditory brainstem response. Journal of the American Academy of Audiology. 23 (1), 18-35 (2012).
  18. Navntoft, C. A., Marozeau, J., Barkat, T. R. Cochlear implant surgery and electrically-evoked auditory brainstem response recordings in C57BL/6 mice. Journal of Visualized Experiments. (143), e59073 (2019).
  19. Gilels, F., Paquette, S. T., Beaulac, H. J., Bullen, A., White, P. M. Severe hearing loss and outer hair cell death in homozygous Foxo3 knockout mice after moderate noise exposure. Scientific Reports. 7, 1054 (2017).
  20. Rubio, M. E. Auditory brainstem development and plasticity. Current Opinion in Physiology. 18, 7-10 (2020).
  21. Polonenko, M. J., Maddox, R. K. The parallel auditory brainstem response. Trends in Hearing. 23, 2331216519871395 (2019).
  22. Shi, L., et al. Noise-induced damage to ribbon synapses without permanent threshold shifts in neonatal mice. Neuroscience. 304, 368-377 (2015).
  23. Lin, H. W., Furman, A. C., Kujawa, S. G., Liberman, M. C. Primary neural degeneration in the Guinea pig cochlea after reversible noise-induced threshold shift. Journal of the Association for Research in Otolaryngology. 12 (5), 605-616 (2011).
Semi-Automated Analysis of Peak Amplitude and Latency for Auditory Brainstem Response Waveforms Using R
Play Video

Cite this Article

Na, D., White, P. M. Semi-Automated Analysis of Peak Amplitude and Latency for Auditory Brainstem Response Waveforms Using R. J. Vis. Exp. (190), e64737, doi:10.3791/64737 (2022).More

Na, D., White, P. M. Semi-Automated Analysis of Peak Amplitude and Latency for Auditory Brainstem Response Waveforms Using R. J. Vis. Exp. (190), e64737, doi:10.3791/64737 (2022).

Copy Citation Download Citation Reprints and Permissions
View Video

Get cutting-edge science videos from JoVE sent straight to your inbox every month.

Waiting X
Simple Hit Counter