Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when evaluating a particular recording #104

Open
paulrosen opened this issue Dec 7, 2023 · 13 comments
Open

Crash when evaluating a particular recording #104

paulrosen opened this issue Dec 7, 2023 · 13 comments
Assignees

Comments

@paulrosen
Copy link

I have incorporated "@spotify/basic-pitch": "1.0.1" into my website.

I'm getting good results from most of my test files, but this one particular file crashes: https://production--endearing-hamster-0de147.netlify.app/audio/paul_001.mp3 (Note that this URL is good for a while but will eventually go away.)

In the console I see:

webgl_util.ts:116 Couldn't parse line number in error: ERROR: 0:140: 'getT1' : no matching overloaded function found
#version 300 es
    precision highp float;
    precision highp int;
    precision highp sampler2D;
    in vec2 resultUV;
    out vec4 outputColor;
    const vec2 halfCR = vec2(0.5, 0.5);
etc...

Then it throws the following error:

Error: Failed to compile fragment shader.
    at createFragmentShader (webgl_util.ts:106:11)
    at compileProgram (gpgpu_math.ts:113:26)
    at backend_webgl.ts:942:25
    at _MathBackendWebGL.getAndSaveBinary (backend_webgl.ts:997:31)
    at _MathBackendWebGL.runWebGLProgram (backend_webgl.ts:941:25)
    at concatImpl2 (Concat_impl.ts:123:26)
    at concatImpl2 (Concat_impl.ts:103:26)
    at Object.concat3 [as kernelFunc] (Concat.ts:49:10)
    at kernelFunc (engine.ts:644:22)
    at engine.ts:710:23

Thanks for this amazing library!

@paulrosen
Copy link
Author

It does the same thing when I drop that file onto https://basicpitch.spotify.com/

@drubinstein
Copy link
Contributor

Hi @paulrosen , can you provide the audio that you're using? In the future, please use basic-pitch-ts for issues related to the typescript library.

@paulrosen
Copy link
Author

The audio is here: https://production--endearing-hamster-0de147.netlify.app/audio/paul_001.mp3

(With some experimenting, I found that if I shorten the mp3 just slightly it works fine.)

@drubinstein
Copy link
Contributor

Thanks! Should I close the issue?

@paulrosen
Copy link
Author

Well, it would be nice if the original audio worked. I will be submitting random audio so it will fail periodically. What my workaround looks like is:

  1. catch the error
  2. shorten the audio by 0.3 seconds
  3. retry
  4. repeat until it works

The drawback of that is:

  1. there is a huge amount of info dumped to the console, which I'd rather not have,
  2. redoing the audio will take a little time, so the user will have to wait,
  3. there is probably a little bit of extra space at the end of the file, but chopping it off might get rid of part of the last note.

@paulrosen
Copy link
Author

Also, I've tried about 30 recordings so far and 3 of them failed like this, so this isn't a particularly rare case.

@drubinstein
Copy link
Contributor

If you change the encoding or resample the file does it still fail? Also has it always been files of this length?

@drubinstein
Copy link
Contributor

I just tried resampling the file to 22050Hz and 44100Hz and converting the file to ogg. I'll take a deeper look.

@drubinstein
Copy link
Contributor

Note, you could alternatively add 0's to the audio instead of removing the audio. That works at the minimum, but doesn't admittedly solve the root cause.

@paulrosen
Copy link
Author

All the files tend to be different lengths. I didn't see any pattern having to do with file length.

Adding zeros is a better idea for a workaround, thanks!

@paulrosen
Copy link
Author

@paulrosen
Copy link
Author

Is there any progress on this? Is there anything I can do to help? I don't know anything about tensorflow so I'm not sure if I could get up to speed.

@drubinstein
Copy link
Contributor

No progress. I've been a bit busy on #100 and admittedly forgot about this issue. Hopefully, I can get to this issue in a week or two. I do wonder if tfjs has been updated with a fix since you posted this issue. I can check sometime next week.

@dohertyguirand dohertyguirand self-assigned this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants