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

Add 'AudioClip.max_volume(stereo=True)' support for more than 2 channels #1464

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

mondeja
Copy link
Collaborator

@mondeja mondeja commented Jan 17, 2021

Next snippet of code demonstrates the bug:

make_frame = lambda t: np.array([
    np.sin(t * 0),
    np.sin(440 * 2 * np.pi * t),
    np.sin(t * 0),
    np.sin(440 * 2 * np.pi * t),
]).T.copy(order="C")

clip = AudioClip(make_frame, fps=44100, duration=1)
clip.preview()
print(clip.nchannels, clip.max_volume(stereo=True))

The clip has 4 channels but clip.max_volume(stereo=True) returns maximum volume for two first. After this pull returns all of them.

  • I have provided code that clearly demonstrates the bug and that only works correctly when applying this fix
  • I have added suitable tests demonstrating a fixed bug or new/changed feature to the test suite in tests/
  • I have properly documented new or changed features in the documentation or in the docstrings
  • I have properly explained unusual or unexpected code in the comments around it
  • I have formatted my code using black -t py36

@mondeja mondeja added audio Related to AudioClip, or handling of audio in general. bug-fix For PRs and issues solving bugs. labels Jan 17, 2021
@coveralls
Copy link

coveralls commented Jan 17, 2021

Coverage Status

Coverage remained the same at 66.04% when pulling e8a994b on mondeja:audio-stereo-max-volume into 7c3dc0a on Zulko:master.

@mondeja mondeja added enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. bug-fix For PRs and issues solving bugs. and removed bug-fix For PRs and issues solving bugs. labels Jan 19, 2021
@mondeja mondeja merged commit 15a9af8 into Zulko:master Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio Related to AudioClip, or handling of audio in general. bug-fix For PRs and issues solving bugs. enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants