RIP to BT Garner of MindRec.com... BT passed away early 2023 from health problems. He was one of the top PCE homebrew developers and founder of the OG Turbo List, then PCECP.com. Condolences to family and friends.
IMG
IMG
Main Menu

Question: Wave-phasing on the PC engine, how feasible is that?

Started by Michirin9801, 12/20/2016, 02:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michirin9801

Quote from: fragmare on 01/09/2017, 10:32 AMHah!  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...

IMG
^Here's what the envelope looks like

https://web.archive.org/web/20190510000057/https://sta.sh/01g5r8e9ukot
"Flame Zapper Kotsujin - Sky is well supplied with"

^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

Quote from: Mednafen on 01/08/2017, 09:29 PMTry 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.


Quote from: TurboXray on 01/08/2017, 11:08 PM
Quote from: ccovell on 01/08/2017, 10:50 PMYeah, 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".


Quote from: ccovell on 01/09/2017, 02:49 AMProblem 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.


Quote from: ccovell on 01/09/2017, 02:49 AMAnyway, unrelated, here is the PCE caught in the act of switching between a rising sawtooth and a falling one getting TIN'ed in:
IMG
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

Quote from: Michirin9801 on 01/09/2017, 11:38 AMHowever 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

Quote from: elmer on 01/09/2017, 01:13 PMNow ... 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

Quote from: Michirin9801 on 01/09/2017, 01:45 PM
Quote from: elmer on 01/09/2017, 01:13 PMNow ... 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

Quote from: elmer on 01/09/2017, 02:20 PMI 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

Quote from: Michirin9801 on 01/09/2017, 03:35 PMUmm, 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?


Quote from: Michirin9801 on 01/09/2017, 03:35 PMwhat 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

Quote from: elmer on 01/09/2017, 04:31 PMErrr ... 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:
IMG
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:
IMG
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...

Quote from: elmer on 01/09/2017, 04:31 PMI'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

Quote from: Michirin9801 on 01/09/2017, 06:07 PMAs 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.


Quote from: elmer on 01/09/2017, 04:31 PMAnd 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)!


QuoteDeflemask 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

Quote from: elmer on 01/09/2017, 07:19 PMExcept ... 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!

elmer

Quote from: Michirin9801 on 01/09/2017, 08:03 PMWait, 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

Michirin9801

Quote from: elmer on 01/09/2017, 08:13 PM
Quote from: Michirin9801 on 01/09/2017, 08:03 PMWait, 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

Quote from: elmer on 01/09/2017, 08:13 PMThe frequencies are (approx) ...

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

elmer

Quote from: ccovell on 01/09/2017, 10:51 PM
Quote from: elmer on 01/09/2017, 08:13 PMThe 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.)

FraGMarE

Quote from: Michirin9801 on 01/09/2017, 11:38 AM
Quote from: fragmare on 01/09/2017, 10:32 AMHah!  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...

IMG
^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

Quote from: elmer on 01/09/2017, 11:12 PM
Quote from: ccovell on 01/09/2017, 10:51 PM
Quote from: elmer on 01/09/2017, 08:13 PMThe frequencies are (approx) ...
[tt]
r7=30  55938 Hz[/tt]
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. :\

Quote from: fragmare on 01/10/2017, 03:46 AMLooking 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.
IMG
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?

elmer

Quote from: ccovell on 01/10/2017, 08:41 AMHmm, 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.


Quote from: fragmare on 01/10/2017, 03:46 AMI 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 Asylum

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. 

This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

FraGMarE

Quote from: elmer on 01/10/2017, 02:13 PM
Quote from: ccovell on 01/10/2017, 08:41 AMHmm, 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.


Quote from: fragmare on 01/10/2017, 03:46 AMI 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?

TurboXray

Quote from: fragmare on 01/11/2017, 11:32 AMOh 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..

pcedev . net/audio/pce/pce_sound_modeling.png

Plus. There's also this on PCE: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).

FraGMarE

Quote from: TurboXray on 01/11/2017, 03:31 PM
Quote from: fragmare on 01/11/2017, 11:32 AMOh 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

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:
https://chrismcovell.com/data/TIN_SndTest.zip

IMG

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:
NewOld
IMG IMG


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:
NewOld
IMG IMG

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

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

Quote from: ccovell on 01/22/2017, 12:21 AMI 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

Quote from: ccovell on 01/22/2017, 12:21 AMIMG
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

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!

Michirin9801

