SpatialScaper icon indicating copy to clipboard operation
SpatialScaper copied to clipboard

Non WAV file breaking MOTUS preparation script

Open adrianSRoman opened this issue 1 year ago • 1 comments

Reference Line: https://github.com/iranroman/SpatialScaper/blob/dd130d1e0f8aef0c93f5e1b73c3445f855b92e7b/scripts/prepare_rirs.py#L198

The error looks like:

  File "scripts/prepare_rirs.py", line 528, in <module>
    prepare_motus(motus_path, sofa_path)
  File "scripts/prepare_rirs.py", line 198, in prepare_motus
    source_pos = source_positions[source_pos_index] + random.uniform(
KeyError: 'rirs.zip'

From inspection, the downloaded MOTUS directory contains .zip files. I suggest either removing the unpacked zip files or checking for .wav extension before generating RIR_file_names. I.e:

        RIR_file_names = os.listdir(dataset_path)
        if fmt == "foa":
            RIR_file_names = [f for f in RIR_file_names if "sh" in f and f.endswith(".wav")]
        elif fmt == "mic":
            RIR_file_names = [f for f in RIR_file_names if "raw" in f and f.endswith(".wav")]

adrianSRoman avatar Aug 11 '24 05:08 adrianSRoman

Thanks @adrianSRoman for bringing this up. We do have a flag to remove the zip files after downloading and unpacking them.

I personally did not run into this issue while testing the latest release, but I'll re-try the script to see agian. @beasteers and @karinnacvijanovich did you see this?

iranroman avatar Aug 11 '24 15:08 iranroman