You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how currently getSamples() is defined in index.d.ts getSamples(interleaved?:boolean, OutputObject?: Function): Float64Array;
It is supposed to return a Float64Array. But, according to the docs, when there are more than 2 channels, it returns an array of Float64Arrays.
If the file is stereo or have more than one channel then the samples will be returned de-interleaved in a Array of Float64Array objects, one Float64Array for each channel.
This creates confusion when you try to create some logic around it, for example, if you need to go through all channels, you might write something like this:
This is how currently
getSamples()
is defined in index.d.tsgetSamples(interleaved?:boolean, OutputObject?: Function): Float64Array;
It is supposed to return a Float64Array. But, according to the docs, when there are more than 2 channels, it returns an array of Float64Arrays.
This creates confusion when you try to create some logic around it, for example, if you need to go through all channels, you might write something like this:
Unfortunately, this fails. I had to change the return type in index.d.ts to:
Float64Array | Float64Array[]
.I think this would be the right declaration and should be changed, or the function could be changed so that it always returns an array of arrays.
The text was updated successfully, but these errors were encountered: