danielkrause / DCASE2022-data-generator

Data generator for creating synthetic audio mixtures suitable for DCASE Challenge 2022 Task 3
Other
29 stars 6 forks source link

Issue running the example script "example_script_DCASE2022.py" #5

Closed sreenivasaupadhyaya closed 1 year ago

sreenivasaupadhyaya commented 1 year ago

I created a python virtual environment with python3.8 and the version of the packages as mentioned in the readme. I got the following error

"Generating scene audio for fold 1
Loading RIRs for room 11
Stacking same trajectory RIRs
Writing mixture 1/5
Traceback (most recent call last):
  File "/Projects/DCASE2022-data-generator/example_script_DCASE2022.py", line 46, in <module>
    noiselessAudioSynth.synthesize_mixtures()
  File "/Projects/DCASE2022-data-generator/audio_synthesizer.py", line 138, in synthesize_mixtures
    mixeventsig0 = scipy.signal.convolve(eventsig, np.squeeze(channel_rirs[:, 0, riridx, ntraj]), mode='full', method='fft')
IndexError: arrays used as indices must be of integer (or boolean) type"

Configuration used:

` nb_folds = 2, # number of folds (default 2 - training and testing) rooms2fold = [[10, 6], # FOLD 1, rooms assigned to each fold (0's are ignored) [10, 6]], # FOLD 2

[[10, 6, 1, 4, 3, 8], # FOLD 1, rooms assigned to each fold (0's are ignored)

    #               [9, 5, 2, 0, 0, 0]], # FOLD 2
    db_path = 'NIGENS',  # path containing audio events to be utilized during data generation
    max_polyphony = 2,  # maximum number of overlapping sound events
    active_classes = [0, 1, 2, 3, 5, 6, 8, 9, 10, 11, 12, 13],  # list of sound classes to be used for data generation
    nb_mixtures_per_fold = [10,10],#[900, 300], # if scalar, same number of mixtures for each fold`

Question: I tried to make this script work with different configuration, but it fails everytime. Is there any update on these scripts? Thank you for posting the code. Thanks in advance and looking forward to your reply. @danielkrause

danielkrause commented 1 year ago

It's hard to read the configuration you provided, specially with the comments included, could you separate the parameters line by line please? Or, alternatively, provide a screenshot of the generation_parameters.py file.

sreenivasaupadhyaya commented 1 year ago

It's hard to read the configuration you provided, specially with the comments included, could you separate the parameters line by line please? Or, alternatively, provide a screenshot of the generation_parameters.py file. Hi Daniel, please find the parameters.file attached here. I had also tried with the default parameters as well which failed in between with the same error as explain above. test.txt

danielkrause commented 1 year ago

I'm running the code with the same parameters and seems to work perfectly fine. Are you sure you installed the libraries in the recommended versions? If yes, maybe you could backtrack the error (e.g., what kind of values/data types ntraj and riridx represent) to check what's causing the error exactly.

sreenivasaupadhyaya commented 1 year ago

I'm running the code with the same parameters and seems to work perfectly fine. Are you sure you installed the libraries in the recommended versions? If yes, maybe you could backtrack the error (e.g., what kind of values/data types ntraj and riridx represent) to check what's causing the error exactly.

test.txt

sorry for the mistake in uploading the file. Here is the config in case needed. I did install the libraries with the correct versions. But I will recheck it again. Its already a good boost for me to know that the config works for you.

sreenivasaupadhyaya commented 1 year ago

@danielkrause I backtracked and found the following. ref: audio_synthesizer.txt Made the changes in the above file to make it work without errors.

Findings: When we create mixtures using "#create mixture targets mixtures_target, mixture_setup_target, foldlist_target = noiselessSynth.create_mixtures()"

the issue is seen in "noiselessAudioSynth.synthesize_mixtures()" when nb_events==1, the riridx is a nexted array instead of an integer (as expected in the code). I made the changes in the attached file to handle errorneous cases. The fix is a temporary fix to explain the issue.

Let me know your opinion.

danielkrause commented 1 year ago

Alright, I did a small fix which should cover that. Let me know if that works.

sreenivasaupadhyaya commented 1 year ago

Hi @danielkrause , i checked the code. It fails again at # load event audio and resample to match RIR sampling eventsig, fs_db = soundfile.read(self._db_path + '/' + filename)

The fix for this should be similar to the fix for riridx ( I had made a temporary fix in the file i shared earlier)