Skip to content

[FEATURE] Butterworth filter#381

Merged
mathieudpnt merged 11 commits into
Project-OSmOSE:mainfrom
Gautzilla:butterworth
May 27, 2026
Merged

[FEATURE] Butterworth filter#381
mathieudpnt merged 11 commits into
Project-OSmOSE:mainfrom
Gautzilla:butterworth

Conversation

@Gautzilla
Copy link
Copy Markdown
Contributor

@Gautzilla Gautzilla commented May 18, 2026

🐳 Was ist das ?

This PR adds the osekit.utils.audio.Butterworth dataclass that simply represents parameters for a digital scipy.signal.butter sos filter:

@dataclasses.dataclass
class Butterworth:
    N: int
    Wn: Iterable | int | float
    btype: Literal["lowpass", "highpass", "bandpass", "bandstop"] = "lowpass"

🐳 How to?

🐋 Core

To filter the audio usting the Core API, simply attach a Butterworth object to an AudioData (or AudioDataset):

from osekit.core.audio_data import AudioData
from osekit.utils.audio import Butterworth

ad = AudioData(...)
ad.butter = Butterworth(...)

ad.get_value() # Audio data will go through the butter filter

🐋 Public

The osekit.public.transform.Transform class now has a butter property that will filter the outputs:

from osekit.public.transform import Transform, OutputType
from osekit.utils.audio import Butterworth

transform = Transform(
    output_type=OutputType.SPECTROGRAM,
    ...
    butter=Butterworth(...)
)

project.run(transform=transform) # The audio will go throught the butter filter before the spectrum computation
MyEntireLifeRevolvedAroundButterButterGIF

resolves #369

@Gautzilla Gautzilla requested a review from mathieudpnt May 18, 2026 09:59
@Gautzilla Gautzilla self-assigned this May 18, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 18, 2026

Coverage Status

coverage: 98.873% (+0.02%) from 98.858% — Gautzilla:butterworth into Project-OSmOSE:main

@Gautzilla
Copy link
Copy Markdown
Contributor Author

@mathieudpnt you can test the feature already, but I'm waiting for #382 to be merged before writting the tests for this PR (as it will use the new MockedAudioData class)

EverythingIsConnectedNeilDegrasseTysonGIF

@Gautzilla Gautzilla added the Feature A new feature to add to OSEkit label May 19, 2026
@mathieudpnt mathieudpnt merged commit a4d09d5 into Project-OSmOSE:main May 27, 2026
2 checks passed
@Gautzilla Gautzilla deleted the butterworth branch May 28, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature A new feature to add to OSEkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Butterworth filtering implemented in Transform object

3 participants