MCPcopy Create free account
hub / github.com/PyTTaMaster/PyTTa / SPL

Function SPL

pytta/functions.py:124–142  ·  view source on GitHub ↗

Calculate the `signal`'s Sound Pressure Level The calculations are made by frequency bands and ranges from `minFreq` to `maxFreq` with `nthOct` bands per octave. Returns ------- Analysis: The sound pressure level packed into an Analysis object.

(signal, nthOct=3, minFreq=100, maxFreq=4000)

Source from the content-addressed store, hash-verified

122
123
124def SPL(signal, nthOct=3, minFreq=100, maxFreq=4000):
125 """
126 Calculate the `signal`'s Sound Pressure Level
127
128 The calculations are made by frequency bands and ranges from `minFreq` to
129 `maxFreq` with `nthOct` bands per octave.
130
131 Returns
132 -------
133 Analysis: The sound pressure level packed into an Analysis object.
134
135 """
136 with OctFilter(order=4, nthOct=nthOct, minFreq=minFreq, maxFreq=maxFreq,
137 base=10, refFreq=1000, samplingRate=signal.samplingRate) as ofb:
138 fsignal = ofb.filter(signal)
139 out = []
140 for filtsignal in fsignal:
141 out.append(Analysis('L', nthOct, minFreq, maxFreq, filtsignal.spl()))
142 return out if len(out) > 1 else out[0]
143
144
145def merge(signal1, *signalObjects):

Callers

nothing calls this directly

Calls 5

OctFilterClass · 0.90
AnalysisClass · 0.90
appendMethod · 0.80
splMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected