Author Topic: Question: Wave-phasing on the PC engine, how feasible is that?  (Read 8347 times)

Mednafen

  • Full Member
  • ***
  • Posts: 140
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #45 on: January 08, 2017, 01:29:55 PM »
Try writing 0xDF, then 0x9F, to $804, after at least the first stw to $0802.  Like:
Code: [Select]
.do_saw:
stz $0800
stw <Copy_Freq,$0802
lda #$DF
ldx #$9F
sta $0804
stx $0804
TIN wave_saw,$0806,32
stw #DEF_FREQ,$0802 ;Write default frequency
rts

The demo I linked to is supposed to be quiet(another problem with it :p).
« Last Edit: January 08, 2017, 01:36:28 PM by Mednafen »

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #46 on: January 08, 2017, 02:50:27 PM »
Yeah, that works pretty well, except for the odd couple of times where it starts up after reset and alternating writes don't work.

I guess a more elaborate test prog is in order.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #47 on: January 08, 2017, 03:08:01 PM »
Yeah, that works pretty well, except for the odd couple of times where it starts up after reset and alternating writes don't work.

 Are you initializing EVERY psg reg? I had issues with some PCE tests with a few channel regs were uninitialized. Drove me crazy until I wrote $00 to ever damn port of every channel select! Lol. It would get weird behaviors on resets/power up states until I did that. It fixed it.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #48 on: January 08, 2017, 06:49:42 PM »
Yeah, disabled noise, and even set the LFO reg $0809 to #$80 (not just 00 like many games do) to turn it off properly.  Problem still persists.  Could it be a race condition bug or something like that?

Anyway, unrelated, here is the PCE caught in the act of switching between a rising sawtooth and a falling one getting TIN'ed in:


Here is the code for it:
Code: [Select]
stz $0800
stw <Copy_Freq,$0802
lda #$DF
ldx #$9F
sta $0804
stx $0804
TIN wave_sawinv,$0806,32
stw #DEF_FREQ,$0802 ;Write default frequency

Probably could be done a tad faster.

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #49 on: January 09, 2017, 02:32:13 AM »
Hah!  Now, I'm interested in this wave-phasing shenanigans.  If it can be done without that hideous pop I can replicate that HARD knock at the beginning of each bassline beat from the Genesis version of my SoR1St1 cover... which would probably sound great!

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #50 on: January 09, 2017, 03:38:49 AM »
Hah!  Now, I'm interested in this wave-phasing shenanigans.  If it can be done without that hideous pop I can replicate that HARD knock at the beginning of each bassline beat from the Genesis version of my SoR1St1 cover... which would probably sound great!

Umm, maybe? If you've heard my examples you've probably noticed that this effect is better off used on very specific situations which exclude lower-pitched instruments such as baselines, it's on those that the effect is at its worst...
Now yeah, if it can be done without the popping sounds then it would work wonders for a more bassy sound, especially on a song covered from the Genesis, but if the popping problem can't be solved, which it's proving hard to, then I'd suggest you to stay away from wave-phased basses...
However there are some other trick to get a 'Hard knock' at the beginning of a bass sound, it's probably not what you're looking for, but the trick is to use the arpeggio effect, on which in the very first tick you put the note an octave above (or below depending on what you want) the note you're currently playing, and then in the second tick you switch to the proper note you meant to play an hold on it...
It's not gonna sound good for a lot of songs, but a fair few of them can benefit from this trick...


^Here's what the envelope looks like
http://sta.sh/01g5r8e9ukot
^And here's an example of a song that I made that uses it, it's incomplete, and I don't know if I'll ever complete it, and yeah it has no drums because the original has no drums, it's the reason the bass in it is so heavy...

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #51 on: January 09, 2017, 05:04:02 AM »
Try writing 0xDF, then 0x9F, to $804, after at least the first stw to $0802.

Excellent idea, thanks!  :)

For anyone without the documentation, that resets the address counter back to 0, and (presumably) reloads the period counter from the registers.


Yeah, that works pretty well, except for the odd couple of times where it starts up after reset and alternating writes don't work.


 Are you initializing EVERY psg reg? I had issues with some PCE tests with a few channel regs were uninitialized. Drove me crazy until I wrote $00 to ever damn port of every channel select! Lol. It would get weird behaviors on resets/power up states until I did that. It fixed it.

I don't know if it'll make any difference at all, but the docs state that certain registers should not be "0".

In-particular, the frequency settings, where a value of "0" is either "forbidden" or "undefined".


Problem still persists.  Could it be a race condition bug or something like that?

Could it be junk left in the DDA latch?

This whole writing-to-R6-while-playing-and-not-DDA isn't covered in the manual, and we've got no idea of the phyical connections between the transistors/gate/latches inside the chip.

I'm specifically curious why the docs tell you to set chOn=0 DDA=1 and write $00 to R6 *before* enabling normal DDA mode with chOn=1 DDA=1.


Anyway, unrelated, here is the PCE caught in the act of switching between a rising sawtooth and a falling one getting TIN'ed in:

That's so cool to see! It's wonderful that someone has a scope so that these things can be recorded.   :D

The obvious next questions are ...

1) what does it look like if the transition catches a falling sawtooth near the end of a loop (i.e. is there a massive spike high, or not).

2) and most importantly, how does the spike that you're showing there compare to the spike that's seen when uploading the waveform in the "recommended" fashion by turning off the channel (chOn=0 DDA=0).

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #52 on: January 09, 2017, 05:13:06 AM »
However there are some other trick to get a 'Hard knock' at the beginning of a bass sound, it's probably not what you're looking for, but the trick is to use the arpeggio effect, on which in the very first tick you put the note an octave above (or below depending on what you want) the note you're currently playing, and then in the second tick you switch to the proper note you meant to play an hold on it...
It's not gonna sound good for a lot of songs, but a fair few of them can benefit from this trick...

Yep, I was specifically told to add that effect to my driver when it was originally written, and you can hear it used extensively in the Navy Seals tune.

It's nice that you can achieve the same result in deflemask with the Arpeggio Macro.

Now ... if only Delek just let you enable/disable noise-mode-and-frequency inside the Wave Macro, just like waveform switching, then I'd be really happy.

That would be easy to implement, and not require much of a UI change.

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #53 on: January 09, 2017, 05:45:06 AM »
Now ... if only Delek just let you enable/disable noise-mode-and-frequency inside the Wave Macro, just like waveform switching, then I'd be really happy.

That would be easy to implement, and not require much of a UI change.
Yeah, that's pretty much what I've recommended him to do a while back, it would make PSG drums much easier to make and also allow for more freedom when making them, without having to rely on the timings of the ticks-per-row counters and turning on and off noise mode in the effects column constantly...

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #54 on: January 09, 2017, 06:20:43 AM »
Now ... if only Delek just let you enable/disable noise-mode-and-frequency inside the Wave Macro, just like waveform switching, then I'd be really happy.

Yeah, that's pretty much what I've recommended him to do a while back, it would make PSG drums much easier to make and also allow for more freedom when making them, without having to rely on the timings of the ticks-per-row counters and turning on and off noise mode in the effects column constantly...

I can always do some special-processing on channels 5 & 6 in Huzak to give you that capability, if you want it. The easiest thing would be to just treat any waveform number > 15 as a noise+freq on those channels.

Pretty-much how I'd expect Delek to implement it if he were to add it (although I hope that he'd do it as any waveform > 127, and increase the number of available waveforms).

Of course, you'd only be able to hear it work properly when using Huzak ... but using it on a track might be enough to push him into implementing it in Deflemask.

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #55 on: January 09, 2017, 07:35:52 AM »
I can always do some special-processing on channels 5 & 6 in Huzak to give you that capability, if you want it. The easiest thing would be to just treat any waveform number > 15 as a noise+freq on those channels.

Pretty-much how I'd expect Delek to implement it if he were to add it (although I hope that he'd do it as any waveform > 127, and increase the number of available waveforms).