Quote from: fragmare on 02/12/2017, 05:55 AMAs 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!
This new version is pretty good, but you missed the pre-release of version 12.0.0 mate, that one was the best! It used its own custom window for opening instruments and wavetables, you could easily 1-click the wave you wanted and test it on-the-fly without closing the window, and when you found the wave you wanted you could just select it and be done...
Since version 12.0.1 they've changed it to the traditional Windows "Open File" window, and it sucks, you have to select the wave and the instrument you want before you can test it, so every time you want to load a new wave you have to click "Load Wave" then select your wave and click "Open" and THEN test it, and if it isn't the wave you wanted you have to do it again, and again, and again, until you find the wave you want... Yeah I know that I'm supposed to remember what each instrument sounds like based only on their file names, but I'm too lazy for that, and the old window was SO much faster and more convenient! I wish they'd bring it back...

Thankfully I haven't deleted my favourite old version of the tracker, so I can easily make my songs on that version and just open it up on the new version whenever I need to export a .hes file, that said though, with Huzak existing and all it's gonna be kinda pointless to even use Deflemask's .hes export, thus rendering any new version of the tracker that doesn't contain the PC engine CD add-on or the noise mode envelope pointless to me...

FraGMarE

Quote from: Michirin9801 on 02/12/2017, 11:31 AM
Quote from: fragmare on 02/12/2017, 05:55 AMAs 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!
This new version is pretty good, but you missed the pre-release of version 12.0.0 mate, that one was the best! It used its own custom window for opening instruments and wavetables, you could easily 1-click the wave you wanted and test it on-the-fly without closing the window, and when you found the wave you wanted you could just select it and be done...
Since version 12.0.1 they've changed it to the traditional Windows "Open File" window, and it sucks, you have to select the wave and the instrument you want before you can test it, so every time you want to load a new wave you have to click "Load Wave" then select your wave and click "Open" and THEN test it, and if it isn't the wave you wanted you have to do it again, and again, and again, until you find the wave you want... Yeah I know that I'm supposed to remember what each instrument sounds like based only on their file names, but I'm too lazy for that, and the old window was SO much faster and more convenient! I wish they'd bring it back...

Thankfully I haven't deleted my favourite old version of the tracker, so I can easily make my songs on that version and just open it up on the new version whenever I need to export a .hes file, that said though, with Huzak existing and all it's gonna be kinda pointless to even use Deflemask's .hes export, thus rendering any new version of the tracker that doesn't contain the PC engine CD add-on or the noise mode envelope pointless to me...
Damn!  Why did Delek remove that "preview" feature?  It's super useful previewing the instruments.

You know what I think would be greatly useful?  The ability to give waveforms little nicknames within the wavetable dialogue, so you can better remember what each waveform is for.  That definitely occurred to me before.  Also, the ability to copy/paste waveforms and the ability to "bump" the waveform left/right so that wraps.  Or flip the waveform on the X/Y axis.  That stuff would be useful.  The way I work, anyway, it would be.

And, yes, Elmer's driver is definitely coming along quite nicely.  It'll be a godsend for game-optimized music/sounds.  And I think you came along to this forum at just the right time to be the guinea pig for new versions haha  :P

Michirin9801

Quote from: fragmare on 02/12/2017, 04:03 PMYou know what I think would be greatly useful?  The ability to give waveforms little nicknames within the wavetable dialogue, so you can better remember what each waveform is for.  That definitely occurred to me before.  Also, the ability to copy/paste waveforms and the ability to "bump" the waveform left/right so that wraps.  Or flip the waveform on the X/Y axis.  That stuff would be useful.  The way I work, anyway, it would be.
Those ideas are bloody genius!
Granted, the idea to copy and paste waves is something that popped up in the suggestions thread in the Deflemask forum a couple of times, heck Famitracker has that feature for the N-163 and the Disk System, you'd think it would be a no-brainer to add to deflemask but NOPE! It's not there...
The others, while not exactly necessary, would REALLY come in handy!

FraGMarE

I guess in response to the topic now, since the new Deflemask release, is that wave phasing on the PCE is about THIS possible.  :)

First loop is Genesis using three channels.  Second loop is PCE using ONE channel.It's still a bit dirty sounding because i'm still working on volume enveloping the pattern loop for it, and the lower underlying note is starting to get lost because i need to create a couple more waveforms for the thing, BUT...

This is recreating THREE of the Genesis PCM channels on ONE single PCE channel by changing waveforms on-the-fly and frequently.

I think with some more work, I could probably make it nearly 1:1 to the Genesis three channel version.  I don't really notice a lot of crackling or popping when played in Mednafen, either, which is nice.  :)

