Famitone Update

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Famitone Update
by on (#182668)
Here's my first update for famitone2. text2data has been replaced by text2vol.

Changes:
-support for volume column
-support for all notes
(DPCM still needs to be C-1 to D-6)
-included is the source code

(removed link)

Data will be less efficient, filesizes will increase 20-50%. Code will be slightly slower as well.

CAUTION, this is buggy, creates errors when processing more than 1 song.

EDIT - update Jan 2018. Bug fixed version 3.2.
https://github.com/nesdoug/famitone3.3

see also version 4
Re: Famitone Update
by on (#182669)
dougeff wrote:
Data will be less efficient, filesizes will increase 20-50%.

Do the file sizes actually increase at all if you don't use the volume column?
Re: Famitone Update
by on (#182672)
Yes. Shiru had it so that if you had a note, skip one line, and another note, that that gap will go to the low bit of the first note. I removed that efficiency to make room for more notes. Even without a volume column, file sizes are slightly larger.
Re: Famitone Update
by on (#182674)
My music engine has it so that 1, 2, 3, 5, 7, 11, or 15 rows can be skipped without overhead. This means only 25 semitones (two octaves) are reachable at once, but there's also a command to shift this 25-note range up or down arbitrarily during a pattern. I know it'd cost a byte of RAM per track to store the range's base, but I'd bet it could save bytes of ROM all over the place. Worth a try?
Re: Famitone Update
by on (#182706)
I can't think of an easy way to do what you (tepples) are suggesting....without completely rewriting how notes are processed.
Re: Famitone Update
by on (#182938)
It looks like my next version of famitone will support 1xx, 2xx, and 4xx effects.

I need some input on 2xx. I have it so that the note will end as soon as it (pitch slide down) overflows past x7 ff. That seemed logical to me, and consistent with the 1xx effect. But, I noticed that famitracker instead holds the note at x7 ff, instead of ending the note.

Are there any musicians here who will be annoyed at inconsistency with famitracker?
Re: Famitone Update
by on (#182943)
If the intended input is from Famitracker, why would you intentionally do anything to make it behave differently? What's the advantage of making it do something the user wouldn't expect?

It's one thing to do so if it's for the sake of a more convenient implementation, but simply imposing your own "logic" about how the feature should work doesn't seem productive to me.
Re: Famitone Update
by on (#183000)
I'm basically done. Need to do more testing.

Does anyone have a famitracker song that uses 1xx,2xx, and 4xx effects? Preferably without too many DPCM files. I just want to test on a real song.

(On a side note. I went out of my way to NOT look at the famitracker driver, nor pently, nor any of rainwarrior's code. I didn't want anyone thinking I stole your code. So I didn't).
Re: Famitone Update
by on (#183006)
dougeff wrote:
Does anyone have a famitracker song that uses 1xx,2xx, and 4xx effects? Preferably without too many DPCM files. I just want to test on a real song.

There are several that come with Famitracker 0.4.6 that meet this need; see the "Demo songs" folder in the .zip.

If these aren't sufficient, you might Email Jake Kaufman (Virt) and ask him for a few -- stuff off his Fx4 album uses them extensively. (He releases NSFs publicly, but everything is done in Famitracker, so he certainly has the .ftm files laying around). enl_track1.ftm also uses 3xx and 4xx (see pattern 0x0c).

Edit: I also noticed that the classical_9b.ftm (a strange remix of Pachelbel's Canon in D) uses 4xx, so I've attached that.
Re: Famitone Update
by on (#183011)
Attribution for classical_9b.ftm: http://famitracker.com/forum/posts.php?id=2307

The 4xx effect is used really commonly. I'm not sure if 4xx or Vxx is the most popular Famitracker effect. You can probably find it in most FTMs.

1xx and 2xx are a lot less common, because there are more practical alternatives, usually: the targeted slides like 3xx, Qxx, Rxx let you slide to a specific pitch easily, and the hardware slides Ixx, Hxx have the advantage of being logarithmic and they don't pop at power-of-two crossings. It's also very easy to replicate 1xx and 2xx as envelopes, if the feature is unavailable for some reason.

Ixx/Hxx aren't terribly practical for games, but Qxx/Rxx/3xx are all basically just 1xx/2xx with a stopping point, and can be implemented as an extension of them.

Trying to find in my music something that uses the three effects you asked, this one uses 4xx constantly, 2xx a little, and 1xx once: http://rainwarrior.ca/music/TotalTeeGolf.ftm
It uses most other effects too, though (excluding DPCM), so unless you implemented everything it might not be a good demo.

Finding pre-existing music that's restricted to just some particular subset of effects and is also a good demonstration might be difficult. I could host a compo at battle of the bits asking for something specific like that if you wanted.
Re: Famitone Update
by on (#183030)
On my version with no added effects... I'm getting tons of errors if you process more than one song at a time. There's no problems if you process them one at a time, but that is a huge pain.

I'm not sure how to fix this.

text2data does a bunch of things that make this extra difficult. It removes unused envelopes, and reorganizes them. It saves space by using references to other data.

The problem seems to be, my text2vol is inserting junk data into songs. It seems to be bits and pieces of other songs, like old data left in a buffer.

Any way. Don't use this on multiple songs, until I come up with a solution. Sorry.
Re: Famitone Update
by on (#183035)
I've come up with an ugly solution that requires lots of cutting and pasting. Ugly, but it's working. Will do some more testing. Wish I could have come up with a more elegant solution, but I'm not the author of the source code, so I still do lots of head scratching when I stare at the source code.
Re: Famitone Update
by on (#183333)
Download updated...
-forgot to put a few lines in the asm6 version (set default full volume at start of song)
-removed a few extra bytes off end of note table (past what famitracker can output)
Re: Famitone Update
by on (#183473)
I've made a few attempts to debug the problem of garbage data being (sometimes) emitted if multiple songs are processed. I'm not having a lot of luck.

One of my problems is, it's hard to set a breakpoint for a large array, where any point in the array could be the problem... and the program keeps making a new array and renaming, and modifying the length of each chunk...so I can't wrap my head around which point of which song I'm at at any given break.

I'm pretty sure it's parsing the text correctly, but by the time it's sent to song_split pattern length and row position is kind of a mystery.

I suspect the problem is unusual or inconsistent pattern lengths (like song0 has 128 rows per pattern, but song1 has 70 rows per pattern). And the text2data is sort of expecting it to be a power of 2. Maybe.

Any help from someone more experienced debugging C++ would be appreciated.
Re: Famitone Update
by on (#184978)
Hello !
I'm also working with Famitone and i add some feature you found with the volume and the "every-note support".
I see some problem too.
With the pitch envelope :
It's work completely different with Famitracker : the pitch is added in every loop for example :
pitch : 0 1 2 3 | 4 ("|" is the loop position)
the period offset will be : +0 +1 +3 +6 +10 +14 +18 .... in Famitracker
So i add a new variable in every channel who use the pitch and cumulate the value and the music's composer have to be careful to didn't go out of the frequency's bounds. In the case there is no loop, the converter have to add a zero value at the end of the envelope.

I remake a converter in Java because yours didn't work on Linux (with Wine too, you used a C library specific to Window$, i didn't have the problem with Famitone 2 version) but i have some bug to correct and the change i made to Famitone make the values completely different. But i see an error with the loop position when it's in a repeated value sequence like :
0 0 1 1 1 | 1 1 1 2 2 2
the Famitone loop send to the first value "1" because it's keep the sequence as a block (0*2,1*6,2*3). In fact the repeated value must to be split in two (0*2,1*3,1*3,2*3) and the loop need to go to the second repeat sequence to be correct.

I also make a PAL note's table (because i'm a frog eater ! ;) ):
Code:
_FT2NoteTableLSB:

   .byte $ff,$ff
   ;note  C-  C#  D-  D#  E-  F-  F#  G-  G#  A-  A#  B-    octave
   .byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$d1,$60,$f6,$92   ;0
   .byte $34,$db,$86,$37,$ec,$a5,$62,$23,$e8,$b0,$7b,$49   ;1
   .byte $19,$ed,$c3,$9b,$75,$52,$31,$11,$f3,$d7,$bd,$a4   ;2
   .byte $8c,$76,$61,$4d,$3a,$29,$18,$08,$f9,$eb,$de,$d1   ;3
   .byte $c6,$ba,$b0,$a6,$9d,$94,$8b,$84,$7c,$75,$6e,$68   ;4
   .byte $62,$5d,$57,$52,$4e,$49,$45,$41,$3e,$3a,$37,$34   ;5
   .byte $31,$2e,$2b,$29,$26,$24,$22,$20,$1e,$1d,$1b,$19   ;6
   .byte $18,$16,$15,$14,$13,$12,$11,$10,$0f,$0e,$0d,$0c   ;7
   
_FT2NoteTableMSB:

   .byte $07,$07
   ;note  C-  C#  D-  D#  E-  F-  F#  G-  G#  A-  A#  B-    octave
   .byte $07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$06,$06   ;0
   .byte $06,$05,$05,$05,$04,$04,$04,$04,$03,$03,$03,$03   ;1
   .byte $03,$02,$02,$02,$02,$02,$02,$02,$01,$01,$01,$01   ;2
   .byte $01,$01,$01,$01,$01,$01,$01,$01,$00,$00,$00,$00   ;3
   .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00   ;4
   .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00   ;5
   .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00   ;6
   .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00   ;7


My friend who make the music is very sad to can't add Duty envelope so i add it and remove duty-strange-thing. (Of course i know this will have an impact on the cycle value but music will be a very important part of the game i work on.)

The version I work on don't function well yet. I have some work to do. I will send it later if you want to read it (but the comments are in french).
Re: Famitone Update
by on (#185028)
Quote:
yours didn't work on Linux (with Wine too, you used a C library specific to Window$


I'm not an expert or professional programmer...so my attempt at compiling a distributed software is a bit of a fail...even for Windows users (who have to download some dll to make it work). I only have my personal laptop to develop and test, so on my end...it seems to work perfectly.

I guess I will have to download some other C++ compiler and read up on how to make it work on Linux. However, I am also very busy... so it may take me a while. And I have no Linux computer to test it with.
Re: Famitone Update
by on (#185042)
It was just an information, not a reproach. I read the code and make something similar with Java.
Re: Famitone Update
by on (#185055)
I've finally done a comparison between my edits of famitone2 and the full famitracker driver...I don't want to put actual stats down, because somebody will quote me, and later find out that my numbers are all wrong...etc...etc.

Cycles of CPU time per frame - about the same
Bytes of data - famitracker was slightly better (smaller data) [note, the original famitone2 might have done much better...depending on the song]
Bytes of code - famitone2 is MUCH smaller than the famitracker driver, which makes sense, because the famitracker driver has all the effects available
Bytes of RAM - famitone2 slightly better (especially ZP usage).

Anyway, given that these are roughly equivalent, I don't see any point in further development from my end. I haven't tested the famitracker driver version that Shiru just posted on his website, but I may try to use it for the ninja game, if it works as I expect.
Re: Famitone Update
by on (#210988)
schade wrote:
yours didn't work on Linux (with Wine too, you used a C library specific to Window$, i didn't have the problem with Famitone 2 version)

Just remove the "stdafx.h". I don't know why it's in there at all.

Also, <conio.h>, which is also a non-standard library, was included by Shiru, even though it's not needed.

If you remove those, you should be able to compile it under Linux. (I haven't checked myself, though.)

P.S.: "Window$"? Seriously?
Re: Famitone Update
by on (#210991)
DRW wrote:
schade wrote:
yours didn't work on Linux (with Wine too, you used a C library specific to Window$, i didn't have the problem with Famitone 2 version)

Just remove the "stdafx.h". I don't know why it's in there at all.

Also, <conio.h>, which is also a non-standard library, was included by Shiru, even though it's not needed.

If you remove those, you should be able to compile it under Linux. (I haven't checked myself, though.)

P.S.: "Window$"? Seriously?



GNU/Linux rock!

I use it with wine, lamentably
Re: Famitone Update
by on (#210993)
Thank you for your answers, i made my own converter in Java. It's work fine and i make it more verbose (Example it's said when pitch is out of range). Also like i said previously, i add some modifications to Famitone and it's work with Duty Envelope so i called it Schadetone because, it's Famitone but with my name... Anyway. I could put the code here then my project will be finish, but the comments and variables are in French. ;) Maybe i will make later my own music editor who can take in charge patterns with different lengths for size optimization.

PS : Yes, i hate Windows. LINUX POWWWWER !
Re: Famitone Update
by on (#211003)
I'm looking at the source code today, coincidentally.

I'm going to try to debug the major problems with it. Sorry for being slow, but it's not easy to figure out what's wrong. I think I'm on the right track now. Maybe.
Re: Famitone Update
by on (#211024)
I was able to fix the major bug. Will repost link tomorrow.

(link removed)

EDIT.
 
Re: Famitone Update
by on (#211287)
Here's the bug-fixed version. (unofficial) Famitone 3.2. Source code included.

http://dl.dropboxusercontent.com/s/l6sa ... one3.2.zip

This should work exactly like the original famitone2 text2data, with volume column and all notes allowed.

Works with the latest version of nsf2data (v1.15 by Shiru 04'17). I haven't tested the asm code as much as I would have liked to, since the bug fix yesterday. The NESASM version was fully tested.
Re: Famitone Update
by on (#214539)
Hello I've just updated the code to make it cross platform. It was easy, I just had to remove the precompiled-header stdafx.h and also conio.h which provide none posix function like _stricomp, fortunately the dropin posix replacement is just strcasecmp.

Here's the code: https://pastebin.com/Yp0cUDzh. I think it should be on Github so we can trace update, and it's easier for anyone to use. What do you think ?