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

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #60 on: January 09, 2017, 12:13:03 PM »
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!

I could easily be wrong, but I saw that in one of the Tutorial videos, either Delek's or SpoonyBard's.

You only get to specify a "note" (without octave) for the noise frequency, right?

Just like the PCM samples, but there you can change banks to get more than 12.

Well, the PCE hardware itself supports 31 different noise frequencies ... but I have no idea how "usable" all of those frequencies are.

The frequencies are (approx) ...

r7=30  55938 Hz
r7=29  27969 Hz
r7=28  18646 Hz
r7=27  13984 Hz
r7=26  11188 Hz
r7=25   9323 Hz
r7=24   7991 Hz
r7=23   6992 Hz
r7=22   6215 Hz
r7=21   5594 Hz
r7=20   5085 Hz
r7=19   4661 Hz
r7=18   4303 Hz
r7=17   3996 Hz
r7=16   3729 Hz
r7=15   3496 Hz
r7=14   3290 Hz
r7=13   3108 Hz
r7=12   2944 Hz
r7=11   2797 Hz
r7=10   2664 Hz
r7=09   2543 Hz
r7=08   2432 Hz
r7=07   2331 Hz
r7=06   2238 Hz
r7=05   2151 Hz
r7=04   2072 Hz
r7=03   1998 Hz
r7=02   1929 Hz
r7=01   1865 Hz
r7=00   1804 Hz

« Last Edit: January 09, 2017, 12:34:49 PM by elmer »

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #61 on: January 09, 2017, 12:49:43 PM »
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!

I could easily be wrong, but I saw that in one of the Tutorial videos, either Delek's or SpoonyBard's.

You only get to specify a "note" (without octave) for the noise frequency, right?
You're exactly right Deflemask only allows for 12 possible noise frequencies, in fact, I thought the PC engine only had 12 possible noise frequencies until you said it had more!
So I've asked there about it and I've suggested 2 ways to implement the missing frequencies, one is the one you've suggested with the noise frequencies in positions 0 through 30 in the arpeggio macro with the "Fixed Arpeggio" box checked, and the other was to implement noise modes "11 02" and "11 03" to fill in the missing frequencies...

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #62 on: January 09, 2017, 02:51:53 PM »
The frequencies are (approx) ...

r7=30  55938 Hz


Is r7=31 (0x80 | 0x1F) invalid, duplicated or something? 

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #63 on: January 09, 2017, 03:12:08 PM »
The frequencies are (approx) ...

r7=30  55938 Hz


Is r7=31 (0x80 | 0x1F) invalid, duplicated or something? 

In the case of the noise frequency, the divider used is a complement (i.e. NOT) of the register value, with a zero-divider being illegal.

So a 0..30 register value, instead of the normally-expected 1..31.

(According to the docs, anyway.)
« Last Edit: January 09, 2017, 03:14:13 PM by elmer »

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #64 on: January 09, 2017, 07:46:27 PM »
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...


I know that technique you're talking about!  :D  I stumbled across it trying to get the bass to hit harder.  After I got the hang of the arpeggios and wave macros, i spent a lot of time playing around with it and tried pretty much all the "first tick" combinations, but couldn't find anything I liked.  :/  I even tried tried blending it a little with the second tick, but everything i tried had kind of a goofy twang i didn't like.  Ultimately, i ended up just putting a 1-tick spike at the beginning of the volume macro followed by a short sustain and curved decay, then cranking the volume up to FF... seemed to be the best I could come up with without being able to smoothly daisy-chain waveforms together.

That being said, now that I have the hang of creating the custom waveforms, I honestly think I could create just about any sound I want if the waveforms could be chained smoothly.  I realize, even if this works smoothly, for every tick in Deflemask, the waveform will loop many times before potentially switching to the next tick and waveform, but... if you're clever, you could set up several waveforms that are played one after the other and smoothly transition, and make some REALLY dynamic sounds come out of the PSG.

I know this is kind of a "Have you checked the power cord?" kind of question, guys, but are you sure the ends of the waveforms you're using for this test are lined up/aligned correctly for looping/chaining?  Looking at the shot that CCovell posted, it looks like there is some discrepancy where one wave ends and another begins, and you've essentially created a small saw wave with a short sustain.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #65 on: January 10, 2017, 12:41:08 AM »
The frequencies are (approx) ...

r7=30  55938 Hz



Is r7=31 (0x80 | 0x1F) invalid, duplicated or something? 


In the case of the noise frequency, the divider used is a complement (i.e. NOT) of the register value, with a zero-divider being illegal.
So a 0..30 register value, instead of the normally-expected 1..31.
(According to the docs, anyway.)

Hmm, interesting.  The actual hardware still produces noise at $1F... it sounds perhaps higher than $1E but also a tad quieter.  Didn't know that was an "illegal" setting. :\


Looking at the shot that CCovell posted, it looks like there is some discrepancy where one wave ends and another begins, and you've essentially created a small saw wave with a short sustain.


My little demo there doesn't try to match up the end of any wave, because in actual music, there'll be no way to make sure it's a smooth transition.  That blip there... perhaps someone can explain it?  At any rate, just looking in Mednafen's debugger, there is about a 4-sample offset due to the delay between resetting the wave pointer and the TIN kicking in.  That can be compensated for, but isn't crucial, is it?
« Last Edit: January 10, 2017, 12:47:33 AM by ccovell »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #66 on: January 10, 2017, 06:13:22 AM »
Hmm, interesting.  The actual hardware still produces noise at $1F... it sounds perhaps higher than $1E but also a tad quieter.  Didn't know that was an "illegal" setting. :\

The actual wording is "forbidden" for a zero tone divider, and "undefined" for a zero noise divider.


I know this is kind of a "Have you checked the power cord?" kind of question, guys, but are you sure the ends of the waveforms you're using for this test are lined up/aligned correctly for looping/chaining?  Looking at the shot that CCovell posted, it looks like there is some discrepancy where one wave ends and another begins, and you've essentially created a small saw wave with a short sustain.

As Chris said ... there's nothing that we can do about that.

When we come to change the waveform, the PCE hardware offers us no way to tell exactly which sample is playing in the current waveform, and so we can't line-up the transition.

You're going to get a discontinuity ... there's no (sane) way around that.

If you want long sample-accurate loops, you'll need to play a sampled-sound.

BTW ... I have absolutely no idea why Deflemask doesn't support looped samples, they're trivial to implement.  #-o

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #67 on: January 10, 2017, 06:49:42 AM »
What you're all describing is exactly what I meant when I said it's hard to get that nice synthy bass sound.  The retriggering kills it. 

