I'm using numpy to create a sine wave sample. I would like to have the script truncated to the nearest full (or half) cycle. How would I calculate that, or otherwise trim the sample so that it ends at an amplitude of zero?
It's been too long since I've done much of any trigonometry.
Code:
duration = 0.11 # base in seconds sampleRate = 44100 # integer sample rate, Hz frequency = 440.0 # float sine frequency, Hz sample = (numpy.sin( numpy.arange(sampleRate * duration) * frequency / sampleRate \ * numpy.pi * 2)).astype(numpy.float32)
Statistics: Posted by tpyo kingg — Sat Feb 10, 2024 3:22 pm