# How do you make perfect sinoids in a curve?

A want to model a several curves to have a perfect sinusoidal structures of specific integer frequencies. Is there any kind of generator for linear waves in curves?

• Check this: blender.stackexchange.com/questions/47337/… – Jan Matys Oct 4 '18 at 22:01
• I don't understand how that relates. This topic is not related to .wav files, it is related to the structure of a physical wave. – Vane Voe Oct 4 '18 at 22:05
• – Duarte Farrajota Ramos Oct 4 '18 at 22:54
• It creates a mesh, but what about a curve? It doesn't let me set the thickness to 0 even. – Vane Voe Oct 5 '18 at 1:00

Here is the script that would do this (you can set the value of startX, endX and cycles' while calling drawSineWave based on frequency and increase the resolution to take it closer to the perfect sine wave.)

import bpy
import bmesh
import math

def drawSineWave(resolution, startX, endX, cycles, amplitude):

bm = bmesh.new()
step = (endX - startX) / (resolution)
cycleSteps = resolution/cycles

x = startX
prevVert = None
for i in range(0, resolution+1):
magnitude = 2 * math.pi * (i % cycleSteps) / cycleSteps
y = amplitude * math.sin(magnitude)

vert = bm.verts.new([x, y, 0])
if(prevVert != None):
bm.edges.new([prevVert, vert])
x += step
prevVert = vert

mesh = bpy.data.meshes.new('sine')
obj = bpy.data.objects.new('sineObj', mesh)