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

Fix problem reading 16-bit samples #4

Merged
merged 1 commit into from
Jan 11, 2014

Conversation

r9y9
Copy link
Contributor

@r9y9 r9y9 commented Jan 10, 2014

A slight bug is fixed in this commit to correctly read 16-bit samples.

@maddyblue
Copy link
Owner

Could you describe the problem and why this fixes it?

@r9y9
Copy link
Contributor Author

r9y9 commented Jan 11, 2014

I apologize for the lack of explanation. The problem is that the original code fetches 16-bit samples for each 8-bit (not 16-bit).

e.g. In the for roop:
w.Data16[ch][0] = bLEtoInt16(data, 0_int(w.NumChannels)+ch) // fetchs data[0], e.g. where NumChannels is 1 and ch is 0
w.Data16[ch][1] = bLEtoInt16(data, 1_int(w.NumChannels)+ch) // fetches data[1] // should be data[2]
w.Data16[ch][2] = bLEtoInt16(data, 2*int(w.NumChannels)+ch) // fetches data[2] // should be data[4]

I fix the index of reading data variable to fetch samples for each 16-bit (2-byte) by simply adding 2 multiplier to the roop variavle i. I hope this answers your question.

maddyblue added a commit that referenced this pull request Jan 11, 2014
Fix problem reading 16-bit samples
@maddyblue maddyblue merged commit f9556f2 into maddyblue:master Jan 11, 2014
@maddyblue
Copy link
Owner

Great, thanks.

@r9y9 r9y9 deleted the feature_wav_spike branch January 12, 2014 13:18
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