Sound Pressure level returning -inf
2 views (last 30 days)
Show older comments
Farid on 1 Sep 2022
Answered: Jimmy Lapierre on 7 Sep 2022
when I use the function [Lt,Leq,Lpeak,Lmax] = SPL(recording_vector) it returns vectors containing (partially or completely) -inf values. Surprisingly when I re-Run the same line I get usual numeric values. how is this possible? how to avoid it?
Jimmy Lapierre on 7 Sep 2022
Leq, Lpeak and Lmax are only computed every TimeInterval, so they correspond to the SPL of zero for the first 0.125 seconds. And as chunru said, that corresponds to -Inf. When you call spl a second time, you are already pass the first 0.125 seconds of pure silence.
To avoid it, either discard the fist 0.125 seconds, or set a minimum value you prefer.
For example set any value below -100 dB (including -Inf) to -100:
More Answers (0)
Find more on Audio Processing Algorithm Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!