Python Forum
How to generate single Sinewave? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: How to generate single Sinewave? (/thread-10678.html)



How to generate single Sinewave? - Saras - May-31-2018

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


RE: How to generate single Sinewave? - Larz60+ - Jun-01-2018

Generate a sinewave on what? on graphics chart, on audio device?


RE: How to generate single Sinewave? - DeaD_EyE - Jun-01-2018

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()