Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1255

Python • Re: Using numpy to create a sine wave with complete cycles

$
0
0
If D = total duration and f = wave frequency, then 2 * f * D must be some integer k.
If k is even, the sound will end on a full cycle.
If k is odd, the sound will end on a half-cycle.

Note that a A4 tone like in your example is an easy case. With some other frequency, some rounding can be needed, and be aware that even a tiny discontinuity (the zero-crossing not being "exact") can be audible, particularly if you listen to your sound as a loop.

Statistics: Posted by pragma — Sun Feb 11, 2024 9:06 am



Viewing all articles
Browse latest Browse all 1255

Trending Articles