dhrebeniuk / RosaKit

LibRosa port to Swift for ability using same prepossessing logic in iOS/MacOS platforms
MIT License
83 stars 14 forks source link

EXC_BAD on stft function with small values #10

Closed manurueda closed 2 years ago

manurueda commented 2 years ago

Hi Dmytro,

I am trying to replicate some code I have on python using librosa. I am importing the data directly from a JSON, as librosa.load and your main function does not work the same (will open a new ticket).

Code is breaking when computing inside stft function as matrix variable gets rounded to zero when encountering really small values.

Here are my values:

Matrix -> gets rounded to zeros, so it breaks when trying to execute matrix.rfft

Many thanks

image

dhrebeniuk commented 2 years ago

@manurueda , try please new version from master, I made fixes in PlainPocketFFT

manurueda commented 2 years ago

Many thanks. Testing now. Will reply with my review.

manurueda commented 2 years ago

The new version is not breaking, but I am still getting a different result from librosa.computeMelSpectrogram. I am seeding the input and comparing the same input on RosaKit and librosa and get different outputs.

I would say that maybe is still related to the low values, on matrix.rfft matrix values are still [Double] 0.0. Here are the initial values in stft (please neglect the error on centered, I mistyped as a 2d array instead of 1d array)

Tomorrow I will do a further checkup comparing both.

image

dhrebeniuk commented 2 years ago

@manurueda , may you please attach any wav file or data for ability reproduce problem?

dhrebeniuk commented 2 years ago

@manurueda , please when available try in master branch