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

get_array_of_samples method returns signed data type #312

Closed
shinaji opened this issue Sep 4, 2018 · 3 comments
Closed

get_array_of_samples method returns signed data type #312

shinaji opened this issue Sep 4, 2018 · 3 comments

Comments

@shinaji
Copy link

shinaji commented Sep 4, 2018

Steps to reproduce

import numpy as np
audio = AudioSegment.from_file("example.wav", "wav")
arr = nbp.array(audio.get_array_of_samples())
print(arr.dtype)

Expected behavior

The data type of the array is uint8.

Actual behavior

The data type of the array is int8.

@jiaaro
Copy link
Owner

jiaaro commented Sep 6, 2018

for 8 bit audio, I think uint8 is correct - I think that is just an accident of history (as discussed here, they blame bill gates but who knows https://www.dsprelated.com/showthread/comp.dsp/71057-1.php )

@shinaji
Copy link
Author

shinaji commented Sep 6, 2018

Thank you for the reply.
As you mentioned uint8 is correct, but the returned type was "signed" int8.

@jiaaro
Copy link
Owner

jiaaro commented Sep 6, 2018

ah, I misunderstood - thank you for the PR

@shinaji shinaji closed this as completed Sep 7, 2018
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

2 participants