Version: 2022.3
public float cutoffFrequency ;

描述

低通截止频率,以 hz 为单位。范围从 10.0 到 22000.0。默认值为 5000.0。

注意,设置该值将重置为该 AudioLowPassFilter 设置的任何自定义截止曲线。

using UnityEngine;

[RequireComponent(typeof(AudioSource))] [RequireComponent(typeof(AudioLowPassFilter))] public class Example : MonoBehaviour { // Moves the cuttoutFrequency from 10 to 22000 following a Sinus function // Attach this to an audio source with a LowPassFilter to listen to it working.

void Update() { GetComponent<AudioLowPassFilter>().cutoffFrequency = (Mathf.Sin(Time.time) * 11010 + 11000); } }