[Lua] WAV loop sampler for N163

General discussion about tracking, help and support.
User avatar
Posts: 475
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR

[Lua] WAV loop sampler for N163

Postby HertzDevil » Thu Oct 29, 2015 6:36 pm

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 various covers. 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.
file extension renamed to .TXT because the forum does not allow .LUA (in fact you might call ">lua wavegen.txt ..." directly instead of renaming it)
(5.13 KiB) Downloaded 702 times
refactoring 0cc-famitracker

User avatar
Posts: 429
Joined: Wed Jul 08, 2015 8:19 pm
Location: Fort Wayne, IN

Re: [Lua] WAV loop sampler for N163

Postby iYamWhatIYam » Thu Oct 29, 2015 8:39 pm

This is fantastic. Although I'm not overly familiar with N163, it can produce some very rich, deep sound, right? If so, I may create some cool SNES sample-like instruments.

Thanks for this tool.
born to fuck life is a die


User avatar
Posts: 932
Joined: Mon Apr 20, 2015 8:47 pm
Location: Trapped in a 2A03

Re: [Lua] WAV loop sampler for N163

Postby MiniMacro » Thu Oct 29, 2015 9:13 pm

I cannot figure out how to use this.
But it's still cool!
wow this is total BS
you can see my beautiful music there~

User avatar
Posts: 104
Joined: Thu Jul 28, 2016 2:19 pm

Re: [Lua] WAV loop sampler for N163

Postby beachbum811 » Tue Aug 16, 2016 12:24 am

It's not coming out right.
This is the .wav sample:
The site won't let me upload .wav's, change back the extention after downloading.
(30.59 KiB) Downloaded 204 times

This is what I typed into cmd:
lua wavegen.lua wave.wav 16 10 16
This is the resulting fti:
I put it in an ftm for simplicity
(1.07 KiB) Downloaded 317 times

What am I doing wrong?
Hello World!
Behold as I run facefirst into the endless abyss of hate that is the internet!
I do Musescore and Scratch with the same username!

OH and I also use beta 0.5 so...

Posts: 3
Joined: Sun Nov 19, 2017 2:05 pm

Re: [Lua] WAV loop sampler for N163

Postby maymonadir » Sun Nov 19, 2017 4:52 pm

I don't know how to use that