Duty cycle changes when two channels play same note - FamiTracker

# FamiTracker

FamiTracker Support Forums

Skip to content

## Duty cycle changes when two channels play same note

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.
Post Reply

- Print view

7 posts • Page 1 of 1

The-Thrashy-One
  Posts: 2
  Joined: Tue Jun 14, 2016 7:34 pm

### Duty cycle changes when two channels play same note

- Quote

Post by The-Thrashy-One » Tue Jun 14, 2016 8:43 pm

I think this should go here since this sounds like a bug rather than an intentional feature (or a limit of the NES's capabilities). Forgive me if this has already been addressed somewhere else, but I did scour Google for information about this particular issue and found nothing. If I am unclear in anything I'm about to lay out, please don't hesitate to let me know so that I may better explain.
To start with, I'm using the VRC6 expansion on the most current version of FamiTracker. What I'm trying to do is emulate the sound of a xylophone, so I've made an instrument with the volume values set to [15 8 5 2] for a nice attack and release. Additionally, I have the duty cycle set to [2] since that best represents the clear "ring" of a xylophone.
Upon plotting down some notes in the default Pulse 1 (far left) channel - and with my xylophone instrument specified - I find that the notes sound properly upon playback. (And I don't know if this is relevant, but the volume is set to [A] in the volume column and the note lengths are being controlled by a value of [S0F] in one of the FX columns.)
Now the problem comes when I copy the notes (w/volume, instrument and FX data) from Pulse 1 over into Pulse 2 and transpose the copied notes to the next octave up [ctrl+F4]. When played back together, these two channels "abandon" the duty cycle value of [2] I have assigned within the instrument properties, instead sounding a duty cycle of [1]. If I mute one pulse channel, the other sounds the correct cycle. It's only when playing simultaneously that they sound a [1] (albeit with the dynamic properties I assigned in tact). Even setting the proper duty cycle [V02] in the FX columns for both channels doesn't solve the problem.
I thought I would get around this by duplicating my xylophone instrument as a VRC6 instrument and using it in the VRC6 pulse channels, but the same deal occurs; despite the pulse width being set to [7] in the instrument properties, both channels sound a pulse width of [3] when played simultaneously. I've even tried mixing and matching one default pulse channel with one VRC6 pulse channel, and same deal.
I've played around with the notes a bit and it seems as though this only happens when the two pulse channels are sounding the same note (regardless of octave). If, for example, one channel is sounding an E while the other is sounding anything from an F to a D#, only then do the notes sound with the duty cycle I assigned.
Does anyone know what to make of this? Any help would be greatly appreciated.
Top

Threxx
  Posts: 343
  Joined: Wed Apr 22, 2015 2:34 pm
  Location: Brooklyn, NY
  Contact:
  Contact Threxx
  Twitter Skype YouTube

### Re: Duty cycle changes when two channels play same note

- Quote

Post by Threxx » Tue Jun 14, 2016 8:58 pm

this is pulse clashing that will necessarily occur on any pulse channel (2A03, MMC5, or VRC6) where you have two of the same note sounding. wave physics will cause the wave to sound differently. not a bug, merely correct behavior
detune one of the pulse channels using the Pxx effect if you must use the same note on both pulse channels, but unless you want to achieve some kind of dual-pulse echo there is little reason you should. try also adding an octave distance between the two notes
Main Channel
Top

Stratelier
  Posts: 378
  Joined: Sun Apr 26, 2015 7:46 pm

### Re: Duty cycle changes when two channels play same note

- Quote

Post by Stratelier » Wed Jun 15, 2016 1:15 am

So the short version is you have two channels playing a 50% wave, but one of them an octave higher?
Threxx is right, strange things will happen if two channels' waveforms are perfectly in sync with each other. E.g:
Pulse 1 (50% wave):
1 1 0 0 1 1 0 0
Pulse 2 (50% wave, octave+1):
1 0 1 0 1 0 1 0
Result of mixing both channels:
2 1 1 0 2 1 1 0
So this is why it sounds like a 75% wave, because the result kind of is. (You could get the same results by combining a 25% and 75% wave on the same octave simultaneously.)
Top

The-Thrashy-One
  Posts: 2
  Joined: Tue Jun 14, 2016 7:34 pm

### Re: Duty cycle changes when two channels play same note

- Quote

Post by The-Thrashy-One » Wed Jun 15, 2016 1:39 am

Oh, I see. Before reading your posts I'd decided to check and see if it wasn't just the combined properties of both waveforms playing tricks on my ears; I exported each channel as an individual NSF, wrote them both to WAV, then laid the two tracks atop one another in Adobe Audition, and behold - it still sounds a 75% cycle when both are played at the same time, despite each one sounding a 50% cycle when soloed. Your posts basically verify for me that it's just a matter of waveform properties, and that I'm not just losing my mind (nor is FT for that matter).
Anywho, my original intent was just to 'brighten' the timbre of the melody, but I think can easily find another way to do just that. Thanks for the feedback!
Top

Stratelier
  Posts: 378
  Joined: Sun Apr 26, 2015 7:46 pm

### Re: Duty cycle changes when two channels play same note

- Quote

Post by Stratelier » Wed Jun 15, 2016 5:25 pm

Fun fact: There was a point in one song I was working on where I was using the 12.5% waves, and at one point they happened to hit the same pitch exactly out of phase with each other. The result was effectively a 25% wave at one octave higher. It was really weird.
Top

HertzDevil
  Posts: 475
  Joined: Thu Apr 23, 2015 7:39 pm
  Location: Hong Kong SAR
  Contact:
  Contact HertzDevil
  Website Facebook Twitter Skype
  YouTube

### Re: Duty cycle changes when two channels play same note

- Quote

Post by HertzDevil » Wed Jun 15, 2016 10:29 pm

From version 0.3.7 to 0.4.6, when the current refresh rate is one of the default values, FamiTracker will insert a small delay between processing the output of successive channels:

Code: Select all

`void CSoundGen::UpdateAPU()
{
const int CHANNEL_DELAY = 250;
// ...
for (int i = 0; i < CHANNELS; ++i) {
if (m_pChannels[i] != NULL) {
// ...
if (m_iFrameRate == CAPU::FRAME_RATE_NTSC || m_iFrameRate == CAPU::FRAME_RATE_PAL)
AddCycles(CHANNEL_DELAY);
}
}
// ...
}`
Therefore, in these versions it is possible for pattern data like this to output no sound other than clicks, as long as the refresh rate is neither 50 Hz nor 60 Hz:

Code: Select all

`# : Pulse 1 : Pulse 2
ROW 00 : C-3 00 . V01 : C-3 00 . V03
ROW 01 : ... .. . ... : ... .. . ...`
This continues as long as both channels write to the high byte of the frequency register at the same time. However, in general the phases of the two pulse channels cannot be exploited to produce a constant phase difference (hence specific timbres resulting from two pulses).
By contrast, here is the same loop in 0.5.0 beta 5, reconstructed from x86 disassembly:

Code: Select all

`unsigned int LastChip = SNDCHIP_NONE;
for (int i = 0; i < CHANNELS; ++i) {
if (m_pChannels[i] != NULL) {
m_pChannels[i]->RefreshChannel();
unsigned int Chip = m_pTrackerChannels[i]->GetChip();
if (m_pDocument->ExpansionEnabled(Chip)) {
int Delay = (Chip == LastChip) ? 150 : 250;
if (m_iConsumedCycles + Delay < m_iUpdateCycles)
AddCycles(Delay);
LastChip = Chip;
}
m_pAPU->Process();
}
}`
refactoring 0cc-famitracker
Top

Xyz
  Posts: 297
  Joined: Tue Apr 21, 2015 4:36 pm

### Re: Duty cycle changes when two channels play same note

- Quote

Post by Xyz » Mon Jun 20, 2016 12:24 am

You can't find this on google because you're not searching for the one word that describes this behavior:
Phasing
>:( Fuck you hentai boy i hate you squid anus
Top

Display posts from previous:
Sort by

Post Reply

- Print view

7 posts • Page 1 of 1

Return to “Bug Reports”

Jump to

- Rules
- Wiki
- FamiTracker
- General Talk
- Bug Reports
- Feature Requests
- Source and development
- Music
- Original Music
- Cover Music
- Other
- Site Issues & Suggestions