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

Make normalizing / casting array easier #40

Open
cool-RR opened this issue Jun 24, 2020 · 0 comments
Open

Make normalizing / casting array easier #40

cool-RR opened this issue Jun 24, 2020 · 0 comments

Comments

@cool-RR
Copy link

cool-RR commented Jun 24, 2020

I'd like to give a talk in EuroPython 2020 where I'll use simpleaudio to do live-coding of a music synthesizer. There are just a few things I need to make easier.

I'd like to cut this part out:

audio *= 32767 / np.max(np.abs(audio))
audio = audio.astype(np.int16)

I know it's used to cast the float array into int and normalize the audio data. I'd like to have as little confusing code as possible. Would you be open to a normalize=False flag on the play_buffer function that accepts any NumPy array and automatically does this process on it?

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

1 participant