Skip to main content

API Reference

This page lists the public integration API.

LiveKit

Import path:

from arctan.livekit import arctan_enhancer

Factory:

arctan_enhancer.noise_canceller(
*,
license_key: str | None = None,
) -> ArctanNoiseCanceller

ArctanNoiseCanceller is the object returned by the Arctan factory. It implements LiveKit's rtc.FrameProcessor[rtc.AudioFrame] interface.

Create one Arctan processor and pass it to LiveKit:

from livekit.agents import room_io

processor = arctan_enhancer.noise_canceller()

await session.start(
agent=Assistant(),
room=ctx.room,
room_options=room_io.RoomOptions(
audio_input=room_io.AudioInputOptions(
noise_cancellation=processor,
),
),
)

Use enabled on the Arctan processor to bypass or resume processing:

processor.enabled = False # Arctan returns input frames unchanged.
processor.enabled = True # Arctan resumes processing.

Arctan validates channel count, sample rate stability, and processing block alignment before processing each LiveKit frame.

Pipecat

Import path:

from arctan.pipecat import arctan_enhancer

Class:

arctan_enhancer.ArctanAudioFilter(
*,
license_key: str | None = None,
)

ArctanAudioFilter is the Arctan input filter for Pipecat. It implements Pipecat's BaseAudioFilter interface.

Create one Arctan filter and pass it to Pipecat:

from pipecat.transports.base_transport import TransportParams

audio_filter = arctan_enhancer.ArctanAudioFilter()

transport_params = TransportParams(
audio_in_enabled=True,
audio_in_filter=audio_filter,
)

Pipecat calls the filter lifecycle methods through the transport:

await audio_filter.start(sample_rate)
processed = await audio_filter.filter(audio)
await audio_filter.process_frame(frame)
await audio_filter.stop()

Use FilterEnableFrame to bypass or resume processing:

from pipecat.frames.frames import FilterEnableFrame

await audio_filter.process_frame(FilterEnableFrame(enable=False))
await audio_filter.process_frame(FilterEnableFrame(enable=True))

filter(audio) accepts PCM16 bytes and returns processed PCM16 bytes.