Changing a spline in threejs dynamically

I have this code drawing a sinewave which works great, but when I call the function to draw it over again with different values, it doesn’t do anything. The code in the function is the exact same as prior to the function, but the sinewave code is /20 instead of /10 to give a different result. I then call sineUpdate() function separately, but there’s something I’m missing as to why it won’t update. I’ve used BufferGeometry before with straight lines and I can get things to update really well, but not sure how to do it with splines. Plus I would love to do everything in the fxn and not repeat code, but I don’t want to call scene.add(splineObject) everytime…only once.

var pointsSine = [];
for (var i=0, l=1000; i<=l; i++) {
    pointsSine.push(new THREE.Vector2(i, 25*Math.sin(i/10)));
}
var curve = new THREE.SplineCurve(pointsSine);
var points = curve.getPoints( 1000 );
var geometryspline = new THREE.BufferGeometry();
geometryspline.setAttribute("position", new THREE.BufferAttribute(new Float32Array(2*1000), 2));
geometryspline.setFromPoints(points3);
var materialspline = new THREE.LineBasicMaterial( { color: 0xff0000 } );
var splineObject = new THREE.Line( geometryspline, materialspline );
scene.add(splineObject);
splineObject.geometry.setDrawRange( 0, 1000 );
splineObject.geometry.attributes.position.needsUpdate = true;

function sineUpdate() {
    pointsSine = [];
    for (var i=0, l=1000; i<=l; i++) {
        pointsSine.push(new THREE.Vector2(i, 25*Math.sin(i/20)));
    }
    curve = new THREE.SplineCurve(pointsSine);
    points = curve.getPoints( 1000 );
    geometryspline = new THREE.BufferGeometry();
    geometryspline.setAttribute("position", new THREE.BufferAttribute(new Float32Array(2*1000), 2));
    geometryspline.setFromPoints(points);
    materialspline = new THREE.LineBasicMaterial( { color: 0xff0000 } );
    splineObject = new THREE.Line( geometryspline, materialspline );
    splineObject.geometry.setDrawRange( 0, 1000 );
    splineObject.geometry.attributes.position.needsUpdate = true;
}