[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #68 on: January 11, 2017, 03:32:11 AM »
Hmm, interesting.  The actual hardware still produces noise at $1F... it sounds perhaps higher than $1E but also a tad quieter.  Didn't know that was an "illegal" setting. :\

The actual wording is "forbidden" for a zero tone divider, and "undefined" for a zero noise divider.


I know this is kind of a "Have you checked the power cord?" kind of question, guys, but are you sure the ends of the waveforms you're using for this test are lined up/aligned correctly for looping/chaining?  Looking at the shot that CCovell posted, it looks like there is some discrepancy where one wave ends and another begins, and you've essentially created a small saw wave with a short sustain.

As Chris said ... there's nothing that we can do about that.

When we come to change the waveform, the PCE hardware offers us no way to tell exactly which sample is playing in the current waveform, and so we can't line-up the transition.

You're going to get a discontinuity ... there's no (sane) way around that.

If you want long sample-accurate loops, you'll need to play a sampled-sound.

BTW ... I have absolutely no idea why Deflemask doesn't support looped samples, they're trivial to implement.  #-o


Oh I see.  Well, then you're going to get crackle no matter what, since the waveform mismatch basically likely creates a small saw wave wherever/whenever it occurs.  I can't help but wonder, though, with some math and careful planning (or just plain trial and error), if if one had the exact frequency the first waveform was being played if you could diddle around with where DC offset=0 points were placed within the 32byte waveform to sort of "dodge" or avoid the crackle... essentially, wrap the waveform left/right within the 32byte grid until you find a "sweet spot" where there is no crackle.  assuming there is at least one occurence of DC offset=0 somewhere within each of the waveforms you're trying to match up.

Or are you saying that even if the two waveforms happen to meet cleanly at DC=0, there will still be crackle?
« Last Edit: January 11, 2017, 06:09:41 AM by fragmare »

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #69 on: January 11, 2017, 07:31:52 AM »

Oh I see.  Well, then you're going to get crackle no matter what, since the waveform mismatch basically likely creates a small saw wave wherever/whenever it occurs.  I can't help but wonder, though, with some math and careful planning (or just plain trial and error), if if one had the exact frequency the first waveform was being played if you could diddle around with where DC offset=0 points were placed within the 32byte waveform to sort of "dodge" or avoid the crackle... essentially, wrap the waveform left/right within the 32byte grid until you find a "sweet spot" where there is no crackle.  assuming there is at least one occurence of DC offset=0 somewhere within each of the waveforms you're trying to match up.

Or are you saying that even if the two waveforms happen to meet cleanly at DC=0, there will still be crackle?


 Yeah, you get get better precision in calculating where the pointer will be, but introduce stuff like vibrato into the mix or pitch slides, and it's pretty much a no. When it's a yes, though, it'll be a race condition with all sorts of "jitter". So it won't be exact. And from my experience, even off by one sample can make the sample sound 'dirty' or clicky. That doesn't mean you can't use it, and it doesn't mean ALL waveform phase sounds bad. It just depends on the shape and the frequency of the channel. Square waves tend to be completely immune to the clicking. Low frequency stuff also tends to be immune to it (I was able to get voice like sounds from morphing 32byte samples in real time without clicking; I got a link to it somewhere.. I posted it later).

 All this didn't stop Bloody Wolf from doing waveform phasing (updating) for it's trumpet sounds. Bloody Wolf already has a gritty sound, so the clicky artifact isn't really noticeable.

 There other ways to do waveform shaping (hard sync on the PCE! I've done it!) and using timer or H-int to do different waveform shaping (Casio synth style - aka non linear pointer through the waveform). Here's a chart showing waveform morphing without updating the channel's waveform memory..


 Plus. There's also this on PCE: http://www.pcedev.net/audio/chord_scale.wav


Ryphecha also figured out how to walk a channel waveform pointer from 0, without turning the channel on or re-writing the waveform to the channel with an offset other than 0. Nice for syncing two or more channels from the start, with an offset parameter ( 0 to 31).
« Last Edit: January 11, 2017, 07:34:51 AM by Bonknuts »

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #70 on: January 11, 2017, 10:11:58 PM »

Oh I see.  Well, then you're going to get crackle no matter what, since the waveform mismatch basically likely creates a small saw wave wherever/whenever it occurs.  I can't help but wonder, though, with some math and careful planning (or just plain trial and error), if if one had the exact frequency the first waveform was being played if you could diddle around with where DC offset=0 points were placed within the 32byte waveform to sort of "dodge" or avoid the crackle... essentially, wrap the waveform left/right within the 32byte grid until you find a "sweet spot" where there is no crackle.  assuming there is at least one occurence of DC offset=0 somewhere within each of the waveforms you're trying to match up.

Or are you saying that even if the two waveforms happen to meet cleanly at DC=0, there will still be crackle?

 Yeah, you get get better precision in calculating where the pointer will be, but introduce stuff like vibrato into the mix or pitch slides, and it's pretty much a no. When it's a yes, though, it'll be a race condition with all sorts of "jitter". So it won't be exact. And from my experience, even off by one sample can make the sample sound 'dirty' or clicky. That doesn't mean you can't use it, and it doesn't mean ALL waveform phase sounds bad. It just depends on the shape and the frequency of the channel. Square waves tend to be completely immune to the clicking. Low frequency stuff also tends to be immune to it (I was able to get voice like sounds from morphing 32byte samples in real time without clicking; I got a link to it somewhere.. I posted it later).

Yea!  you get what i'm saying.  It sounds like something the chiptuner could tinker around with and avoid if implemented properly in Deflemask.  If I'm understanding it correctly, it's a condition that happens roughly the same spot +/- a tick or two, right?  It would depend on the waveform shape, but like I was saying before, if that's the case then a chiptuner could strategically draw the waveforms so that there are a couple DC=0 sample spots placed in each waveform and then wrap one or the other waveform left/right until the clicking either goes away or is lessened.  I mean, you've got a 1/32 chance of hitting a sweet spot, so you're bound to find it with enough patience... a better chance if the waveform has multiple DC=0 spots, particularly in a row.  As it stands now, in Deflemask, if you want to wrap the waveform you pretty much have to redraw the whole thing... which is impractical.  But if something like that implemented in Deflemask, I bet you'd start seeing chiptuners using wave phasing and simply trial-and-error'ing their way around the popping/clicking.  It would be a simple addition to Deflemask too.  A couple of arrow buttons in the waveform editor.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #71 on: January 21, 2017, 04:21:30 PM »
I did some more playing around with waveforms this week, as I massaged a C64 8580 SID filter sweep recording into 5 bits/32 samples per wave.

So, the program, with ASM files in case anybody can suggest changes to the code:
http://chrismcovell.com/data/TIN_SndTest.zip



And so I took some oscilloscope traces on my CoreGrafx of the "old" way of waveform writing compared to the "new" suggested one.  Well, they both exhibit popping on the audio line, with the "new way" better at some frequencies, and sometimes worse.  But look:

"new" <--------------------------------------------------------------------------> "old"



That "flatlining" you see in the new style of writing -- that I thought was the TIN effect, but isn't because the old style uses TIN too -- looks to me like a race condition with the waveform read hardware, because it happens intermittently, but often enough to be unwanted.

I also recorded from the SuperGrafx:
"new" <--------------------------------------------------------------------------> "old"


And the SGX again (both below are "NEW" writes) showing that sometimes the waveform changes instantly, sometimes there's the flatline.


So, can anyone suggest changes to the new writing style to eliminate flatlining, popping, etc.?  For now, the old way still sounds a tad better.  Oh, be sure to test out the ROM on old PCE hardware too.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #72 on: January 26, 2017, 04:52:13 AM »
I did some more playing around with waveforms this week, as I massaged a C64 8580 SID filter sweep recording into 5 bits/32 samples per wave.
...
So, can anyone suggest changes to the new writing style to eliminate flatlining, popping, etc.?  For now, the old way still sounds a tad better.  Oh, be sure to test out the ROM on old PCE hardware too.

Wow, thanks for doing those, they're amazing!  :D

I wish that I could come up with some good theory about how to get around that intermittant flatlining, but I really can't.

It seems like some deep hardware-related issue that's far outside my realm.

The only thing that I can even think of would be to try resetting waveform index again after switching back to the correct frequency.

lda #$df
ldx #$9f
sta $0804
stx $0804

But I'm sure that you already tried that.

For the moment, I guess that I'll just have to keep on using the "old" method.

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #73 on: January 26, 2017, 06:05:47 AM »


Man, this one looks perfect.  Or as clean a transition as you could ask for.  If only there were a way to get that consistently...

fragmare

  • Hero Member
  • *****
  • Posts: 676
Re: Question: Wave-phasing on the PC engine, how feasible is that?
« Reply #74 on: February 11, 2017, 09:55:20 PM »
As of Delek's new prerelease of Deflemask 12.1, wave phasing appears to work!  :)  At least better than it did before!  you still get the default minor HuC6280 pop once in a while, but NOTHING like it was before.

Also (and this is a biggie) the bug where you switch from notes to samples and you're samples are locked at 1 volume is gone!  now i'm free to switch a channel from one to the other at my leisure.   YAY!