2022-09-03 14:07:44 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
2022-10-10 17:29:24 +00:00
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Test SLM (Sound Level Meter)"
|
|
|
|
]
|
|
|
|
},
|
2022-09-03 14:07:44 +00:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"from lasp import SLM as SLM\n",
|
|
|
|
"from lasp import TimeWeighting, FreqWeighting\n",
|
|
|
|
"from lasp.filter import ThirdOctaveBankDesigner\n",
|
2022-09-03 14:07:44 +00:00
|
|
|
"import numpy as np\n",
|
2022-10-10 17:29:24 +00:00
|
|
|
"# %pylab inline"
|
2022-09-03 14:07:44 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"fs = 48000.\n",
|
2022-09-03 14:07:44 +00:00
|
|
|
"Lref = 1\n",
|
|
|
|
"ds = 1\n",
|
|
|
|
"tau = 1/8\n",
|
|
|
|
"\n",
|
2022-10-10 17:29:24 +00:00
|
|
|
"designer = ThirdOctaveBankDesigner(fs)\n",
|
|
|
|
"slm = SLM(fs,\n",
|
|
|
|
" designer,\n",
|
|
|
|
" level_ref_value=1\n",
|
2022-09-03 14:07:44 +00:00
|
|
|
")"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-09-03 18:59:14 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-09-03 18:59:14 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"x = np.zeros((20100,1), dtype=float)\n",
|
2022-09-03 14:07:44 +00:00
|
|
|
"x[:] = 1\n",
|
|
|
|
"\n",
|
|
|
|
"res = slm.run(x)\n",
|
|
|
|
"print(res.shape)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"res"
|
2022-09-03 14:07:44 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
|
|
|
"slm.Pm"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-03 14:07:44 +00:00
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-03 14:07:44 +00:00
|
|
|
"source": [
|
|
|
|
"res[-1,:]"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
2022-10-10 17:29:24 +00:00
|
|
|
"display_name": "Python 3 (ipykernel)",
|
2022-09-03 14:07:44 +00:00
|
|
|
"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",
|
2022-10-10 17:29:24 +00:00
|
|
|
"version": "3.8.10"
|
2022-09-03 14:07:44 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 4
|
|
|
|
}
|