Difference between revisions of "RMS"

From Jeskola Buzz Wiki
Jump to: navigation, search
m (Calculating and displaying RMS)
m (Calculating and displaying RMS)
Line 7: Line 7:
  
 
# Select a 50 ms piece of audio ''(uncertain here, please confirm)''
 
# Select a 50 ms piece of audio ''(uncertain here, please confirm)''
# take each sample and multiply it by itself
+
# Take each sample and multiply it by itself
# take all those resulting values and add them
+
# Take all those resulting values and add them
# divide that by the amount of samples added (let's call that value "x")
+
# Divide that by the amount of samples added (let's call that value "x")
 
# x = sqrtf(x);
 
# x = sqrtf(x);
# silence is now 0.00, and the max (0 dB) point is 1.00 (but higher vales CAN occur in Buzz!)
+
# Silence is now 0.00, and the max (0 dB) point is 1.00 (but higher vales CAN occur in Buzz!)
# scale this to the size of the graphics, leaving some space for the headroom (e.g. +6 dB)
+
# Scale this to the size of the graphics, leaving some space for the headroom (e.g. +6 dB)
  
 
If you want the RMS value scaled onto the x^3 curve as suggested by JoaCHIP's audio gui design page, simply replace step 5 with '''x = powf(x, 1/6)'''.
 
If you want the RMS value scaled onto the x^3 curve as suggested by JoaCHIP's audio gui design page, simply replace step 5 with '''x = powf(x, 1/6)'''.

Revision as of 19:44, 27 March 2010

The information on this page needs to be verified for validity.

What is RMS

The Root Mean Square is a way to express the actual sound pressure of a piece of audio. It is a sort of averaging method that suits audio well.

Calculating and displaying RMS

  1. Select a 50 ms piece of audio (uncertain here, please confirm)
  2. Take each sample and multiply it by itself
  3. Take all those resulting values and add them
  4. Divide that by the amount of samples added (let's call that value "x")
  5. x = sqrtf(x);
  6. Silence is now 0.00, and the max (0 dB) point is 1.00 (but higher vales CAN occur in Buzz!)
  7. Scale this to the size of the graphics, leaving some space for the headroom (e.g. +6 dB)

If you want the RMS value scaled onto the x^3 curve as suggested by JoaCHIP's audio gui design page, simply replace step 5 with x = powf(x, 1/6).