Skip to content

Acoustics module#174

Merged
simmsa merged 43 commits into
MHKiT-Software:developfrom
hivanov-nrel:acoustics
Sep 29, 2025
Merged

Acoustics module#174
simmsa merged 43 commits into
MHKiT-Software:developfrom
hivanov-nrel:acoustics

Conversation

@hivanov-nrel
Copy link
Copy Markdown
Contributor

@hivanov-nrel hivanov-nrel commented Aug 13, 2025

Acoustics Module Parity

This PR is meant to bring the acoustics module from MHKiT-Python to MHKiT-MATLAB as part of the parity goal.

IO

  • read_hydrophone
  • read_soundtrap
  • read_iclisten
  • export_audio --- Not implemented since matlab has a built-in audio player
  • _read_wav_metadata --- this is not necessary since matlab have built in function to read audiofile
  • _calculate_voltage_and_time --- this is not necessary since matlab have built in function to read audiofile

Analysis

  • _fmax_warning
  • minimum_frequency
  • sound_pressure_spectral_density
  • apply_calibration
  • sound_pressure_spectral_density_level
  • band_aggregate
  • time_aggregate
  • nmfs_auditory_weighting
  • sound_exposure_level
  • sound_pressure_level
  • _band_sound_pressure_level
  • third_octave_sound_pressure_level
  • decidecade_sound_pressure_level

Graphics

  • plot_spectrogram
  • plot_spectra

Reviewer notes

  • export_audio was not implemented since matlab has a built-in audio player
  • Several of the helper functions for reading audio were not included since matlab has a built in function that has similar functionality
  • Note that the execution of matlab's audioread is significantly slower than python implementation. It can take several minutes to read in some of the example audio files. Interestingly, this is only when running the notebook examples. Otherwise the function runs fast during tests.
  • The 'method' functionality is not as extensive as the one in python. The list of available statistical functions is reduced due to implementation constraints.
  • James - I used your original matlab code for building out the base function (sound pressure spectral density). Because of the differences in resolution, I had to change a lot of the "known" values in the tests. Part of my sanity checks was comparing the plots in the example, which yielded very similar results to the Python side, but it might be worth checking that function in particular to make sure the calculations are correct.
  • I have not done anything with the matlab toolbox to add this module

Changelog info

Acoustics Module

  • Introduced a new Acoustics module to MHKiT, providing comprehensive tools for processing and analyzing passive acoustic data from hydrophone recordings.
  • Designed to facilitate compliance with the IEC-TS 62600-40 standard
  • Supports hydrophone models such as SoundTrap and icListen, with functionality to read, calibrate, and process hydrophone data into acoustic metrics.
  • Includes functionalities for:
    • Reading hydrophone data.
    • Performing spectral analyses.
      • spectral density (SPSD)
      • spectral density levels (SPSDL)
      • fractional octave bands (e.g., third-octave, decidecade)
      • Sound Pressure Level (SPL)
    • Applying calibrations.
    • Calculating sound pressure levels.
    • Visualizing results.

To support users, an example notebook demonstrates the application of this module with workflows

@hivanov-nrel hivanov-nrel added this to the 0.7.0 milestone Aug 13, 2025
@hivanov-nrel hivanov-nrel self-assigned this Aug 13, 2025
@hivanov-nrel hivanov-nrel added the parity related to achieving parity with MHKiT-Python label Aug 13, 2025
@hivanov-nrel hivanov-nrel marked this pull request as ready for review September 17, 2025 21:18
@jmcvey3
Copy link
Copy Markdown

jmcvey3 commented Sep 22, 2025

Looks good from a coding standpoint.

@hivanov-nrel hivanov-nrel modified the milestones: 0.7.0, 1.0 Sep 23, 2025
simmsa and others added 23 commits September 28, 2025 10:39
Copy link
Copy Markdown
Contributor

@simmsa simmsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hivanov-nrel, this looks good! My comments/fixes were added here:

hivanov-nrel#1

Thank you for this addition!

@simmsa
Copy link
Copy Markdown
Contributor

simmsa commented Sep 29, 2025

@hivanov-nrel, this is good to go. I will merge once the tests finish...

@simmsa simmsa merged commit 7e5ab9d into MHKiT-Software:develop Sep 29, 2025
30 checks passed
This was referenced Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity related to achieving parity with MHKiT-Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants