Skip to content

Upsampler crashes on very short audio sequence #4

Description

@heebtob

I have a very short audio sequence with 13093 samples. It's a Linear PCM Wave with 44100 hz Mono 16bits.
I'd like to upsample it to 48000 hz.

It crashes at the following line because the result of the calculation is negative.

SSRC.java:1006
rawoutbuf.limit((int) (dbps * nch * (Math.floor((double) sumread * dfrq / sfrq) + 2 - sumwrite - delay)));

java.lang.IllegalArgumentException: null
	at java.nio.Buffer.limit(Buffer.java:275) ~[na:1.8.0_161]
	at vavi.sound.pcm.resampling.ssrc.SSRC$Upsampler.resample(SSRC.java:1006) ~[na:na]
	at vavi.sound.pcm.resampling.ssrc.SSRC.io(SSRC.java:2431) ~[na:na]
	at vavi.sound.pcm.resampling.ssrc.SSRCInputStream$1.run(SSRCInputStream.java:88) ~[na:na]

Are such short sequences generally not supported or is it a corner case which you do not need in your applications?
Could you give me a hint how to fix this?

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions