Python Forum

Full Version: How to generate single Sinewave?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am learning the Python language. Which block is best for studying the Python language. This is my first exercise that how to generate sinewave. ? Any idea
Generate a sinewave on what? on graphics chart, on audio device?
You can use numpy:

import numpy as np
x = np.linspace(0, 2 * np.pi, 1024)
sinewave = np.sin(x)
I guess you want to plot them also:

import matplotlib.pyplot as plt
plt.plot(sinewave)
plt.show()