[Lua] FT-NSF2GBS

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

[Lua] FT-NSF2GBS

Postby HertzDevil » Fri Mar 04, 2016 9:55 pm

A Lua script that converts 1-N163 NSFs, verbatim, to GBS music files and GB ROM images. Here is the full description text:

Code: Select all

FamiTracker NSF to GBS converter
Usage: lua ft_nsf2gbs.lua [filename]

The following builds are supported:
 - FamiTracker 0.4.5 stable
 - FamiTracker 0.4.6 stable
 - 0CC-FamiTracker 0.3.13 (last revision build)
See http://gist.github.com/HertzDevil/d204524485d3a37a1829 for details.

(C) HertzDevil 2016
MIT License.

Notes / caveats:
  • The only argument is the NSF filename and there are no other options at all.
  • Your NSF must use exactly one N163 channel, and no other expansions, otherwise the script should throw an error. Bankswitched NSFs are supported.
  • Do not modify any file within the "inc/" directory, as these are precompiled headers containing the GB-Z80 port of the FamiTracker NSF driver. The source assembly files of the port, complete with all the GB-specific effects as listed in the gist notes shown above, will be posted later at the Source board.
  • The script patches an appropriate timer value depending on the refresh rate and the default region of the NSF. The closest rate to 60 Hz is 60.015 Hz; the source code allows using the vertical blank instead of the timer to generate interrupts, which corresponds to 59.726 Hz, but this is unavailable in ths script here.
  • The GB ROM image cannot switch tracks.
  • The triangle and DPCM channels do not output anything, but global effects (Bxx, Cxx, Dxx, Fxx, 0CC-FT Oxx) on these channels will still work.
  • The driver does not perform any calculation whatsoever that converts N163 frequencies to GB wave channel periods. If your FTM uses any pitch effect at all, do not expect that they will work right away in the converted files.
  • However, like the 2A03 triangle channel, the Game Boy wave channel is exactly one octave lower than the pulse channels given the same period register; to see if your pitch effects work as intended on the N163, simply put the same pattern data on the triangle channel.
  • Hardware sweeps are a bit unstable right now. Also they do not work in Pulse 2, and Ixx commands do not silence the channel on period overflow (actually underflow on the Game Boy).
  • Any update in the Game Boy noise channel's volume will reset its LFSR state, so volume sequences that change on every tick will effectively perform a hard sync.
  • Some older GB emulators or GBS players have trouble changing between the long and short periodic noises in the middle of a note.
  • The Game Boy's hardware volume envelopes are supported, but you have to manually locate the volume sequences in the exported file and modify the upper nibbles for it to work. (In the same volume sequence, the same value will not be written to the volume register for multiple consecutive times.)
  • The old vibrato style is not supported right now.
  • The script patches the 2A03's period table rather than that of the N163. This is not an issue for 0.5.0 if and once its stable version is out, but 0CC-FT modules should not use different detune tables for 2A03 and N163.
  • In 0CC-FamiTracker NSFs, 2A03 duty sequences will apply to the wave channel's current wave table. This is an as-of-yet undecided implementation detail in 0CC-FT's tracker side.
Attached are a sample 0.4.6 module and the files generated by this script.

Using 0CC-FamiTracker you could also convert any 2A03-only module quickly by following these steps:
  1. Ensure that all instruments used on the triangle channel do not contain DPCM assignments. You may need the find / replace dialog to swap instrument indices on the triangle channel only.
  2. Replace the first instruments used on the triangle channel of all tracks by N163 equivalents, with the same instrument indices or new ones. Instrument sequences may be directly copied to the N163 instruments.
  3. Swap the triangle channel (2A03, channel 3) and the N163 channel for all tracks.
  4. Now ensure that all 2A03 instruments used on the N163 channel do not contain duty sequences, so that they will not overwrite the wave buffer in both the tracker and the GBS / GB files.
