# SoundUtil
> Utility class for audio processing operations.
`gg.lode.amplifierapi.util.SoundUtil`
---
## Signature
```java
public class SoundUtil
```
---
## Methods
### applyVolume
```java
public static short[] applyVolume(short[] input, float volume)
```
Scales audio samples by a volume factor, clamping to short range.
| Parameter | Type | Description |
|---|---|---|
| `input` | `short[]` | Input PCM samples. |
| `volume` | `float` | Volume multiplier. |
**Returns:** `short[]` — Volume-adjusted samples.
---
### applyReverb (Deprecated)
```java
@Deprecated
public static float[] applyReverb(float[] in, float roomSize, float wetMix)
```
> [!warning] Deprecated
> Use [[ReverbProcessor]] instead for stateful reverb that persists across audio frames.
Applies a stateless Schroeder reverb (Freeverb-style) to mono float PCM data. Delay line buffers are allocated fresh each call, so reverb tails are cut off at packet boundaries.
| Parameter | Type | Description |
|---|---|---|
| `in` | `float[]` | Mono 32-bit PCM, range +/-1.0f. |
| `roomSize` | `float` | 0 to 1 — decay length (0.7 = medium hall). |
| `wetMix` | `float` | 0 to 1 — how much reverb to blend in (0.3 = subtle). |
**Returns:** `float[]` — Processed buffer, same length as input.
---
### calculateLoudness
```java
public static double calculateLoudness(byte[] audioData)
public static double calculateLoudness(byte[] audioData, boolean modified)
```
Calculates the RMS loudness of a voice packet. Assumes 16-bit PCM little-endian format.
| Parameter | Type | Description |
|---|---|---|
| `audioData` | `byte[]` | Audio samples (16-bit PCM, little-endian). |
| `modified` | `boolean` | `true` if audio was modified by Amplifier (volume, pitch, reverb). |
**Returns:** `double` — Loudness from 0.0 to 100.0 (unmodified) or 101.0 to 1000.0 (modified).
---
## Related Pages
- [[AudioUtil]] — PCM format conversion utilities
- [[ReverbProcessor]] — Stateful reverb processor (replaces `applyReverb`)