Then it converts the return from voltage to decibels (20 * Log10 (V/reference value)). It's called getspectrumdatahelper and it lets you select the sample count for getspectrumdata (like say 2048) but selects only 128 values from the returned frequency bins that match musical note frequencies (instead of arbitrary linear division of the frequency range).
![solve for i decibel scale solve for i decibel scale](https://c8.alamy.com/comp/KE4W4J/the-decibel-scale-sound-level-KE4W4J.jpg)
Shameless spot for an asset that is relevant to the discussion here and implements a lot of the good comments. In most cases you should use x20 factor unless you have a reason or know to do otherwise! if a waveforms amplitude goes above 0dbfs in digital it will get digitally clipped). This is only with regards to the amplitude of the signal itself (i.e. Nowadays in the digital realm we talk about 0dbfs (db full scale) which is the absolute clipping point of the signal as determined by the capacity for digital data to store audio waves as data points. The voltage conversion was a power conversion so the factor there is x10.
![solve for i decibel scale solve for i decibel scale](https://st3.depositphotos.com/6892184/16675/v/950/depositphotos_166752590-stock-illustration-the-decibel-scale.jpg)
Back in the old analogue days it was done using voltage (those old analogue VU meters that you've seen). dB is meaningless unless compared to some reference or standard.
![solve for i decibel scale solve for i decibel scale](https://www.ndrha.org/assets/4546-19985/decibel-scale-large.png)
This is partially because dB is a logarithmic but essentially unitless scale. Where you see places use x10 as the factor they are converting the power of the signal, not it's actual amplitude. In most cases you want to deal with amplitude in which case x20 is used. Click to expand.The question of using x10 or x20 as a factor is to do with converting from the signal's amplitude or it's power.