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 > Fading out whilst using the tri and DPCM channels Owner: Naff_Natty New post
Page 1 of 1 Sort:  
Fading out whilst using the tri and DPCM channels Posted: 2012-10-23 02:03 Reply | Quote
Naff_Natty

Avatar

Member for: 3727 days
Location: Behind you
Status: Offline

#40917
Impossible?

RE: Fading out Posted: 2012-10-23 02:22  (Last Edited: 2012-10-23 02:22) Reply | Quote
Patashu

Avatar

Member for: 3749 days
Location: Sydney, Australia
Status: Offline

#40920
[quote=Naff_Natty]Impossible?[/quote]

You can fade out triangle by ramping up the value in the DPCM delta counter (e.g. with Zxx or specifically crafted sample)

You can fade out DPCM by using successively quieter DPCM samples (I don't think you can programatically do this within Famitracker)

Doing both at once is a difficult balancing act, but don't forget that you can make triangle 'quieter' by dropping it by perfect fourths/fifths/octaves or making each note shorter than the last.

Alternatively (the cheating solution), you can do the fadeout in post-production (in for example Audacity)

RE: Fading out Posted: 2012-10-23 05:20  (Last Edited: 2012-10-23 05:20) Reply | Quote
TechEmporium

Avatar

Member for: 4485 days
Status: Offline

#40925
[quote=Patashu]The truth has been told.[/quote]

Quite rightly.

You might want to check out Necrophageon's test FTM module for raming triangle volumes using DPCM. Check the attachment.

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

(Lousy modern technology! )
Attachments:
testplus.ftm (8 Kb)
Posted: 2012-10-23 05:43  (Last Edited: 2012-10-23 09:33) Reply | Quote
Necrophageon

Avatar

Member for: 3965 days
Location: Minnesota
Status: Offline

#40927
Those are handy if you're not using samples (EDIT - ok, technically speaking, those ARE samples), but if you wanted to use DPCM samples at the same time it gets more complicated.

If all you want to do is fade out though, you can just combine samples of various volume levels and Zxx commmands, but it's a bit of a balancing act, as Patashu mentioned.

The delta counter makes the triangle/noise channels quieter when it is higher (7F), and louder when it is low (00/80), but the same effect also applies to the DPCM channel itself.... play a sample with a Z00, and it's nice and loud... play the same sample with a Z7F, and it's noticeably quieter.

This all depends on the amplitude of the sample, though. A loud sample that touches both ends of the spectrum will usually play just as loud and the triangle/noise will remain pretty much constant, no matter the Zxx command (the only difference will be the pop you get from pushing the delta counter around), but a softer sample is more malleable. I've attached a quick example - loud sample first.

Another point I should probably make is that while you can set the starting position of the delta counter and play a sample, chances are pretty good that the delta counter won't *land* on the position you started it on; so if you're attempting to make the triangle as quiet as possible, there are still more steps to take. You can use the 'tilt' function in the sample editor built-into FamiTracker to pull the delta wave back towards 00, but to do the opposite (what you want) requires some hex-editing, or just use the Tri Vol Min sample after your last drum, or whatever sample it is you wanted in the song.

You can't bring the triangle down to an equivalent of '1' on some other channel, either... it's more like 'A' at best, so you'll never really get a nice smooth fade-out from it.

I suppose you could attempt making some triangle samples.... but I think I'm just going to stop before this gets too complicated (too late?). :\


_______________________
The only things certain in life are death and uncertainty.
Attachments:
example.ftm (2 Kb)
Posted: 2012-10-23 11:17 Reply | Quote
Patashu

Avatar

Member for: 3749 days
Location: Sydney, Australia
Status: Offline

#40932
If you want triangle wave DPCM, try this (ftm by Rushjet1):


Attachments:
w.ftm (20 Kb)
Posted: 2012-10-23 17:17 Reply | Quote
Naff_Natty

Avatar

Member for: 3727 days
Location: Behind you
Status: Offline

#40937
Aha, these are two things that I've never quite got my head around and so have thus far never used: the zxx (wtf is a delta counter, can it be used on the Nile?) and the creation of my own samples (I once tried importing loads of different samples I already had, some wouldn't import, others came with varying success of sound quality). Is there a method to take the same sample and reproduce it at quieter and quieter levels?

Posted: 2012-10-23 18:08  (Last Edited: 2012-10-23 18:10) Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#40939
If you're going to import your own waves, the ideal sample rate is 33,144 Hz, because that's the sample rate the 2A03 uses for DMC samples, and anything above that will get downsampled.

As for volume, there's not really any way to do that other than using Yxx, which offsets the sample's starting point (Y01 starts the sample 64 bytes after the beginning, usually resulting in the same sound but slightly quieter because it drops the attack), or simply re-importing the same wave file and giving it less gain (it does waste memory space, but you get 256 KB of it so it's not that much of a concern at that stage).

To the best of my knowledge, the "delta counter" is the counter that tells the DAC (Digital to Analog Converter) what level it's outputting at, and it affects the entire APU2 side of the 2A03 (that is, the triangle, noise and DPCM channels). You can change it manually by writing to the NES's $4011 register, which is exactly what Zxx does. Raw PCM is a series of very quick $4011 writes.

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2012-10-23 18:48 Reply | Quote
Naff_Natty

Avatar

Member for: 3727 days
Location: Behind you
Status: Offline

#40942
[quote=jrlepage] To the best of my knowledge, the "delta counter" is the counter that tells the DAC (Digital to Analog Converter) what level it's outputting at, and it affects the entire APU2 side of the 2A03 (that is, the triangle, noise and DPCM channels). You can change it manually by writing to the NES's $4011 register, which is exactly what Zxx does. Raw PCM is a series of very quick $4011 writes.[/quote]

Great!



Erm, what? Ha, ha.

I read and I read what you guys say and still I have no idea what you're talking about. Well, I kinda get half of that, I guess I just don't know what a $4011 register is or what you'd do with it if the two of you were alone on a wet Sunday evening.

so using Zxx changes the output, but how? if I type Z00 next to my DPCM sample it makes my triangle louder? Does it do anything to my sample? How do I gain control?

Posted: 2012-10-23 19:08  (Last Edited: 2012-10-23 19:10) Reply | Quote
za909

Avatar

Member for: 3962 days
Location: Hungary
Status: Offline

#40944
Open a game in an emulator. (VirtuaNES in this case if you have it)
Tool -> Viewer -> Memory Viewer
Here, you see everything the CPU sees. RAM ($0000 - $00FF;$0300 - $07FF) , and everything else including sound is "mapped" to this (connected to the different pins on the actual processor that correspond to different sections of what the CPU sees) and $4011 is where the DPCM delta counter is. If a program tells the CPU to "send" a value (write) to its $4011-th "slot" it does so. But since that part of the CPU is connected to the DPCM counter in the NES, it writes to that.

_______________________
Rectangular sh*t ©
Posted: 2012-10-23 20:44 Reply | Quote
Necrophageon

Avatar

Member for: 3965 days
Location: Minnesota
Status: Offline

#40950
[quote=Naff_Natty]so using Zxx changes the output, but how? if I type Z00 next to my DPCM sample it makes my triangle louder? Does it do anything to my sample? How do I gain control?[/quote]

Zxx sets the delta counter to xx (00-7F).

Playing a sample affects the delta counter according to the wave data in the [url=https://www.dropbox.com/s/wptc3t9lx0h5b0i/sample.png]sample editor (at a rate of 33,144 Hz like jrlepage said).

This sample lands somewhere around 40 (Z40), so after playing the sample, the delta counter will be ~40.

If you want to play around with it, check out Tracker -> Display DPCM State in FamiTracker so you can see what's going on behind the scenes.

_______________________
The only things certain in life are death and uncertainty.
Posted: 2012-10-23 23:53  (Last Edited: 2012-10-24 03:18) Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#40960
[quote=Naff_Natty][quote=jrlepage] To the best of my knowledge, the "delta counter" is the counter that tells the DAC (Digital to Analog Converter) what level it's outputting at, and it affects the entire APU2 side of the 2A03 (that is, the triangle, noise and DPCM channels). You can change it manually by writing to the NES's $4011 register, which is exactly what Zxx does. Raw PCM is a series of very quick $4011 writes.[/quote]

Great!



Erm, what? Ha, ha.

I read and I read what you guys say and still I have no idea what you're talking about. Well, I kinda get half of that, I guess I just don't know what a $4011 register is or what you'd do with it if the two of you were alone on a wet Sunday evening.

so using Zxx changes the output, but how? if I type Z00 next to my DPCM sample it makes my triangle louder? Does it do anything to my sample? How do I gain control?[/quote]
Let's see if I can light your lantern...

The NES APU uses a series of 8-bit [url=http://wiki.nesdev.com/w/index.php/APU_registers]registers that control a variety of things. $4000-$4003 controls Square 1, $4004-$4007 controls Square 2, $4008-$400B controls the triangle channel, $400C-$400F controls the noise channel, and finally $4010-$4013 controls the DPCM channel.

As you can see, $4011 is one of the registers that control the DPCM channel, and if you click that link up there and look up $4011 in the list, you'll see it's labelled "Direct load", and that it only accepts 7-bit values (between 0 and 127, or 0x00 and 0x7F). This means by writing a 0x7F to $4011 you're just telling the DAC to output 7F continually. On its own it doesn't do much (other than cause an audible "pop" at the time of the write, and attenuate the triangle and noise's output levels as you approach 0x7F), but by writing to it continually you can produce 7-bit PCM, as if you were playing a wave file on the NES (in a manner of speaking).

In all of this wall of text, "writing to $4011" is fully interchangeable with "entering a Zxx effect".

Famitracker doesn't let you write anywhere near fast enough to produce 7-bit PCM, however. So why bother letting you write to $4011? Well, as I said, the higher the DAC output, the quieter the triangle & noise output will be. As you know the triangle channel has no built-in volume control, so Zxx offers you a way to ever-so-slightly modify the amplitude of that channel. You don't get as much leeway as Square 1 and 2's 4-bit volume register (which, incidentally, is defined by the first four bits of the $4000 and $4004 registers respectively!), but it's something.

Writing to $4011 (using Zxx) isn't the only way to affect the DAC counter though. DPCM samples are output through the DAC as well, so if your sample ends at 0x40, then the end result is the same as if you'd used Z40. So if you need your counter at 0x7F, you'll need to either use Z7F, or make a sample that ramps from 0x40 to 0x7F.

As for why inserting Zxx next to a sample causes a "pop", that's because in practice (and this goes for anything, not just the NES APU), any sudden change in output is represented by a clicking sound. Basically if your DPCM sample begins at 0x40, and you write Z00 next to it, you're hearing the volume jump up from 0 all the way to 64! Hence the audible "pop" that we all like so much.

I hope I was clearer than my previous message... Sorry about the wall of text. :\

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2012-10-24 03:03 Reply | Quote
Necrophageon

Avatar

Member for: 3965 days
Location: Minnesota
Status: Offline

#40969
It's probably worth mentioning also that the counter always retains it's value until something changes it.

_______________________
The only things certain in life are death and uncertainty.
Posted: 2012-10-24 03:16  (Last Edited: 2012-10-24 03:16) Reply | Quote
jrlepage
Moderator

Avatar

Member for: 4983 days
Location: Canada
Status: Offline

#40970
It was implied in this sentence

[quote=This sentence]This means by writing a 0x7F to $4011 you're just telling the DAC to output 7F continually.[/quote]
But yeah I suppose it's worth highlighting indeed. :)

_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
Posted: 2012-10-24 06:35 Reply | Quote
Necrophageon

Avatar

Member for: 3965 days
Location: Minnesota
Status: Offline

#41000
Oh, right. Sorry. On it's own it's clear as day, but not so much in the context of the paragraph. :\

_______________________
The only things certain in life are death and uncertainty.
Posted: 2012-10-24 17:39 Reply | Quote
Naff_Natty

Avatar

Member for: 3727 days
Location: Behind you
Status: Offline

#41015
Okay, thanks guys. Some of this is slowly seeping in. No problems about the wall of text - I think I need it! Perhaps more... I guess I'll learn in the end.

Page 1 of 1 Sort: