Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /storage/content/49/145849/famitracker.com/public_html/forum/classes/dbHandler.php on line 29 FamiTracker
Login:
Menu:
Post: Author:
FamiTracker > General > Bug Reports & Feature Requests > FDS modulation sound Owner: rainwarrior New post
Page 1 of 1 Sort:  
FDS modulation sound Posted: 2011-11-20 07:50  (Last Edited: 2011-11-20 08:41) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26149
This is with 0.3.7.

I've been working on proper FDS modulation for the NSF importer, and I discovered that the way FDS modulation sounds in FamiTracker is very different from other players.

I've attached an example, which is taken from track 19 of the FDS Zelda 2. If you play it in FamiTracker it sounds very different than if you export the NSF and listen to it with a different player.

I tried NotSoFatso, NSFPlug, VirtuaNES, and Nestopia, with the original NSF and the one exported from this FTM, and they give a consistent sound. FamiTracker seems to be the odd one out. (The NSF import and export process seems to be fine, since I get the same values in if I import the exported NSF, and it sounds just like the Zelda 2 original in the exported NSF.)

One thing I've noticed is if I draw a square shape in the mod table, it doesn't sound like a square at all, it rises and falls smoothly. Is this what it's supposed to do? (I'm not super familiar with how it's supposed to work yet.)


Attachments:
fds_test.ftm (1 Kb)
Posted: 2011-11-20 09:06  (Last Edited: 2011-11-20 09:15) Reply | Quote
Xyz_39808

Avatar

Member for: 4180 days
Location: South Texas
Status: Offline

#26163
BTW, for FM, you're not using the I0x Jxx commands properly.

Re: mod shape

It's basically the modulator wave of FM. Except that instead of choosing only between the default sine and the rectified sine, you can draw your own wave (in modular synth terms, this means a custom LFO!)

Your carrier wave's frequency would only drop if the grid is asymmetrical. Kinda like a |1 1 -1 pitch macro will keep rising. Keep in mind that the blue position resets the freq back to the normal carrier wave's freq.

So, for example, you have the note A-4 440hz playing and if your table looks like a solid green line at position +3 with the very last value being the blue value, then for every cycle of the modulator wave, the freq should rise and rise to something like 1000hz until it reaches the end of the cycle, at which it'll reset back to 440hz. And then it'll repeat the cycle of those freqs.

I don't know exactly how the mod depth works though. But it's always nice to leave the instrument's mod rate definition blank so you can control it with a value of IJJ (only the last digit of Ixx is valid, since FDS can only go up to freq FFF)


Attachments:
derp.ftm (22 Kb)
Posted: 2011-11-20 09:07 Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26164
Another example from Zelda 2 FDS. This time track 21. Compare how the attached file plays in famitracker to its exported NSF in other players, and here's a video of a real FDS making that sound:

[url=http://www.youtube.com/watch?v=OjRlpx7g_TU#t=2m53s]http://www.youtube.com/watch?v=OjRlpx7g_TU#t=2m53s

FamiTracker (and it seems by extension NEZPlug) sounds like it's way off base here.

If you want, I could try rewriting the FDS sound code for you. Let me know.


Attachments:
link_no_bouken_21.ftm (1 Kb)
Posted: 2011-11-20 09:10  (Last Edited: 2011-11-20 17:21) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26165
XYZ, I'm not sure what you're getting at. My post is about how the FDS in FamiTracker sounds very different from a real FDS and many emulators. What are you addressing with your comment?

I did attempt FM synthesis in FamiTracker in an earlier post, but that has nothing to do with what I've just posted in this thread. These are real world FDS usage examples taken from Zelda 2. (How am I using these effects wrong? That seems a bizarre thing to say about this.)

Posted: 2011-11-20 20:10 Reply | Quote
Xyz_39808

Avatar

Member for: 4180 days
Location: South Texas
Status: Offline

#26189
I was addressing this
"One thing I've noticed is if I draw a square shape in the mod table, it doesn't sound like a square at all, it rises and falls smoothly. Is this what it's supposed to do? (I'm not super familiar with how it's supposed to work yet.)"

Posted: 2011-11-21 03:15  (Last Edited: 2011-11-21 03:17) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26208
Here's an example. This is a square wave mod table. The pitch rises and falls smoothly. Additionally, the central pitch is well above the specified pitch, which is not what you'd expect. If you export to NSF and play back with one of the emulators I mentioned, you get much sharper changes of pitch, and also it remains centred as I would expect.

After reading Disch's documentation, the mod table doesn't directly control a pitch offset, but controls a counter (which kind of integrates the mod table) which in turn directly controls the pitch offset.

If you write an unbalanced table (e.g. more up than down) the counter will eventually overflow, and you get a saw-wave kind of effect. (You can also make the counter jump to 0 with the reset value at the bottom row of the mod table grid.)

So anyhow... a square wave mod table shouldn't be a square vibrato, per say, because of that integration, but I think the changes should still be fairly sharp. FamiTracker only produces a very smooth change.


Attachments:
fds_test_2.ftm (1 Kb)
Posted: 2011-11-21 19:47 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#26239
The reason I choosed nezplug's FDS code was because it sounded better with some NSFs and then I also assumed it was more accurate, but I haven't compared with real FDS recordings. I actually used my own code earlier which was based on Disch's document. This was in my NSF player, before FDS was available in Famitracker.

Anyway this clearly indicates some problem with the emulation and I'm not that familiar with the FDS code so I'm not sure where to start looking, if you have any ideas then I'd be grateful. The only thing I can think of at the moment is that the modulation counter is reset after each complete cycle, I don't know if that is correct. I'll also try to switch back to my old code and see if it works better.


_______________________
Programmer and developer
Posted: 2011-11-21 20:14 Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26241
Yeah, I was quickly kind of confused by the code in there. A lot I didn't expect to see, like all the logarithm conversions, FM_DEPTH, not sure what FDS_DYNAMIC_BIAS means because in this implementation the .bias member doesn't seem to change unless you write it via 4085. There's a bunch of #if 0 code where I'm not sure why one version is used over another, and there's no comments...

As far as I can tell it tries to calculate the offset counter when you write new entries to the mod table, rather than doing it as it cycles through the table, which as you've mentioned resets the counter each cycle (doesn't seem like the right thing to do, since there's two ways to explicitly reset it).

I'll try fixing the modulation counter, and I'll let you know how it turns out. If that doesn't work, maybe a rewrite is in order.

Posted: 2011-11-21 20:47 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#26246
Thanks that would be great!

My old code didn't work better so there might also be something else going on. I also tried some emulators but the only one that seemed somewhat correct was Nestopia, did you notice that too?

Btw, I own an FDS unit so I can probably run some tests if necessary.

_______________________
Programmer and developer
Posted: 2011-11-21 22:48 Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26259
The four emulators I tried (listed above, but includes Nestopia) sounded fairly consistent to what I hear in that FDS video on youtube.

Posted: 2011-11-21 23:37 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#26268
Ok I got it working in VirtuaNES now.

_______________________
Programmer and developer
Posted: 2011-11-22 00:33  (Last Edited: 2011-11-22 00:44) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#26271
Okay, so I rewrote the modulator code for FDSSound.cpp to match Disch's document, and the results now sound very much like what I hear in the other emulators. (WAV output attached.)

I can check this in to the SVN repo if you like. Otherwise, I've attached the changed file for reference.


Attachments:
fdssound.cpp (9 Kb)
link_no_bouken_21.wav (336 Kb)
Posted: 2011-11-23 01:09 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#26336
Great, thanks a lot!

I tested it in my NSF player and did some research (finding more videos with recordings of FDS games) and this indeed seems more accurate than nezplug's implementation after all, so it should be all ok to check in.

_______________________
Programmer and developer
Page 1 of 1 Sort: