Qu

calibrate

Builtin index · Signal processing

calibrate(s, sensitivity=, [sensitivity_unit="mV/Pa"]) or calibrate(s, tone_level=, [tone_freq=], [tone_ref=], [tone_unit="Pa"])

Input: s, sensitivity, sensitivity_unit · Output: no output

What it is

Added in v0.2.4. Turns a raw Signal into a physically calibrated one, scaling the samples and stamping the resulting unit. Name exactly one of sensitivity= (a transducer datasheet figure — calibrate(s, sensitivity = 12.3) means 12.3 mV/Pa, and the slope is its reciprocal) or tone_level= (dB level of an acoustic calibrator recorded in s itself, so spl(calibrate(rec, tone_level = 94)) reads back 94). tone_ref defaults to 20 µPa for pressure; tone_unit names the physical unit. If tone_freq= is given, the named tone is checked against the recording via a Goertzel estimate and a record whose energy is not concentrated there is refused — the wrong-file mistake, which every later measurement would otherwise inherit silently. The level is measured AC-coupled (RMS about the mean), as a sound level meter does. Errors on a non-Signal, on an empty signal, or when both/neither form is named.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
calibrate(s, sensitivity=, [sensitivity_unit="mV/Pa"]) or calibrate(s, tone_level=, [tone_freq=], [tone_ref=], [tone_unit="Pa"])
s —Name exactly one of sensitivity= (a transducer datasheet figure — calibrate(s, sensitivity = 12.3) means 12.3 mV/Pa, and the slope is its reciprocal) or tone_level= (dB level of an acoustic calibrator recorded in s itself, so spl(calibrate(rec, tone_level = 94)) reads back 94).
sensitivity —Name exactly one of sensitivity= (a transducer datasheet figure — calibrate(s, sensitivity = 12.3) means 12.3 mV/Pa, and the slope is its reciprocal) or tone_level= (dB level of an acoustic calibrator recorded in s itself, so spl(calibrate(rec, tone_level = 94)) reads back 94).
sensitivity_unit optional (default "mV/Pa")not documented yet
not documented yetAdded in v0.2.4. Turns a raw Signal into a physically calibrated one, scaling the samples and stamping the resulting unit. tone_ref defaults to 20 µPa for pressure; tone_unit names the physical unit. If tone_freq= is given, the named tone is checked against the recording via a Goertzel estimate and a record whose energy is not concentrated there is refused — the wrong-file mistake, which every later measurement would otherwise inherit silently. The level is measured AC-coupled (RMS about the mean), as a sound level meter does. Errors on a non-Signal, on an empty signal, or when both/neither form is named.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

calibrate(s, sensitivity = 12.3, [sensitivity_unit="mV/Pa"]) or calibrate(s, tone_level = 94, [tone_freq=], [tone_ref=], [tone_unit="Pa"]) -- §10's two acoustic spellings, both of them special cases of apply_calibration above. The SENSITIVITY form is the transducer's datasheet figure: "this microphone puts out 12.3 mV per pascal". The slope is its RECIPROCAL, which is the step that gets inverted by hand and gets it backwards, so it is done once in parse_sensitivity_unit and here. The TONE form is a recording of an acoustic calibrator -- a device that produces a known level at a known frequency against your actual microphone, cable and gain setting, which is why it is the form measurement people trust. s is that recording; the returned signal is s in pascals, so spl(calibrate(rec, tone_level = 94)) reads 94 dB back. Pass tone_freq and the named tone is CHECKED against what is actually in the recording rather than assumed.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.