Closed lesept777 closed 7 months ago
It seems that this additional command disturbs something inside the container.
If I do this:
audio_container = dcase_util.containers.AudioContainer().load( filename=dcase_util.utils.Example.audio_filename())
print(audio_container.frames(frame_length_seconds=0.2, hop_length_seconds=0.1).shape)
I get the correct answer:
(2, 8820, 99)
But if I add :
audio_container = dcase_util.containers.AudioContainer().load(filename=dcase_util.utils.Example.audio_filename())
print(audio_container.set_focus(start_seconds=5, duration_seconds=2.0, channel='left').get_focused().shape)
print(audio_container.frames(frame_length_seconds=0.2, hop_length_seconds=0.1).shape)
I get an error message:
Traceback (most recent call last):
Cell In[93], line 1 print(audio_container.frames(frame_length_seconds=0.2, hop_length_seconds=0.1).shape)
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:1580 in frames librosa.util.frame(
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\librosa\util\utils.py:206 in frame if x.shape[axis] < frame_length:
IndexError: tuple index out of range
The issue was fixed with commit f7a289f and will be included in the next release.
Description
audio_container.plot_spec() crashes if I print some values before
Steps/Code to Reproduce
The following works fine:
But the following craches :
Expected Results
Actual Results
C:\Users\fa125436\AppData\Local\Programs\Python\Python39\lib\site-packages\librosa\core\spectrum.py:256: UserWarning: n_fft=2048 is too large for input signal of length=1 warnings.warn( Traceback (most recent call last):
Cell In[63], line 1 audio_container.plot_spec()
File ~\AppData\Local\anaconda3\Lib\site-packages\dcase_util\containers\audio.py:2072 in plot_spec ax = plt.subplot(self.channels, 1, channel_id+1)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\pyplot.py:1323 in subplot key = SubplotSpec._from_subplot_args(fig, args)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\gridspec.py:598 in _from_subplot_args raise ValueError(
ValueError: num must be an integer with 1 <= num <= 2, not 3
Versions
Windows-10-10.0.19045-SP0 Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] NumPy 1.24.1 SciPy 1.10.1 Matplotlib 3.7.1 librosa 0.10.0.post2