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 > FamiTracker Talk > Square waves and how they mix in the tracker Owner: ElHuesudoII New post
Page 1 of 1 Sort:  
Square waves and how they mix in the tracker Posted: 2010-08-30 18:41 Reply | Quote
ElHuesudoII

Avatar

Member for: 4525 days
Status: Offline

#9120
Me being, as usual, curious about things no one else would care about, I decided to check out what happened when one mixed 2 square waves of different duty value together (back when I had the 0.3.0 version of FamiTracker). All in all, I was amazed by listening to the mix between both 25% duty cycle square waves.

However, when I made the transition to 0.3.5., the sound made by this technique was completely different.

So I was tinkering around with similar experiments between versions, and here's one I thought was quite odd. I played a middle C in 2 square channels: one 2A03 and one VRC6. I added a fadein-fadeout sequence to both channels in a way that when one channel was at max volume, the other was mute, and viceversa.

You can check out exactly what I mean by opening the attached FTM.

However, this same file, when opened in different versions of FamiTracker, output different results: I attached two WAV files rendering the same track (for 3 seconds) using two different versions of the tracker (0.3.0 and 0.3.6).

But then I decided to be extra-thorough: I rendered an NSF file. AND IT SOUNDS WAY DIFFERENT FROM BOTH.


Posted: 2010-08-30 20:18 Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9122
What do you expect?, xD Famitracker sounds different between NSF players because these 2 softwares are EMULATING the 2a03 chip in a different way. The same between different versions of Famitracker.
If you have the PowerPak make a .NES file from the NSF and test the sound in a real NES, THIS is the original sound.

_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Posted: 2010-08-31 00:21  (Last Edited: 2010-08-31 03:43) Reply | Quote
ElHuesudoII

Avatar

Member for: 4525 days
Status: Offline

#9126
damn, I'd so want to do that. Anyone up for the task?

EDIT: ...Would it even be possible? I mean, I did use VRC6 in this experiment.

Posted: 2010-08-31 01:27 Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9127
I have a beautiful and almost new NES, but i didn't have the PowerPak, it's very expensive for those who don't live in EEUU, like me.

_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Posted: 2010-08-31 01:58  (Last Edited: 2010-08-31 01:58) Reply | Quote
TechEmporium

Avatar

Member for: 4485 days
Status: Offline

#9129
I also have a fully-working spare NES without controller ports (I used them for a separate project,) but no PowerPak.

