You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues to ensure this feature has not already been requested.
Problem Statement & User Value
As a machine learning engineer, I want to apply a wide range of standard digital filters (e.g., for noise reduction, equalization, feature extraction) to signals represented as Rune tensors, so that I can build advanced, end-to-end differentiable signal processing and deep learning pipelines in OCaml.
As a DSP engineer, I want a robust, composable, and purely functional filtering library, so that I can build complex, multi-stage processing chains that are easy to reason about, test, and maintain.
Acceptance Criteria (Definition of Done)
A new top-level module SoundML.Filter is created to house all filtering functionality.
The module contains submodules for distinct filter families, including Filter.IIR and Filter.FIR.
Core data types for representing filter coefficients and state are defined using Rune.t. This includes types for fir_coeffs, iir_coeffs, and the numerically-preferred sos_coeffs (second-order sections).
A primary set of pure, stateless filter application functions are available:
lfilter: A general-purpose function for applying filters defined by numerator (b) and denominator (a) coefficients, suitable for both FIR and monolithic IIR filters.
sosfilt: A function for applying IIR filters defined as a cascade of second-order sections, which is the recommended approach for numerical stability.
filtfilt: A function for zero-phase filtering that processes a signal forward and backward, eliminating phase distortion. A sosfiltfilt variant is also provided.
The core API follows a functional, explicit-state-passing paradigm: (state, input) -> (new_state, output), making it suitable for both batch and streaming applications without requiring separate APIs.
All filtering operations are implemented using Rune primitives, making them fully differentiable by default.
Comprehensive documentation is provided for the module architecture, core functions, and the trade-offs between FIR and IIR filters.
Proposed Solution or Technical Approach (Optional)
The proposed architecture is a hierarchical module structure: SoundML.Filter will contain the core application functions and shared types, with nested modules for IIR and FIR filters. Each of these will contain a further nested Design submodule for coefficient generation.
The key design principle is a functional-first, explicit-state API.
Additional Context (Mockups, Links, etc.)
This parent issue tracks the overall creation of the Filter module. The specific implementations for IIR and FIR filters are detailed in the following child issues:
Initial Checklist
Problem Statement & User Value
As a machine learning engineer, I want to apply a wide range of standard digital filters (e.g., for noise reduction, equalization, feature extraction) to signals represented as
Runetensors, so that I can build advanced, end-to-end differentiable signal processing and deep learning pipelines in OCaml.As a DSP engineer, I want a robust, composable, and purely functional filtering library, so that I can build complex, multi-stage processing chains that are easy to reason about, test, and maintain.
Acceptance Criteria (Definition of Done)
SoundML.Filteris created to house all filtering functionality.Filter.IIRandFilter.FIR.Rune.t. This includes types forfir_coeffs,iir_coeffs, and the numerically-preferredsos_coeffs(second-order sections).lfilter: A general-purpose function for applying filters defined by numerator (b) and denominator (a) coefficients, suitable for both FIR and monolithic IIR filters.sosfilt: A function for applying IIR filters defined as a cascade of second-order sections, which is the recommended approach for numerical stability.filtfilt: A function for zero-phase filtering that processes a signal forward and backward, eliminating phase distortion. Asosfiltfiltvariant is also provided.(state, input) -> (new_state, output), making it suitable for both batch and streaming applications without requiring separate APIs.Runeprimitives, making them fully differentiable by default.Proposed Solution or Technical Approach (Optional)
The proposed architecture is a hierarchical module structure:
SoundML.Filterwill contain the core application functions and shared types, with nested modules forIIRandFIRfilters. Each of these will contain a further nestedDesignsubmodule for coefficient generation.The key design principle is a functional-first, explicit-state API.
Additional Context (Mockups, Links, etc.)
This parent issue tracks the overall creation of the
Filtermodule. The specific implementations for IIR and FIR filters are detailed in the following child issues:To guide users, the documentation should include a comparison of the two main filter families:
Table: FIR vs. IIR Filter Characteristics Summary
References
scipy.signal): https://docs.scipy.org/doc/scipy/reference/signal.htmlCode of Conduct