AudioBuilderExtensions
Helpers & Utilities · AiDotNet
Audio event detection and classification extensions for AiModelBuilder.
For Beginners
Audio event detection identifies sounds in audio recordings or real-time streams. After configuring a model (like BEATs or AudioEventDetector), use these methods to detect sounds, get probabilities, or start real-time monitoring.
How It Works
These methods provide audio-specific operations through the facade pattern.
Configure any model that implements IAudioEventDetector via
ConfigureModel and then use
these methods for audio event detection.
Methods
| Method | Summary |
|---|---|
AudioEventResult<T> DetectAudioEvents(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio) |
Detects audio events in the given audio using the configured model’s default threshold. |
AudioEventResult<T> DetectAudioEvents(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio, T threshold) |
Detects audio events with a custom confidence threshold. |
AudioEventResult<T> DetectSpecificAudioEvents(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio, IReadOnlyList<string> eventTypes) |
Detects only specific event types, filtering out everything else. |
AudioEventResult<T> DetectSpecificAudioEvents(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio, IReadOnlyList<string> eventTypes, T threshold) |
Detects specific event types with a custom confidence threshold. |
IReadOnlyList<string> GetSupportedAudioEvents(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder) |
Gets the list of event types the configured audio model can detect. |
IStreamingEventDetectionSession<T> StartAudioEventStreaming(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder) |
Starts a streaming event detection session for real-time audio monitoring. |
IStreamingEventDetectionSession<T> StartAudioEventStreaming(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, int sampleRate, T threshold) |
Starts a streaming event detection session with custom settings. |
Task<AudioEventResult<T>> DetectAudioEventsAsync(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio, CancellationToken cancellationToken) |
Detects audio events asynchronously without blocking the calling thread. |
Tensor<T> GetAudioEventProbabilities(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder, Tensor<T> audio) |
Gets raw frame-level event probabilities for all classes without thresholding. |
double GetAudioEventTimeResolution(AiModelBuilder<T, Tensor<T>, Tensor<T>> builder) |
Gets the time resolution of the configured audio event detection model. |