Eomys / MoSQITo

MoSQITo is a unified and modular development framework of key sound quality metrics favoring reproducible science and efficient shared scripting among engineers, teachers and researchers community.
Apache License 2.0
134 stars 44 forks source link

Updates Loudness ECMA to 2nd Ed (2022) #74

Closed fchirono closed 9 months ago

fchirono commented 10 months ago

Hi all, I have updated the loudness_ecma function to the 2nd Edition of the ECMA-418-2 standard, from 2022. The 2nd Edition includes mostly minor changes, such as a few slightly different coefficients, and I have corrected references within the MoSQITo functions to equations and section numbers to match those of the 2nd Edition.

There are a few larger changes in the main loudness_ecma function: per Sec. 5.1.2, there are now a windowing function at the start of the signal and zero padding at the start and end of the signal. The new segmentation equations in the 2nd Ed required some code restructuring: the previous file _rectified_band_pass_signals has been removed, and its content is now split between two new files (_band_pass_signals and _ecma_time_segmentation), and the rectification is performed within the loudness_ecma function itself.

Regarding tests and validations:

ear_filter_design

hearing_model_validation

auditory_filter

fchirono commented 10 months ago

Hi all,

I changed the validation script hearing_model_validation to clarify some of the calculations, and added functions that calculate the time-dependent loudness N(l) and the single-value loudness N as per Eqs. 116 and 117 of the ECMA-418-2, 2nd Ed (2022). The standard specifies a power average (and not the usual np.mean operator) to obtain the single-value loudness, and a missing factor of delta_z = 0.5 was added in the integration of the specific loudness over all critical bands.

The new figure looks like this - on the left is the older version, right is the new version. Note the "kinks" present in the initial pull request are now gone:

hearing_model_validation2

wantysal commented 9 months ago

Hello,

Thank you for your PR, we really appreciate the documentation and validation work you've done to ease the merge process ! It's very pleasant to review :) I just started to look at your code, there may be a few changes needed to fit with the rest of mosqito but your results seem great.

Tks, Salomé

fchirono commented 9 months ago

Hi Salomé, thank you for your kind reply; happy to contribute to this excellent package :) Please let me know if there is anything I can help with the review process.

wantysal commented 9 months ago

Hi Fabio,

If you agree, I'd like to merge your PR in a specific branch where I'll make some little changes to stick to mosqito formalism. Nothing about the calculation, just a few adjustements of form.

By the way, if you are interested about Sottek hearing model, please note that I am currently implementing the roughness model here: _https://github.com/wantysal/MoSQITooo/tree/roughness_ecma_ Any help on that would be trully appreciated :)

Salomé

fchirono commented 9 months ago

Hi Salomé,

Yes absolutely, please go ahead with the merge!

I actually also have an implementation of Roughness ECMA-418-2 (2nd Ed, 2022) that I am planning to submit soon, but the results are way off the target values proposed by Fastl & Zwicker in "Psychoacoustics" and I don't know why! I checked the entire code multiple times over, but can't find where it's going wrong :( I'd be happy to join forces and see what we can find! What do you think is the best way to do that?

Here's one example from my validation plots:

wantysal commented 9 months ago

Hey,

The values I get with my implementation are also quite far from the expected results... I don't know what is the best way to work together on this but I suggest that we both compare our own implementation with the other one's, and maybe this way we'll identify some critical points... We can create an issue on each other forks to discuss about it along the way !

Salomé

fchirono commented 9 months ago

Hi Salomé,

I added you as a collaborator on my fork, and created a new issue showing some Roughness validation results. The code has a bunch of intermediate plots within the functions that are currently commented off, but can be used when debugging the code with some test data.

I'll browse through your implementation too and see if I notice any discrepancies. If you don't have a validation script in yours yet, feel free to copy mine - I think it should be very straightforward to add it to yours.

Fabio