In line 166 the frequency is overwritten, while in line 165 the amplitude is added. If I understand this code correctly, this means that if multiple source bins are written to the same target bin, due to the pitch being lowered, then only the highest "true" frequency is written.
I am aware that the source code in a famous article about this method does this as well, but this feels wrong to me. I believe it is probably better to do some form of averaging, for example a weighted average of the incoming frequencies using their corresponding amplitudes. This will consume more processing power, but it should be possible to do something not too heavy, for example using an arena allocator with a capacity equal to the number of processed bins.
I submitted a similar issue to the pvoc/pvoc-plugins crates (nwoeanhinnogaehr/pvoc-plugins#1), which implements a similar algorithm.
In line 166 the frequency is overwritten, while in line 165 the amplitude is added. If I understand this code correctly, this means that if multiple source bins are written to the same target bin, due to the pitch being lowered, then only the highest "true" frequency is written.
I am aware that the source code in a famous article about this method does this as well, but this feels wrong to me. I believe it is probably better to do some form of averaging, for example a weighted average of the incoming frequencies using their corresponding amplitudes. This will consume more processing power, but it should be possible to do something not too heavy, for example using an arena allocator with a capacity equal to the number of processed bins.
I submitted a similar issue to the pvoc/pvoc-plugins crates (nwoeanhinnogaehr/pvoc-plugins#1), which implements a similar algorithm.