soundlevel.vim : Estimate sound level (SPL) at a distance: :SoundLevel and a markdown table
| script karma |
Rating 0/0,
Downloaded by 1 |
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Train Horn |
| |
| script type |
| utility |
| |
| description |
soundlevel.vim estimates how loud a horn, siren or speaker is at another distance, using the free-field inverse-square law (about -6.02 dB per doubling of distance).
:SoundLevel 150 10 100
SoundLevel: 150.0 dB at 10 ft -> 130.0 dB at 100 ft (free-field estimate)
:SoundLevelTable 150 10
inserts a markdown table of the level at 25, 50, 100, 250, 500 and 1000 ft.
Distances are feet by default; add m for metres (10m, 3 m), units can be mixed. g:soundlevel_default_unit = 'm' switches the default. Bad input (non-numbers, zero/negative distances, unknown units, wrong argument count) gives a clear error and changes nothing. Full docs in :help soundlevel. Headless tests included (vim -Nu NONE -es -S test/run.vim), passing on Vim 9.1 and Neovim. MIT license.
Results are open-air estimates, not measurements or a legal noise assessment. The formula matches the online calculator at https://train-horn.com/tools/decibel-distance/
By Train Horn, an independent reference on train horns: https://train-horn.com/ |
| |
| install details |
Vim 8 packages: unzip soundlevel.zip -d ~/.vim/pack/plugins/start/soundlevel, then :helptags ALL.
Neovim: unzip into ~/.local/share/nvim/site/pack/plugins/start/soundlevel.
Or use your plugin manager. Requires +float. |
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 216.73.216.49
|