SoundSynth icon indicating copy to clipboard operation
SoundSynth copied to clipboard

Eigenvalue ordering

Open RoyJames opened this issue 5 years ago • 1 comments

Thank you for integrating the modal sound code and posting this repo! I have one question regarding this file https://github.com/ztzhang/SoundSynth/blob/master/file_generator/ev_generator60.m

According to matlab's documentation, [V, D] = eigs(K,M,num+shift,'sm') should give you the eigen pairs in ascending order. However, you used D=flip(diag(D)) to reverse it before writing to file. The consequence is that when they are read by ModalModel::load_eigenmodes, 0 audible modes can be loaded because the first mode frequency (which is the biggest) is beyond your threshold and will terminate the loading process. So I removed the flip operation in your code and can verify that the problem is gone and the sound is correct. Was this unintentional in your code?

RoyJames avatar Feb 18 '20 18:02 RoyJames

This is actually intentional. The order of the returns in MATLAB is version dependent. Newer versions switched to the behavior you just described. I'll keep this issue open since this is quite tricky...

ztzhang avatar Feb 18 '20 22:02 ztzhang