Michirin9801


esteban

IMGIMG IMG  |  IMG  |  IMG IMG

spenoza

I don't think Mednafen is going to pop the way real hardware will.

FraGMarE

Quote from: guest on 02/17/2017, 07:51 PMI don't think Mednafen is going to pop the way real hardware will.
Not any more than Bloody Wolf, or any of the other games that use wave phasing.  They sound alright to me.  I can live with the default popping of the HuC6280.  It's not that serious.  The previous version of Deflemask was the main issue here.

BTW, take 2 on the wave phasing.  added a few more waveforms and got the low note to come through a bit more.  a couple of the high notes are twangy sounding, and i'm sure this could be remedied with more waveforms and/or finer control (i'm just switching waves every row in Deflemask).  I could cram the entire pattern block into one HUGE instrument, where each note of the block is an arpeggio change within the instrument, and get waveform switching every 1/60th, but that would be a massive PITA.  Not that doing it this way wasn't, I'm just not about to start the whole tune over with 1/1 timing.  Just these two loops were many hours of work... and it's about as good as i can do by-hand.

Anyway, here it is: 
soundcloud .com/user-716572978/wave-phase-demo02

I think what's needed for this, or at least high quality phasing, is an app that will take a WAV file and resample it to 1860 or 1920Hz or whatever, and spit out each 32-sample chunk as a line of decimal values from 0-31 in a text file.  Or better yet, spit out sequentially named DMW files!  :)

Michirin9801

Quote from: fragmare on 02/18/2017, 07:18 AMAnyway, here it is: 
soundcloud .com/user-716572978/wave-phase-demo02
It's better, but I think the end of the loops sound a little weird...

Quote from: fragmare on 02/18/2017, 07:18 AMI think what's needed for this, or at least high quality phasing, is an app that will take a WAV file and resample it to 1860 or 1920Hz or whatever, and spit out each 32-sample chunk as a line of decimal values from 0-31 in a text file.  Or better yet, spit out sequentially named DMW files!  :)
Something similar does exist, but it's not for the PC engine, but for Famitracker's expansion chips which support wavetables, there's both an Audacity Nyquist plugin that will take whatever piece of audio you select and spit out either a 4 bit wavetable for the N163 chip, or a 6 bit wavetable for the Disk System, you can find it here: http://famitracker.com/forum/posts.php?id=4270

But then there's an even better solution, that's a Lua-based WAV loop sampler for the N163 chip for Famitracker by HertzDevil, it will literally take a sample and convert it into sequential wavetables, but here's the catch, you gotta know how to run Lua scripts, and I don't...
Either way, here's the link: http://forums.famitracker.com/viewtopic.php?t=1147

I know these aren't for Deflemask, but they can be pretty useful, I've got a load of wave-phased "samples" that I got just by copying the wavetables directly from Famitracker songs that used wave-phasing on the N163, right into Deflemask!

FraGMarE

Quote from: Michirin9801 on 02/18/2017, 11:36 AM
Quote from: fragmare on 02/18/2017, 07:18 AMAnyway, here it is: 
soundcloud .com/user-716572978/wave-phase-demo02
It's better, but I think the end of the loops sound a little weird...

Quote from: fragmare on 02/18/2017, 07:18 AMI think what's needed for this, or at least high quality phasing, is an app that will take a WAV file and resample it to 1860 or 1920Hz or whatever, and spit out each 32-sample chunk as a line of decimal values from 0-31 in a text file.  Or better yet, spit out sequentially named DMW files!  :)
Something similar does exist, but it's not for the PC engine, but for Famitracker's expansion chips which support wavetables, there's both an Audacity Nyquist plugin that will take whatever piece of audio you select and spit out either a 4 bit wavetable for the N163 chip, or a 6 bit wavetable for the Disk System, you can find it here: http://famitracker.com/forum/posts.php?id=4270

But then there's an even better solution, that's a Lua-based WAV loop sampler for the N163 chip for Famitracker by HertzDevil, it will literally take a sample and convert it into sequential wavetables, but here's the catch, you gotta know how to run Lua scripts, and I don't...
Either way, here's the link: http://forums.famitracker.com/viewtopic.php?t=1147

