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

Wrong documentation example in IPython.display.Audio #13641

Open
MetalArmor opened this issue Apr 18, 2022 · 0 comments
Open

Wrong documentation example in IPython.display.Audio #13641

MetalArmor opened this issue Apr 18, 2022 · 0 comments

Comments

@MetalArmor
Copy link

From examples of documentation,

import numpy as np
framerate = 44100
t = np.linspace(0,5,framerate*5)
data = np.sin(2np.pi220t) + np.sin(2np.pi224t)
Audio(data, rate=framerate)
<IPython.lib.display.Audio object>

Since np.linspace DOES include STOP parameter, in above example the array t has different frames per second.

The framerate is FRAME PER SECOND, so it sholud be changed like

import numpy as np
framerate = 44100
t = np.linspace(0,5,framerate*5,endpoint=False)
data = np.sin(2np.pi220t) + np.sin(2np.pi224t)
Audio(data, rate=framerate)
<IPython.lib.display.Audio object>

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