Of course, you'd only be able to hear it work properly when using Huzak ... but using it on a track might be enough to push him into implementing it in Deflemask.
Umm, you can already adjust the noise frequency in the notes themselves as well as in the arpeggio macro, so you only really need an on/off toggle for the noise mode envelope, what I'd suggest is to use Waveform 32 in the wave macro as the noise mode on, and anything below that as noise mode off, which would use that respective wavetable, which works for me considering the most waves I've ever used in a song was 30 and I still had the 2 waveforms left, which means wave 32 was still free for me to use to set noise mode and use PSG drums like normal! (But I used sampled drums in that song, but that's besides the point...)

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #56 on: January 09, 2017, 08:31:27 AM »
Umm, you can already adjust the noise frequency in the notes themselves as well as in the arpeggio macro, so you only really need an on/off toggle for the noise mode envelope

Errr ... I thought that the idea was to get rid of the noise frequency in the pattern itself, and just make it a part of the instrument definition (better drums, less clutter in the pattern).

As it stands, the ability to set the noise frequency basically comes on the same pattern-row as the noise-on effect (and can be changed on subsequent rows) ... am I correct in that?

If you enable the noise in a Wave Macro in the middle of the row that triggers the initial note/waveform, then what value do you want me to use for the initial noise frequency?


what I'd suggest is to use Waveform 32 in the wave macro as the noise mode on, and anything below that as noise mode off, which would use that respective wavetable, which works for me considering the most waves I've ever used in a song was 30 and I still had the 2 waveforms left, which means wave 32 was still free for me to use to set noise mode and use PSG drums like normal! (But I used sampled drums in that song, but that's besides the point...)

OK, that's strange! He only allows you to create 32 waveforms (0..$1F), but he allows you to put an illegal "32" (instrument $20) into the wave macro.

I'd hadn't considered that you could use the Arpeggio Macro for noise frequency ... but that *could* work out nicely, it would just be a case of deciding how to map the +/-12 range of the arp onto the 1..31 range of the noise frequency.

And that would make any potential change to the Deflemask UI even easier!

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #57 on: January 09, 2017, 10:07:30 AM »
Errr ... I thought that the idea was to get rid of the noise frequency in the pattern itself, and just make it a part of the instrument definition (better drums, less clutter in the pattern).

That's exactly the idea!
Look at this screen-cap, it shows how I do my drums:

As you can see, I'm only really putting C notes on channel 6 because whatever note I put there doesn't really matter as I'm using the arpeggio macro to do my note-changes with the "Fixed Arpeggio" box checked.
The example shown in the screenshot is for the snare drum, it's the one that requires changing from wave to noise on-the-fly, pay attention to the parts that look like this:
[C-2|-] [1|11 00]
[ ---|-] [- |11 01]
That's the effect that is changing between noise mode and wave mode, (00 is wave mode and 01 is noise mode)
The idea is to eliminate those [11 00]s and [11 01]s, because as you can see, I have to rely on the song's tempo to change between wave and noise modes, which while not exactly hard, it's a little limiting with the kinds of PSG drums I can make because I can't make a drum that changes from wave to noise and back in a per-tick basis, only in a per-row basis, so I have to pay attention to my 'ticks-per-row' counter, but with a noise mode envelope I could potentially do something like this:

Which is how the exact same snare drum would work if you did it like I suggested!
Look at the wave macro now, before it was just one 00, because that's the wavetable it uses before it changes into noise mode, but in the second picture it is 00 00 32, with the suggestion I gave you it would play that wavetable for 2 ticks and in the 3rd tick it would switch to noise mode, so I'd be able to not only eliminate those 11xx effects, but also save this drum instrument like that and use the same drum consistently in a variety of songs without worrying about the song's tempo, which is defined by the ticks-per-row counter!
But the way it works right now I have to pretty much make a different PSG snare drum for each tempo...

I'd hadn't considered that you could use the Arpeggio Macro for noise frequency ... but that *could* work out nicely, it would just be a case of deciding how to map the +/-12 range of the arp onto the 1..31 range of the noise frequency.

And that would make any potential change to the Deflemask UI even easier!


Deflemask already has that mapped, pretty much every song I make with the PSG drums (which is most of them) already has all of the desired noise frequencies in place in the arpeggio macro, so that's pretty much good to go, all that I really need is that "on/off" switch for the noise mode in an envelope...

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #58 on: January 09, 2017, 11:19:40 AM »
As you can see, I'm only really putting C notes on channel 6 because whatever note I put there doesn't really matter as I'm using the arpeggio macro to do my note-changes with the "Fixed Arpeggio" box checked.

Jeez ... I'd been meaning to ask what effect the "Fixed Arpeggio" had for a while now, without even seeing that it pops up a scroll bar that allows you to enter 00-95 8-octave range instead of the +/- 12 relative range.

That's *really* useful!  :D

OK, I understand how you want to enter the information, now.


And that would make any potential change to the Deflemask UI even easier!

And now it's even easier ... trivial, actually ... just replace the "32" in the Wave Macro with "NZ" (for noise)!


Quote
Deflemask already has that mapped, pretty much every song I make with the PSG drums (which is most of them) already has all of the desired noise frequencies in place in the arpeggio macro, so that's pretty much good to go, all that I really need is that "on/off" switch for the noise mode in an envelope...

Except ... that there is something in there that I'd really like to change.

If you are already putting noise frequencies in the Arpeggio Macro (even though they're currently ignored), then I assume that you're using Deflemask's limited 12-note-range for the 31 frequencies that the PSG chip actually supports.

I'd much prefer to put the exact number that's in the Arpeggio Macro directly into the noise-frequency
register.

It's both quicker to process, and it would give you access to the *entire* range of noise frequencies (1..31) that the chip supports, which will probably be important for metallic percussion sounds, and smoothing out their quick drop-off in high-frequency transients.

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #59 on: January 09, 2017, 12:03:33 PM »
Except ... that there is something in there that I'd really like to change.

If you are already putting noise frequencies in the Arpeggio Macro (even though they're currently ignored), then I assume that you're using Deflemask's limited 12-note-range for the 31 frequencies that the PSG chip actually supports.

I'd much prefer to put the exact number that's in the Arpeggio Macro directly into the noise-frequency
register.

It's both quicker to process, and it would give you access to the *entire* range of noise frequencies (1..31) that the chip supports, which will probably be important for metallic percussion sounds, and smoothing out their quick drop-off in high-frequency transients.
Wait, so you're telling me that there's more noise frequencies that the PC engine supports that Deflemask doesn't allow me to use? What the hell?! I'm gonna ask Delek about that right now!