Non-linear mixing applies after playback stops

Please post about bugs here.
Forum rules
When making a bug report, please try to be as specific as possible. Include information on how to reproduce the bug and an example file if possible.
If the application crashed, please include the generated memory dump file as well.
User avatar
HertzDevil
Posts: 475
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR
Contact:

Non-linear mixing applies after playback stops

Postby HertzDevil » Fri Aug 28, 2015 10:45 am

Input the following pattern on launching FamiTracker, with instrument 00 blank:

Code: Select all

     # : Pulse 1      : Pulse 2
ROW 00 : C-3 00 . ... : ... .. . ...
ROW 01 : ... .. . ... : ... .. . ...
ROW 02 : ... .. . ... : ... .. . ...
ROW 03 : ... .. . ... : ... .. . ...
ROW 04 : ... .. . ... : E-3 00 . V02
ROW 05 : ... .. . ... : ... .. . ...
ROW 06 : ... .. . ... : ... .. . ...
ROW 07 : ... .. . ... : ... .. . ...
Play the pattern and stop when both pulse channels are playing, then play from the beginning again. There is a 50% chance that Pulse 1 will be attenuated by about 6 dB, and a click will be heard instantly as Pulse 1 is about to make sound. This happens because the volume level of Pulse 2 is not reset to the zero level when playback stops; the mixer still thinks that Pulse 2 is held at the output level before stopping, and for a square wave the output stays at the maximum half of the time. The pulse channels only access the mixer when there is output, whereas the first few rows of Pulse 2 do not contain notes at all, which explains why Pulse 1 will sound as though the other channel is outputting at 100% duty (i.e. maximum volume all the time) until the E-3 note plays. Using V00 and V03 instead of V02 causes Pulse 1 to be attenuated 12.5% and 75% of the time, verifying the action of this bug.

This serious bug means that, in the worst case as in this pattern, a pulse channel can become only half as loud while another channel is not playing. It occurs on 0.4.6 stable and 0.5.0 beta 5, however I am able to recreate this bug in 0.2.2, so it probably has never been reported since the creation of the playback code.

EDIT: It seems this can be fixed by simply telling the 2A03 channels to set the output to the zero level in the respective Reset() method. It might be good to do the same to expansion chips too.
refactoring 0cc-famitracker

User avatar
za909
Posts: 79
Joined: Tue May 12, 2015 12:10 pm
Location: Hungary

Re: Non-linear mixing applies after playback stops

Postby za909 » Tue Sep 01, 2015 10:04 pm

I've noticed a similar trend with N163 channels, but there I could recreate this simply by testing my instruments in normal mode and not actually laying down notes. Sometimes there's a peculiar low-pass filter-like effect on the note.

User avatar
Dr. Merio
Posts: 680
Joined: Mon Apr 20, 2015 6:25 pm
Location: On your screen
Contact:

Re: Non-linear mixing applies after playback stops

Postby Dr. Merio » Sun Sep 06, 2015 3:33 pm

za909 wrote:Sometimes there's a peculiar low-pass filter-like effect on the note.

I have noticed this a lot when creating, and playing N163 songs, so I'm very interested in knowing what causes this.
My current avatar is why we need bigger avatars. >:C
Check out my YouTube channel!
[Dropbox (my FT stuff)]

User avatar
HertzDevil
Posts: 475
Joined: Thu Apr 23, 2015 7:39 pm
Location: Hong Kong SAR
Contact:

Re: Non-linear mixing applies after playback stops

Postby HertzDevil » Sun Sep 06, 2015 5:24 pm

This I believe fixes it:

Code: Select all

void CN163::EndFrame()
{
   for (int i = 0; i < 8; ++i) {
      m_pChannels[i]->EndFrame();
      if (i != m_iActiveChan)      // // //
         m_pChannels[i]->ResetCounter();
   }

   m_iGlobalTime = 0;
}

void CN163Chan::ResetCounter() { m_iCounter = 0; }
I am still not quite sure what causes it after CN163Chan::Reset() is called. It depends on the current multiplexer state rather than the volume level.
refactoring 0cc-famitracker


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest