I'm working on some code which streams PCM audio to 4011.. with 7 bit pcm data, the value of $40 represents the middle of the waveform and is "silence".. but I notice in emulators that I'm getting a "pop" in my initialization code when I set 4011 to $40 before I play the samples. I'm not sure if this is poor emulation or if that's how the nes would react too.
Is this how the hardware acts too? And to remove the pops, should I ramp up from $00 to $40 and then ramp back down to $00 at the end?
Is $4011's default value $00 at start up?
Moderator: Moderators
Re: Is $4011's default value $00 at start up?
The upper 6 bits are explicitly set to 0 during reset (visual2a03 transistors t13729, t13590, t13426, t13263, t13119, t13027). However, the least significant bit is left unchanged.
As far as advice goes, I don't think it's really worth worrying about. Working from a 0-as-default will add distortion to the beginning and end of your samples. If that pop really bothers you, either slowly ramp up the DC bias over the first second with writes to $4011, or have a short sample prepared that will move from $00 to $40. (Note that either way this will be audible as brief tonal hum)
As far as advice goes, I don't think it's really worth worrying about. Working from a 0-as-default will add distortion to the beginning and end of your samples. If that pop really bothers you, either slowly ramp up the DC bias over the first second with writes to $4011, or have a short sample prepared that will move from $00 to $40. (Note that either way this will be audible as brief tonal hum)
- rainwarrior
- Posts: 8731
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Is $4011's default value $00 at start up?
It's pretty normal to hear a pop when you hit reset on a console, I don't think it's really a problem to just set it to $40 at reset? Kinda fits with all the other garbage you see for an instant.
However, maybe worth noting that the noise and triangle get slightly quieter the higher the DMC output is set due to their shared non-linear DAC. That's not necessarily a problem, you can just compose the music etc. with the adjusted levels in mind. (You can use Z40 in Famitracker to do this, and the effect will be fairly accurate.)
However, maybe worth noting that the noise and triangle get slightly quieter the higher the DMC output is set due to their shared non-linear DAC. That's not necessarily a problem, you can just compose the music etc. with the adjusted levels in mind. (You can use Z40 in Famitracker to do this, and the effect will be fairly accurate.)
Re: Is $4011's default value $00 at start up?
I can live with the pop at start up but the code I'm adding these samples later sets 4011 back to 00 to use the volume control that you mentioned. I never heard it pop at start up until I added my code. I think I might try out the ramping in and out thing, I don't think it should be audible if it's slow enough
Re: Is $4011's default value $00 at start up?
Oddly, SMB does something like that, too. It ramps it up to $30 when you're playing, then ramps it down to $00 when you die. But why, it's a mystery.
Re: Is $4011's default value $00 at start up?
yeah, that's the game I'm adding the sounds too (turn on audio).. that's an old version with the pops I was mentioning. SMB only ramps up while main theme is playing, presumably to get the mix right I guess? it will ramp down if you go into a room with other music, or if you die like you mentioned. And it probably ramps to avoid the pop
After some experimenting, both Mesen and Fceux will not pop if you initialize $4011 with #$00 and start/end the samples with a ramp from #$00 to #$40 that is ~.015 seconds long (actually, half that also works.. possibly shorter).
Last edited by frantik on Wed Oct 07, 2020 1:42 am, edited 1 time in total.
Re: Is $4011's default value $00 at start up?
Wow I'm surprised such a trick was used in such an early game ! So far I only knew about Life Force doing this when the music fades out.
Last edited by Bregalad on Wed Oct 07, 2020 3:08 am, edited 1 time in total.
Useless, lumbering half-wits don't scare us.
- rainwarrior
- Posts: 8731
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Is $4011's default value $00 at start up?
I think it's a per-track setting, where some tracks want it at $30 and some want it at $00, so when a new track starts it slowly moves to the other position. (E.g. the underground music wants it at 0, regular level music at $30). I presume it's being used as a volume control for the triangle.
Startropics also uses it when fading out music.