Skip to content

Conversation

@Gautzilla
Copy link
Contributor

🐳 Z🔎🔍M

This PR brings back the ability to export zoomed spectrograms to APLOSE.

It itends at being a bit more configurable than before:

🐬 User POV

From the user perspective, it would look like that:

analysis = Analysis(
    ...
    zoom_levels=[2,3,8], # List of desired zoom levels, which are no more necessarily powers of 2
    zoomed_ffts=None, # There are values by default but one could explicit the FFT used for each zoom level
)

dataset.run_analysis(analysis) # That's it

The default zoomed_ffts values would be, for a given zoom level z, a ShortTimeFFT instance that is the same as the given sft for the unzoomed specification (the one given as the fft parameter to the analysis), with its hop divided by z:

default_zoomed_sft = ShortTimeFFT(
   win=sft.win,
   hop=sft.hop // zoom_level,
   fs=sft.fs,
)

🐬 Exported data

Then, running the analysis with the specified zoom levels would export one SpectroDataset per zoom level, with the link between zoom analyses being specified in the dataset.json file:

{
    "datasets": {
        "original": {
            "analysis": "original",
            "class": "AudioDataset",
            "json": "data\\audio\\original\\original.json"
        },
        "cool_analysis_audio": {
            "analysis": "cool_analysis",
            "class": "AudioDataset",
            "json": "data\\audio\\cool_analysis_audio\\cool_analysis_audio.json"
        },
        "cool_analysis": {
            "analysis": "cool_analysis",
            "class": "SpectroDataset",
            "json": "processed\\cool_analysis\\cool_analysis.json",
            "zoom_level": 1,
            "zoom_reference": null
        },
        "cool_analysis_x2": {
            "analysis": "cool_analysis",
            "class": "SpectroDataset",
            "json": "processed\\cool_analysis_x2\\cool_analysis_x2.json",
            "zoom_level": 2,
            "zoom_reference": "cool_analysis"
        }
    },
    "depth": 0.0,
    "gps_coordinates": [
        0,
        0
    ],
    "instrument": null,
    "strptime_format": null,
    "timezone": null
}

Then, I'd add to the public API Dataset some methods to recover all zoomed datasets from the unzoomed version etc.

🐬 Note on AudioDatasets

As of now, I'm not sure there is a scenario in which exporting each "zoomed" audio split has any interest.

I think I'll just apply the zoom parameters to the spectral analysis, and in a scenario where the analysis includes AnalysisType.AUDIO (audio export), I'll only export the unzoomed AudioDataset and link all zoomed SpectroDatasets to this exported audio.

@Gautzilla Gautzilla self-assigned this Dec 18, 2025
@Gautzilla Gautzilla added high priority Urgent issue data format Work related to spectrogram/audio format and how to process it APLOSE related The changes are impacted APLOSE behavior labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APLOSE related The changes are impacted APLOSE behavior data format Work related to spectrogram/audio format and how to process it high priority Urgent issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant