lasp/examples/test_SLM.ipynb

104 lines
1.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test SLM (Sound Level Meter)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from lasp import SLM as SLM\n",
"from lasp import TimeWeighting, FreqWeighting\n",
"from lasp.filter import ThirdOctaveBankDesigner\n",
"import numpy as np\n",
"# %pylab inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fs = 48000.\n",
"Lref = 1\n",
"ds = 1\n",
"tau = 1/8\n",
"\n",
"designer = ThirdOctaveBankDesigner(fs)\n",
"slm = SLM(fs,\n",
" designer,\n",
" level_ref_value=1\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x = np.zeros((20100,1), dtype=float)\n",
"x[:] = 1\n",
"\n",
"res = slm.run(x)\n",
"print(res.shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"res"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"slm.Pm"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"res[-1,:]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}