A Lua script that converts looped WAV files into N163 FTI instruments. You provide the loop point and oscillation count of the WAV sample; the script does the rest of the job, and produces a normalized FTI that would cycle through the N163 waves at the proper rate if played at the speed that matches the original sample rate. Invoking the script with no arguments displays the script information. Requires Lua 5.3. Licensed under the MIT License.

Since the instrument's wave sequence does not vary with frequency, a single sample might only give satisfactory results for frequencies about an octave within the source frequency provided by the original sample rate. This applies mostly to samples containing regions, such as those from Soundfont files; convert each at its designated sample rate by either creating an external batch script or modifying calls to generatewaves().

In case new forum users do not know, I have used this script personally for variouscovers. I mentioned there will be sample frequency detection, but eventually discarded that because using the sample's loop point is a lot more reliable.

The script does not support stereo samples. There is no plan to, as it is extremely unlikely for one who knows how to obtain the loop point and oscillation count from a WAV file in an audio editor to not know how to downmix the file to mono in the same editor anyway. Support for non-looping WAV samples might be added in a later time; these are possible, but are fixed at a single playback frequency, and require very specific conditions to even play properly.