[url=http://www.retrousb.com/index.php?cPath=24&osCsid=c9f19903ee23ff585f3db12ad5cfc6b1]http://www.retrousb.com/index.php?cPath=24&osCsid=c9f19903ee23ff585f3db12ad5cfc6b1

It's $135 US.

Anyways, what Delek's saying is true; FamiTracker is a PC program that only imitates the original NES hardware as best as JSR (the programmer) can. This doesn't make it 100% accurate, even though it's a decent reference. The same goes for other programs that imitate the NES' inner-workings.

Here's another experiment that you can do if you're technically inclined & have the equipment. You'll need:

1 Oscilloscope (a tool to measure electrical waves, their frequencies & voltages)

1 NES console with any game cartridge

1 NSF file of the above game with an NSF file player

1 RCA/composite audio/video cable from your NES

1 two-way TRS connector cable from your computer's speaker output

All you do is measure the audio wave coming out of your computer & compare that to the NES' audio wave.

_______________________
Technology: the one thing that's hated & cursed at by all engineers, technologists, scientists & technicians!

(Lousy modern technology! )
Posted: 2010-08-31 03:29  (Last Edited: 2010-08-31 03:36) Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9131
I already make that one month ago, here are the results.

EDIT: At the end of the Arkanoid intro, you can notice a huge difference between the triangle of the emulated NSF and the original one triangle.
Image [url=http://img255.imageshack.us/img255/2715/comparsion.jpg]here.

_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Attachments:
arkanoid_nsf_pc.wav (209 Kb)
galaga_original.wav (688 Kb)
arkanoid_original.wav (209 Kb)
galaga_nsf_pc.wav (562 Kb)
Posted: 2010-08-31 04:13 Reply | Quote
TechEmporium

Avatar

Member for: 4485 days
Status: Offline

#9137
Brilliant work, Delek.

In the original hardware, the triangle wave exhibits the charging/discharging behavior of capacitive components from the system's audio amplifier. As a result, the original hardware's triangle wave actually looks like a shark's fin.

It's actually more correct to call the hardware's triangle wave a high-duty sawtooth wave, due to the analog interference that the capacitive components in the audio amplifier are causing to the output.

In the emulated system, however, you don't have any capacitive hardware components to mess around with your audio output. In reality, even though this "perfection" is what Nintendo must have originally wanted, hardware limitations would prevent them from such a goal. It's this imperfection that many programmers usually overlook (& understandably so; the original 2A03 actually generates a pure triangle wave before sending it to the amplifier).

It also looks like your emulated wave's 180 degrees out of phase with respect to the original hardware's wave.

_______________________
Technology: the one thing that's hated & cursed at by all engineers, technologists, scientists & technicians!

(Lousy modern technology! )
Posted: 2010-08-31 17:23  (Last Edited: 2010-08-31 17:24) Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9150
That's true TechEmporium, the NES with his internal components makes an unique sound.

Another huge difference [url=http://img824.imageshack.us/img824/2715/comparsion.jpg]here. That's from Galaga file. I'm using G-NSF for NSF playback.



_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Posted: 2010-09-01 01:10 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#9163
ElHuesudoII: You can't rely on the relative phase between each wave to be the same after you've exported to NSF because it depends on the exact delay between the audio register updates (and possibly also the state after reset), and that is not the same in the tracker and NSF files. Adding that to the tracker would probably not be possible without running exactly the same NSF code inside the tracker (would NOT be easy to do), and maybe not even then as it would probably be different in different players. The delay would also likely break when the NSF code is changed, meaning it would still sound different when played/exported in different versions.

Delek & TechEmporium: I agree that emulation is not perfect, but I think it can be good enough actually. There are no problems with creating a model of the analog components and the audio path with different kinds of filters. I haven't yet tried to figure out the actual filter parameters from the NES hardware, but I tweaked my own player a little according to the hardware recording of arkanoid (though I don't trust it completely as it seems to have some clipped waves, maybe it was recorded a little too loud?). A spectrum analysis indicated that there's a steep LP filter at around 12-13 kHz (the stuff above that seems to be mostly noise), and a HP filter at around 60Hz by checking the wave.

I've attached a recording from my NSF player as an example, this was done only with the built in filtering settings. It would be possible to achieve even better results with more advanced filters.

_______________________
Programmer and developer
Attachments:
arkanoid_nsf.wav (209 Kb)
Posted: 2010-09-01 02:57 Reply | Quote
TechEmporium

Avatar

Member for: 4485 days
Status: Offline

#9173
Yes; emulation is definitely not perfect, but it's accurate enough (if not more accurate than what Nintendo must have tried to attain in terms of function generation accuracy).

Now, I'm looking at both the emulated & original systems as stand-alone function generators; in this respect, the emulated system would produce audio more accurately due to the fact that very little capacitive/inductive reactance is acting on the audio output (considering that computer sound cards & their amplifiers are mostly solid-state systems). However, since the original hardware used a transistor-based amplifier system, that means capacitor filters would have to be used to protect the system from external noise (at the cost of function generation accuracy).

This is how I personally prefer to look at it; if I wanted to make my copy of FamiTracker sound more realistic, I'd build my own amplifier with an LM318 op-amp initial stage, a class A transistor amplifier stage & a class B push-pull power amplifier (that way, with the class A & B amplifiers I can provide enough capacitive reactance to distort the audio to something more accurate).

As for the waveform that Delek showed, I'd actually expect this; in a simulated system, it's easy to confuse 25% & 75% duty cycles as they're technically the inverse of each other. When this happens & the waves interfere with each other, the result would be the one wave subtracting from the other (instead of adding to the other, as in the original hardware).

That said, such a detail is very insignificant as 25% & 75% duty cycles will still generate the same audio tone.

_______________________
Technology: the one thing that's hated & cursed at by all engineers, technologists, scientists & technicians!

(Lousy modern technology! )
Posted: 2010-09-01 05:18 Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9177
@jsr: Yes, it's enough but not perfect.

And, wow, your tweak for the NSF player its very good.

But, maybe if your tests your parameters from other recorded NES game, you find that you need to modify the parameters in another way, but if you change these parameters then the sound of Arkanoid will be not as precise as it sound now. And you would be returned to the beginning.
I think that it's impossible to emulate those little and personal features that have the 2A03 processor. I hope I'm wrong.

PD: Please send me your NSF player with this tweak.

_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Posted: 2010-09-01 05:44 Reply | Quote
tadpole

Avatar

Member for: 5712 days
Location: Renton, WA, USA
Status: Offline

#9178
[quote=Delek]@jsr: Please send me your NSF player with this tweak.[/quote]

He only tweaked the settings (settings//sound settings) with the existing nsf live. He didn't update the NSF player.

Posted: 2010-09-08 02:14 Reply | Quote
jsr
Administrator

Avatar

Member for: 5924 days
Location: Sweden
Status: Offline

#9330
Yeah it was only the sound settings in the player. I don't know if I'd need to change the parameters with other tunes, but it would probably be better to use a recording with some noise channel sound to get more high frequency contents.
One way to get more accurate values would be to run a sine sweep on the output from the CPU.

_______________________
Programmer and developer
Posted: 2010-09-27 12:50  (Last Edited: 2010-09-27 12:52) Reply | Quote
Delek

Avatar

Member for: 4343 days
Status: Offline

#9937
Gyromite: NES vs NSF

_______________________
[url=http://www.delek.com.ar/]Delek's Website
[url=http://www.delek.com.ar/deflemask]DefleMask Tracker
[url=http://soundcloud.com/delek_music]Delek's SoundCloud
[url=http://www.youtube.com/dele1000]Delek's YouTube Channel
Attachments:
gyromite_nes.mp3 (104 Kb)
gyromite_nsf_pc.mp3 (104 Kb)
Page 1 of 1 Sort: