I understand to find the length of the grain I need to perform an FFT over the source to find the fundamental harmonic, I can do that and find an accurate grain length, but now I need to find a start and end point of each grain and I'm not sure how to decide how to do it.
From what I can think of I have the following options
- Always cut at the zero cross over point, ignoring the accurate grain length.
- Cut the first grain at zero, from then on rely on the FFT information to cut accurate grain lengths and hope each start and end will be close to zero.
- Find the centre of each grain using an average of amplitude, then use the accurate grain length (this would put duplicate data in grains next to each other, as each grain would not care where the last grain ended, this doesn't seem right)
- The above but guarantee each grain starts where the other ended, and sacrifice both zero crossover AND grain length
- Nothing, just use grain length and not care about zero crossings or being anywhere near them.
back in 1995, i had a paper about this. Lent's original paper is 1989 in Computer Music Journal.
you want to window off two adjacent periods and use a complementary window (like Hann) to define the grain. you likely also want to position the center of the window around where, in the waveform, there is maximum energy.
– robert bristow-johnson Aug 11 '19 at 21:35