It is currently Sun Sep 22, 2019 11:44 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Aug 23, 2019 3:44 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1904
Is it possible that the latest version of FamiTone2 has a bug that wasn't in the old version?

I have always been using the version v1.15 10'15 for my projects. And everything was fine.

Now I tried v1.15 04'17 (the current one). And the music sounds completely off.

I noticed one thing:
The file "famitone2.s" is identical in both versions, except that the new version declares the constants FT_TEMP_SIZE and FT_BASE_SIZE, that it never uses, though. So, the code is exactly the same.

But the text2data tool outputs slightly different data:
Code:
.instruments:
   .db $30 ;instrument $1b

becomes:
Code:
.instruments:
   .db $f0 ;instrument $1b

(This is done in every line where there is an ;instrument xx comment.)

Why does the conversion tool generate different data, even though the actual code that interprets the data hasn't changed at all? Does the code only read the lower nibble of the value $30/$f0, so that the upper nibble is unimportant?

I've attached an FTM file. This sounds fine when I use the older version. But it sounds metallic when I use the latest version. Maybe someone can include it in his own ROM and tell me whether he has the same effect.

By the way, I even included the new song into the demo program that is in the FamiTone zip file. I replaced my own song with one of the existing songs: Same effect in the new version, everything fine in the old version.

You can find the old version of FamiTone2 that I'm using here:
https://web.archive.org/web/20160216023 ... itone2.zip


Attachments:
Test.ftm [20.87 KiB]
Downloaded 28 times

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg
Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 5:57 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2564
Location: DIGDUG
The first byte of an instrument definition is the duty cycle.

These bits should be the duty (the Xs)
xx00 0000

These bits should always be set.
0011 0000

These bits should be zero. (the Xs)
0000 xxxx

Later, this is ORA ed with the volume from the volume envelope.

I'm away from my computer, so I can't look at the file.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 6:32 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1904
dougeff wrote:
These bits should be the duty (the Xs)
xx00 0000

In this case, the newer text2data tool outputs a different value than the old one:
$30 = %00110000
$F0 = %11110000

Since the actual source code of the FamiTone driver didn't change and since every one of the songs in my ROMs always worked with the older version while a bunch of them sound strange with the new version, I assume the new text2data has a bug.
Either this, or he forgot to ship his "famitone2.asm" file correctly.

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
PostPosted: Sat Aug 31, 2019 4:39 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1904
Looks like nobody cares that the latest version of FamiTone2 introduced strange behavior that wasn't there in the previous version. (Including shiru himself who hasn't replied to my mail.)

Well, in case somebody does encounter issues with this driver, let me confirm again that there must be a problem in the text2data tool: The source code ("famitone2.asm"/".s") is the same, yet the text2data tool creates different files.

If I compile my game "City Trouble" by using the new "famitone2.s" (which doesn't make a difference) and the new text2data tool, the music sounds wrong. It sounds fine with the version with which it was originally compiled.

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
PostPosted: Sat Aug 31, 2019 9:44 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2564
Location: DIGDUG
You could use my build/fork of famitone2 text2data.exe (v1.15)

https://github.com/nesdoug/famitone2d?files=1

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sat Aug 31, 2019 5:26 pm 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1904
Well, the information that there's another version out there doesn't clear up the question whether the current official FamiTone2 from shiru's website is actually buggy or whether I did something wrong or what's up here.

Also, I already said that the previous version of the official FamiTone2 works fine, so it's not like I'm in actual need of anything. It's more about finding out in general what's the deal with the current official version.


Unrelated remark:

I had a look at your "famitone2.s" and this is quite dangerous:
Code:
FT_BASE_ADR      = $0300   ;page in the RAM used for FT2 variables, should be $xx00
FT_TEMP         = $fd ;3 bytes in zeropage used by the library as a scratchpad

In cc65, segments are declared via a config file.

In the original FamiTone2, those lines were all commented out. So, a programmer who includes the original code file into his project would get compiler errors because of undefined constants. It is then in his responsibility to define the values in their assembler-specific way.

For example, in a file called "FamiToneWrapper.s", I did this in my source code:
Code:
.segment "ZEROPAGE"
    FT_TEMP: .res 3

.segment "FAMITONE"
    FT_BASE_ADR: .res 186
and in the config file, I had this:
Code:
FAMITONE: load = RAM, type = bss, align = $0100;
BSS:      load = RAM, type = bss;

But your current version simply defines those variables as fixed values inside the "famitone2.s" file itself.
A programmer who includes your file doesn't get an indication that he has to define the variables himself. Instead, your code simply accesses the memory of whatever is located at address $0300 and completely circumvents the config file approach without any warnings.

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group