I know these aren't for Deflemask, but they can be pretty useful, I've got a load of wave-phased "samples" that I got just by copying the wavetables directly from Famitracker songs that used wave-phasing on the N163, right into Deflemask!
Yea, it's that damn twangy-ness making it sound weird.  It really needs another waveform or two, but damn... my patience only goes so far.  Doing each waveform by hand is REALLY time consuming.  Not only that, but often times if you change the waveform, you'll need to go back and change the note for that line too.  It's hours and hours of work and verifying just for two pattern blocks... i thought to myself, "there HAS to be a better way".

Those apps sound PERFECT... if only they did 5-bit.  An app like that actually sounds pretty easy to make and sure someone will crank one out if people keep producing PCE chiptunes.  :)  I could probably take the one that spits out 6-bit samples and go in and manually crunch em down to fit.  I'm sure an app like that would output a LOT of redundant or nearly-the-same wavetables that could (and probably should) omit, keeping only the wavetables you need to get the sound you want.  But it would DEFINITELY make wave phasing a LOT easier and more efficient.

Whatever I do, I'm definitely going to fix the first and third note... the twang makes it sound like when one of those huge Cicada bugs starts to make noise.  And anybody who lives in the midwest will tell you that's not a pleasant sound.  At least not musically haha

Michirin9801

Quote from: fragmare on 02/18/2017, 05:46 PMThose apps sound PERFECT... if only they did 5-bit.  An app like that actually sounds pretty easy to make and sure someone will crank one out if people keep producing PCE chiptunes.  :)  I could probably take the one that spits out 6-bit samples and go in and manually crunch em down to fit.  I'm sure an app like that would output a LOT of redundant or nearly-the-same wavetables that could (and probably should) omit, keeping only the wavetables you need to get the sound you want.  But it would DEFINITELY make wave phasing a LOT easier and more efficient.
The first app has a PCE option, but it's locked for some reason... Maybe someone who knows how to make/edit Nyquist plugins for Audacity can re-activate the PCE option, but as it stands, I'd recommend you to use the 4 bit variation instead, it's gonna be a lot easier and there's gonna be a lot less guessing, the sound might even come off as more accurate, also I believe the Disk System uses a string of 64 6 bit values, but I could be wrong...

FraGMarE

Screw all that, I just had a buddy code-up a small stand-alone app a few minutes ago that works using SoX (cmd based freeware).  Testing now.  Results seem promising so far.  Will bundle and distribute soon.  ;)

Michirin9801

Quote from: fragmare on 02/18/2017, 09:16 PMScrew all that, I just had a buddy code-up a small stand-alone app a few minutes ago that works using SoX (cmd based freeware).  Testing now.  Results seem promising so far.  Will bundle and distribute soon.  ;)
Oh that's even better! Looking forward to that ^^
(Hopefully there's a drag 'n drop variant)

FraGMarE

Yea, here we go.  PSG voice sample being playing on channel 1...

PSG Sample HES File

PSG Sample DMF File

And here is the app I used to dump all waveforms.

PCE Chipify app by Zeromus

Fair warning, it's 1860hz, so it's going to be a little rough sounding... it's supposed to be a guy saying, "Goddamnit!"

Anyway, if it's good enough to create shitty sounding samples, that means it's good enough to create waveforms to decently replicate complex 2 or 3 part modulated or corrupted notes and such too.

Sadly, Deflemask is still limited to 32 waveforms, so 0.567 seconds of audio is the most you're going to get  :/

P.S., if you're running this on the older revision HuC6280, you WILL notice an audible buzz accompanying the sample from the waveform-switch pop happening every 1/60th.  The HuC6280a has no buzz.

Michirin9801

It sounds like s***, but I can see this thing being pretty useful if used correctly!
Welp, gonna try some trumpet sounds sooner or later, we'll see how it sounds...

NightWolve

Quote from: Michirin9801 on 01/06/2017, 09:31 PMshape___artillery_wip_mednafen_by_michirin9801-dauhpi7.mp3 ^As you can hear in this WIP, not really... It's good for the higher-pitched notes, but if you put it in the lower pitches it sounds kinda crappy, the popping is very noticeable...
I applied some WayBack magic to Michirin9801's intro thread here, it recovered her MP3 chiptune recordings and some images (I returned to further embed everyone's images). That and I kinda like this MP3 I quoted while listening to it a second ago after the WayBack recovery, hence worthy of a bump I thought.

IMG EDIT: We have a pretty significant harassment problem in PC Engine fandom which needs to be tackled one way or another, I recently learned michirin9801 was targeted by multiple [banned] turbo trolls here/elsewhere and I suspect she deactivated her DeviantArt profile as a consequence (which hosts these MP3s)... I invited her back without knowing about it, but now I understand her polite reply better...