<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Audio/Material/scalingAbsorption(by:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5AudioO8MaterialV17scalingAbsorption2byAES2fXE_tF"
  },
  "title" : "scalingAbsorption(by:)"
}
-->

# scalingAbsorption(by:)

Scale the absorption data by a frequency-dependent scalar value between -1 and 1.

```
func scalingAbsorption(by frequencyDependentScalar: (Float) -> Float) -> Audio.Material
```

## Parameters

`frequencyDependentScalar`

A function with frequency as input and coefficient scalar as output.

## Return Value

Audio material with absorption data scaled by the frequency-dependent scaling function.

## Discussion

- No adjustment is made to the coefficient when the scalar is 0.
- The coefficient is set to 0 when the scalar is -1.
- The coefficient is set to 1 when the scalar is +1.
- If the scalar value is between -1 and 0, the coefficient is adjusted by the percentage
  defined by the absolute value of the scalar between the original coefficient and 0.
- If the scalar value is between 0 and 1, the coefficient is adjusted by the percentage
  defined by the scalar between the original coefficient and 1.

Example usage:

```
// Make a generic carpet material more absorptive by making it thicker.
// Below 1000Hz, the absorption remains the same. Above 1000Hz, the absorption is increased.
let thickCarpet: Audio.Material = .carpet.scalingAbsorption { frequency in
    frequency > 1000 ? 0.5 : .zero
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)