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

flac: fix off-by-one in sample conversion #38

Merged
merged 1 commit into from
Sep 2, 2018

Conversation

mewmew
Copy link
Contributor

@mewmew mewmew commented Aug 16, 2018

Issue spotted by @mehrvarz.

@mewmew
Copy link
Contributor Author

mewmew commented Aug 16, 2018

@faiface Do you think this issue is also present in the WAV decoder?

The fix is based on https://github.com/zikichombo/sound/blob/master/sample/fix.go#L25

func ToFloat(d int64, nBits int) float64 {
	s := float64(int64(1 << uint(nBits-1)))
	return float64(d) / s
}

@faiface
Copy link
Owner

faiface commented Sep 2, 2018

Thanks for the fix!

@faiface faiface merged commit 5f39eae into faiface:master Sep 2, 2018
@mewmew
Copy link
Contributor Author

mewmew commented Sep 2, 2018

re: @faiface Thanks for merging. When you get a chance, would you mind checking if this is present in the WAV decoder?

Edit: since I copied the logic of the flac decoder from the WAV decoder.

@faiface Do you think this issue is also present in the WAV decoder?

@faiface
Copy link
Owner

faiface commented Sep 2, 2018

I'm not really sure, I'm looking at the code right now, but it seems to me it should be correct (https://github.com/faiface/beep/blob/master/wav/decode.go#L220), but I'm not really sure, and don't have the time to properly test it right now.

@faiface
Copy link
Owner

faiface commented Sep 2, 2018

Btw, is there any way I can contact you more directly?

@mewmew
Copy link
Contributor Author

mewmew commented Sep 2, 2018

Btw, is there any way I can contact you more directly?

Sent you contact info per e-mail. I'll be off for the evening, but send a PM if you get it to work; so at least we know the communication channel is working.

Wish you a good evening :)
Cheers /u

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

Successfully merging this pull request may close these issues.

2 participants