AudioFilter

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

AudioFilter 오디오 스트림의 주파수 콘텐츠를 조정합니다.그것은 하나의 입력 핀과 하나의 출력 핀을 제공하며, Wires 연결할 수 있습니다.AudioFilter 는 자신의 FilterType , GainQ 속성을 사용하여 특정 삭감 Frequency 주위에서 수행할 작업을 결정합니다.

코드 샘플

An AudioFilter can be used to change the frequency content of audio streams. In this example, an AudioFilter is used to make the AudioEmitter output more muffled when there's a wall between it and the AudioListener.

Emitter Filtering

-- This assumes the workspace contains a Part with an AudioEmitter and an AudioPlayer, and the camera has an AudioListener
local RunService = game:GetService("RunService")
local part: BasePart = workspace.Part
local camera: Camera = workspace.CurrentCamera
local audioPlayer: AudioPlayer = part.AudioPlayer
local audioEmitter: AudioEmitter = part.AudioEmitter
local audioListener: AudioListener = camera.AudioListener
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = { audioEmitter.Parent }
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
-- Create a new AudioFilter
local filter: AudioFilter = Instance.new("AudioFilter")
filter.FilterType = Enum.AudioFilterType.Lowpass12dB
filter.Frequency = 22000
filter.Q = math.sqrt(2) / 2 -- This Q value produces a flat lowpass for the 12dB slope type
filter.Parent = part
-- Put the AudioFilter between the player and the emitter
local function wireTo(source: Instance, target: Instance): Wire
local wire = Instance.new("Wire")
wire.SourceInstance = source
wire.TargetInstance = target
wire.Parent = target
end
wireTo(audioPlayer, filter)
wireTo(filter, audioEmitter)
-- Update the filter based on the positions of the emitter and listener
RunService.Heartbeat:Connect(function()
local emitterPos: Vector3 = part.Position
local listenerPos: Vector3 = camera.CFrame.Position
local raycastResult = workspace:Raycast(emitterPos, (listenerPos - emitterPos), raycastParams)
filter.Frequency = if raycastResult then 500 else 22000
end)

요약

속성

  • 병렬 읽기

    오디오 스트림이 이 효과에 영향을 받지 않고 전달되는지 여부.

  • 복제되지 않음
    Roblox 스크립트 보안
    병렬 읽기
  • 필터에 의해 나타나는 밴드의 곡선 유형.

  • 병렬 읽기

    필터가 주변에서 작동하는 중앙 주파수.

  • 병렬 읽기

    피크 및 선반 필터의 경우 컨트롤 볼륨 증가 또는 감소.

  • 병렬 읽기

    피크, 저패스, 하이패스, 밴드패스 및 노치 필터에 대해 선택성 또는 공명을 제어합니다.

메서드

이벤트

속성

Bypass

병렬 읽기

만약 true , 오디오 스트림은 이 효과에 영향을 받지 않고 통과됩니다.

Editor

복제되지 않음
Roblox 스크립트 보안
병렬 읽기
병렬 읽기

오디오 신호를 필터링하는 데 사용될 주파수 응답 곡선의 유형.각 곡선 유형은 오디오의 주파수 콘텐츠를 다양한 방식으로 영향을 줍니다.

Frequency

병렬 읽기

필터에 의해 나타나는 곡선의 중앙 주파수(헤르츠).일반적으로 이 값을 위쪽이나 아래쪽으로 조정하면 전체 주파수 곡선의 가로 이동에 해당합니다.20에서 22000까지의 범위.

Gain

병렬 읽기

필터에 의해 표시되는 곡선의 볼륨 수준을 결정하는 데 사용되는 데시벨의 이득 값.오직 , 또는 때만 적용됩니다.범위 -30에서 30.

병렬 읽기

필터에 의해 나타나는 곡선의 경사 또는 공진 값을 결정하는 데 사용되는 품질 값.오직 FilterTypePeak , Lowpass[x]dB , Highpass[x]dB , Bandpass 또는 Notch 일 때만 적용됩니다.0.1에서 10까지의 범위.

For FilterType 값의 Lowpass12dBHighpass12dB , a Q 값의 sqrt(2) / 2 또는 0.707 는 12dB/오케이브 경사에서 평면 필터에 해당합니다.

메서드

GetConnectedWires

Instances

지정된 핀하다연결된 배열 Wires 을 반환합니다. AudioFilter 는 "입력" 핀과 "출력" 핀하다하나씩 있습니다.

매개 변수

pin: string
기본값: ""

반환

Instances

GetGainAt

필터에서 지정된 주파수에서 표시되는 주파수 응답 곡선의 이득 값, 데시벨로, 반환합니다. Returns the gain value, in decibels, of the frequency response curve represented by the filter at the given frequency, in hertz.이를 사용하여 필터의 정확한 모양을 주요 장소나 전체로 샘플링할 수 있습니다.

매개 변수

frequency: number

샘플링할 주파수, 헤르츠.

기본값: ""

반환

주어진 주파수에서 얻는 값, 데시벨, 어떤 값.

GetInputPins


반환

GetOutputPins


반환

이벤트

WiringChanged

연결되거나 연결 해제된 Wire 후 발생하는 이벤트로, Wire 는 현재 또는 이전에 AudioFilter 및 다른 연결 가능한 인스턴스에 고정되었거나 고정되었습니다.

매개 변수

connected: boolean

인스턴스가 연결되었거나 연결 해제되었는지 여부.

pin: string

타겟 AudioFilter 에 있는 핀은 다음과 같습니다.The pin on the that the Wire targets.

wire: Wire

Wire 와 다른 인스턴스 사이의 AudioFilter.

instance: Instance

Wire를 통해 연결된 다른 인스턴스.