Attachments
ft_nsf2gbs.zip
(16.89 KiB) Downloaded 260 times
koish.zip
(31.59 KiB) Downloaded 220 times
Last edited by HertzDevil on Wed May 25, 2016 7:44 pm, edited 3 times in total.
Constructing Chiptune; Construing 8-Bit. Makes 0CC-FamiTracker and MEGA ZUN.

Join my forum for 0CC-FamiTracker discussion and more

User avatar
Deathro
Posts: 40
Joined: Mon Apr 27, 2015 11:41 pm

Re: [Lua] FT-NSF2GBS

Postby Deathro » Fri Mar 04, 2016 10:22 pm

This is beautiful.

User avatar
ImATrackMan
Posts: 188
Joined: Sat Apr 25, 2015 6:05 am
Location: Plantation, FL, US
Contact:

Re: [Lua] FT-NSF2GBS

Postby ImATrackMan » Sat Mar 05, 2016 1:30 am

I'm already working on a cover from a source with no GBS.
this will work out beautifully
Slowly working on a thing called "FaMIGA".
____________________________________________________
Youtube
Twitter (Stay off my lawn, kids)
Soundcloud.
I do all hardware recordings including Sunsoft5B, FDS, and MULTICHIP !
>quscx uvngw bebxm xqdyl<

User avatar
HertzDevil
Posts: 467
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR
Contact:

Re: [Lua] FT-NSF2GBS

Postby HertzDevil » Wed Mar 16, 2016 2:24 pm

Fixed a small bug where the refresh rate information was not written properly to the ROM image. The new refresh rate value is now displayed during conversion.
Constructing Chiptune; Construing 8-Bit. Makes 0CC-FamiTracker and MEGA ZUN.

Join my forum for 0CC-FamiTracker discussion and more

User avatar
Sky Yoshi
Posts: 984
Joined: Tue Nov 03, 2015 8:09 am
Location: Japan Osaka (。-`ω-)
Contact:

Re: [Lua] FT-NSF2GBS

Postby Sky Yoshi » Wed Mar 16, 2016 2:29 pm

What sotware that I can listen to GBS?
Visual Boy Advance is not working!
I'm Sky Yoshi and I'm a Japanese Tracker.
I am back from 5 months of absent!
Check out my Links to see what I do!
Do you wanna be pointless? Click here!

User avatar
drdevil
Posts: 236
Joined: Sun Sep 20, 2015 10:13 am
Location: Scotland
Contact:

Re: [Lua] FT-NSF2GBS

Postby drdevil » Wed Mar 16, 2016 4:09 pm

If you want to listen to it using Visual Boy Advance, use GBS2GB. I used that to make a VGM pack of Q*bert, on VGMRips.

Or have a look on this page.

User avatar
HertzDevil
Posts: 467
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR
Contact:

Re: [Lua] FT-NSF2GBS

Postby HertzDevil » Wed May 25, 2016 7:43 pm

Added one line of code that fixes the case where the script would calculate new pitch registers, treating the PAL table as NTSC, if 0.4.6 mode was used.

Also, the source module for the first converted song is available here.
Constructing Chiptune; Construing 8-Bit. Makes 0CC-FamiTracker and MEGA ZUN.

Join my forum for 0CC-FamiTracker discussion and more

User avatar
Sky Yoshi
Posts: 984
Joined: Tue Nov 03, 2015 8:09 am
Location: Japan Osaka (。-`ω-)
Contact:

Re: [Lua] FT-NSF2GBS

Postby Sky Yoshi » Thu May 26, 2016 8:50 am

How can I open Lua Softwares?
I can't understand how to install Lua btw
I'm Sky Yoshi and I'm a Japanese Tracker.
I am back from 5 months of absent!
Check out my Links to see what I do!
Do you wanna be pointless? Click here!

radel1996
Posts: 1
Joined: Thu May 11, 2017 5:20 pm

Re: [Lua] FT-NSF2GBS

Postby radel1996 » Thu May 11, 2017 5:44 pm

You can make a tutorial how to use?


Return to “General Talk”

Who is online

Users browsing this forum: No registered users and 5 guests