PCEngine-FX.com

PCE-FX Homebrew Development => Localizations, Games, Apps, Docs => Topic started by: Michirin9801 on 12/20/2016, 02:36 PM

Title: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 02:36 PM
Hello everyone, I'm new here...

First and foremost I want to get this out of the way: I'm not a collector, I'm not looking for shelf-candy, I'm just an artist who discovered the TurboGrafx 16 through the Wii's Virtual Console a few years ago and have since fallen in love with it! It has become one of my favourite game systems and it has my favourite soundchip to make music for (But not the favourite soundchip in general, that would be the SPC-700), it's so easy to use and make awesome music with it, and it sounds so GOOD!

So a friend of mine who's an active Famitracker user has shown me some of the tricks that people like to do with the NES expansion chips, most notably the Namco N-136, which does up to 8 channels of 4 bit wavetables, (but the more channels you use the worse it sounds) which is pretty similar to the PC engine (only the PCE does 5 bit waves of course), and the trick that really stuck with me was Wave-Phasing, basically you change the wavetable a whole lot of times really fast in order to make instruments that sound just like Samples!
Yeah I know, the PCE can already play samples natively, but the advantage of doing that is that you can freely pitch up and down your instruments, yeah it doesn't sound quite as good as a proper sample, but it's really impressive none-the-less!

So I've downloaded some Famitracker modules that use the trick and copied the wavetables over to Deflemask in order to try and reproduce the effect, and here's a couple of songs I've made that use the effect: http://youtu.be/Y-kiCZPwvLE
http://youtu.be/dnm-0vCgAoA And here's another one that's still unfinished (and I'm probably never gonna finish it):
http://web.archive.org/web/20190509211855id_/http://orig14.deviantart.net/1cf0/f/2016/257/1/c/puyo_pop_title_screen_by_michiharuruko-daholcf.mp3 Now hear me out: I know Deflemask isn't the best method of making PC engine music, I know its .hes exports are crap, you don't have to tell me that, but I can tell you that it's definitely the easiest way of making PCE music, especially for someone like me who only has experience making music on trackers, I can't use piano-roll programs, nor do I know MML, but I do plan on learning MML eventually so there's that...

The point of this post, and I'm sorry for taking so long to get to the point, is that I want to know how feasible is this trick in real hardware? Could you make a song using this trick in more than one channel and still be able to do regular samples for drums and split the BG layer for parallax scrolling? How complex of a game could you potentially make using this trick, if you could at all?

I'd love it if some kind-hearted and experienced developer gave me at least a rough idea on how well the system could handle this stuff... Thanks in advance!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Gredler on 12/20/2016, 02:57 PM
Welcome to the boards! Another musician has been revealed! Hooray!

Can't wait to hear the responses to your query, good luck finding the answers you're seeking!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 12/20/2016, 03:39 PM
What time ("clock") setting are you using on deflemask? 60hz NTSC or something custom?

 Each channel waveform buffer is 32bytes. If you did a slow update ( no Txx block transfer), that's ~14cycles a byte in an unrolled loop for transfer. Assuming you changed the waveform on every 'tick' (1\60th), it's 448cycles per channel per frame. 448/119210 = 0.38% cpu resource per frame @ one channel. Not even a full 1% of cpu resource. I mean, just the act of updating it. Fast update is 207cycles for 32bytes or 0.18% cpu resource. Just multiply that percentage by the number of channels doing it. 4 channels? 1.5% cpu slow version or 0.72% for fast version.

 In other words, it's almost non existent when it comes to cpu resource. And why Deflemask puts a storage limit of 32, is beyond me. You can do other fun stuff with updating waveforms; adding two different waveforms together and divide by two; create your own 'filtering' or whatever effects directly onto the sample as a realtime process.

 The downside of waveform updating on PCE, is obviously you can't match pointer playback position from one set of 32byte sample to another set, for a seamless transition. It makes the phasing a little bit dirty sounding. But you probably already know that.

 If you do this on the PCE, Duo, and most models - you'll also get pop'ing/clicking on the DAC output everytime you turn off/on the channel to update the waveform. It'll sound like the small miss-phase issue mentioned above, but a bit louder because it happens around the same time. SGX doesn't have this issue, and some PCE Core Grafx I models don't as well. You can either live with it, or use two sound channels on the PCE for this phase trick; one channel is always on, one channel is always off - turning on one at the same time of turning off the other, cancels out the pop on the DAC. Deflemask doesn't emulate this pop on the DAC. And I have no idea of deflemask is updating the 32byte waveform in sync with the playback pointer, to make it sound smoother as well.

 Do you have a real system you can try out the HES exports on?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 12/20/2016, 04:02 PM
I'm kinda surprised Deflemask doesn't support this: http://youtu.be/V845pHyaePk Instead of replacing the whole waveform, you have a single waveform (of any length), where you write one byte per 1/60th timing or less to one specific channel - all without turning off the channel.

Basically, the PCE soundchip is always in DDA mode. When you write to DDA port (also the waveform channel port), regardless if the channel is in DDA mode or waveform mode - the sample will be output to that channel's DAC. But something interesting happens; where ever that playback pointer is of the channel's waveform, the byte in the waveform memory will be replaced with the byte written to DDA port. So you can corrupt or change the waveform over time, in very specific ways, to create timbre type effects. Typically it's used for going to a low static sound to a thin steal-y time timbre. But no one has really explored the idea to see where it can actually go. But the above video shows what this particular PCE game is doing with it.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 12/20/2016, 04:11 PM
Quote from: Michirin9801 on 12/20/2016, 02:36 PMHello everyone, I'm new here...
Welcome! I hope that we can persuade you to stay and hang around here.  :D


QuoteSo a friend of mine who's an active Famitracker user has shown me some of the tricks that people like to do with the NES expansion chips, most notably the Namco N-136, which does up to 8 channels of 4 bit wavetables, (but the more channels you use the worse it sounds) which is pretty similar to the PC engine (only the PCE does 5 bit waves of course), and the trick that really stuck with me was Wave-Phasing, basically you change the wavetable a whole lot of times really fast in order to make instruments that sound just like Samples!
Yeah I know, the PCE can already play samples natively, but the advantage of doing that is that you can freely pitch up and down your instruments, yeah it doesn't sound quite as good as a proper sample, but it's really impressive none-the-less!
bonknuts and ccovell are our hardware experts, and I'm sure that they'll chime in later on, but in the meantime ...

<edit>

OK, so bonknuts beat me to posting!  :lol:


You can change the waveform any time that you like, and it wouldn't be much of a cost to change it during an hsync interrupt a few times during a 1/60s frame if that made things sound better.

As bonknuts said ... there's both the issue of the "click", and the playback-position to consider from the technical point-of-view.

From my "practical" POV, there's just the question of how you'd let the sound-driver know that it's supposed to enable the effect.

Nothing that can't be dealt-with, though.  :wink:
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 04:21 PM
Quote from: TurboXray on 12/20/2016, 03:39 PMWhat time ("clock") setting are you using on deflemask? 60hz NTSC or something custom?

 Each channel waveform buffer is 32bytes. If you did a slow update ( no Txx block transfer), that's ~14cycles a byte in an unrolled loop for transfer. Assuming you changed the waveform on every 'tick' (1\60th), it's 448cycles per channel per frame. 448/119210 = 0.38% cpu resource per frame @ one channel. Not even a full 1% of cpu resource. I mean, just the act of updating it. Fast update is 207cycles for 32bytes or 0.18% cpu resource. Just multiply that percentage by the number of channels doing it. 4 channels? 1.5% cpu slow version or 0.72% for fast version.

 In other words, it's almost non existent when it comes to cpu resource. And why Deflemask puts a storage limit of 32, is beyond me. You can do other fun stuff with updating waveforms; adding two different waveforms together and divide by two; create your own 'filtering' or whatever effects directly onto the sample as a realtime process.

 The downside of waveform updating on PCE, is obviously you can't match pointer playback position from one set of 32byte sample to another set, for a seamless transition. It makes the phasing a little bit dirty sounding. But you probably already know that.

 If you do this on the PCE, Duo, and most models - you'll also get pop'ing/clicking on the DAC output everytime you turn off/on the channel to update the waveform. It'll sound like the small miss-phase issue mentioned above, but a bit louder because it happens around the same time. SGX doesn't have this issue, and some PCE Core Grafx I models don't as well. You can either live with it, or use two sound channels on the PCE for this phase trick; one channel is always on, one channel is always off - turning on one at the same time of turning off the other, cancels out the pop on the DAC. Deflemask doesn't emulate this pop on the DAC. And I have no idea of deflemask is updating the 32byte waveform in sync with the playback pointer, to make it sound smoother as well.

 Do you have a real system you can try out the HES exports on?
I use different clocks depending on the song, I usually do custom so that I can have more control over the tempo of the song, but I don't know if I should be using custom clock speeds or not, if not then I can do the block transfer thing to get a tempo relatively close to what I want (9xx for even lines and Fxx for odd lines in Deflemask)

Here's an example of an instrument: I have this wave-phased steel drum instrument, it only uses 4 wavetables, so what I do is update the wavetable on every tick on a single channel 4 times every time I play it and then hold on the last wavetable (I do it on every 2 ticks for the lower pitches), So from what you say, I could do this on 2 channels and not have to worry about CPU time right?

Yeah you're right that it sounds 'dirty', but you know what? I'm kinda fond of that dirty sound, I find it to be kinda charming~
What worries me though is this popping you've mentioned, I had no idea it happened, is it loud? I don't have a real PCE to test it on, only emulators... (I do plan on getting one when I can afford it though, and an everdrive to go with it, but I'm a broke college student with no 'real' job so that's gonna take a while)
And well, I think using 2 channels for a single wave-phased instrument is a bit of a waste, if I were to use 2 channels for a single instrument the 2nd channel would most likely be a delay/reverb effect...

Also, I've asked why they had limited the amount of waves in Deflemask to only 32, and basically there's no good reason... In fact, they actively don't want people to push the limits of the system, which is pretty stupid if you ask me, their reasoning is that they want people to compose music that sounds 'genuine', but here's the thing, people aren't gonna stop composing songs that don't show off the hardware just because you allow them to have more than a hundred waves... Oh well, I can live with only 32...

Another cool thing you can do with wave-phasing is change the pulse length on the fly, kinda like the C64 does, and by doing that you can pretty much do SID-like music except with proper chords instead of arpeggios! Unfortunately I don't have anything presentable doing that but I'll eventually do something like that...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 12/20/2016, 04:27 PM
Quote from: TurboXray on 12/20/2016, 04:02 PMBut something interesting happens; where ever that playback pointer is of the channel's waveform, the byte in the waveform memory will be replaced with the byte written to DDA port. So you can corrupt or change the waveform over time, in very specific ways, to create timbre type effects.
I forgot to ask you about this when you mentioned this a week ago ...

But, if you're just writing to wherever-in-waveform-ram the pointer is at the time that you do the write, then how can say that it's a "very specific" change?

Wost-case would be that you'd always be writing to exactly-the-same location in waveform ram.

Is there some reasonably efficient way that you know of to predict where the waveform pointer is at some specific time?  :-k

<edit>

OK, I guess that you could switch to DDA mode and then back to normal mode and that would reset the waveform pointer, and you could time it from there ... but ... that sounds like a lot of effort!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 04:31 PM
Quote from: TurboXray on 12/20/2016, 04:02 PMI'm kinda surprised Deflemask doesn't support this:
http://youtu.be/V845pHyaePk
Instead of replacing the whole waveform, you have a single waveform (of any length), where you write one byte per 1/60th timing or less to one specific channel - all without turning off the channel. Basically, the PCE soundchip is always in DDA mode. When you write to DDA port (also the waveform channel port), regardless if the channel is in DDA mode or waveform mode - the sample will be output to that channel's DAC. But something interesting happens; where ever that playback pointer is of the channel's waveform, the byte in the waveform memory will be replaced with the byte written to DDA port. So you can corrupt or change the waveform over time, in very specific ways, to create timbre type effects. Typically it's used for going to a low static sound to a thin steal-y time timbre. But no one has really explored the idea to see where it can actually go. But the above video shows what this particular PCE game is doing with it.
Oh wow, I never knew that! So could you potentially use that trick to change a tinny sawtooth over time to an almost sine-wave like sound?
Something kinda like this:
http://web.archive.org/web/20190509211857id_/http://orig00.deviantart.net/1559/f/2016/355/5/0/wave_phasing_test_by_michirin9801-dase02j.mp3 Also, it's very nice to hear an example of a game actually doing it and changing the wavetable on-the-fly!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 12/20/2016, 05:13 PM
Quote from: Michirin9801 on 12/20/2016, 02:36 PMNow hear me out: I know Deflemask isn't the best method of making PC engine music, I know its .hes exports are crap, you don't have to tell me that, but I can tell you that it's definitely the easiest way of making PCE music, especially for someone like me who only has experience making music on trackers, I can't use piano-roll programs, nor do I know MML, but I do plan on learning MML eventually so there's that...
It doesn't really matter that much what you choose to use to compose music, as long as you actually find it usable.  :)

At this time, the development community here only really has access to the music/driver that's built into the PC Engine's System Card ... and that's an MML-variant.

Aetherbutt's "Squirrel" is the toolchain that you can use to compose music for that driver.

So you can't "yet" compose in deflemask and produce something that's usable in a game, but it may be possible in the future.  [-o<


Quote from: Michirin9801 on 12/20/2016, 04:21 PMI use different clocks depending on the song, I usually do custom so that I can have more control over the tempo of the song, but I don't know if I should be using custom clock speeds or not, if not then I can do the block transfer thing to get a tempo relatively close to what I want (9xx for even lines and Fxx for odd lines in Deflemask)
Hmmm ... I'll have to look at the Deflemask documentation again, but FYI, custom timings were not how console music was created back-in-the-day.

Here's a typical old-skool table of timings-vs-tempo ...

NTSC

Base Tempo = 5/60s per 1/16th  = 20/60s per 1/4 note  = 180.0 bpm  (60 * 60/20)
Base Tempo = 6/60s per 1/16th  = 24/60s per 1/4 note  = 150.0 bpm  (60 * 60/24)
Base Tempo = 7/60s per 1/16th  = 28/60s per 1/4 note  = 128.6 bpm  (60 * 60/28)
Base Tempo = 8/60s per 1/16th  = 32/60s per 1/4 note  = 112.5 bpm  (60 * 60/32)
Base Tempo = 9/60s per 1/16th  = 36/60s per 1/4 note  = 100.0 bpm  (60 * 60/36)

PAL50

Base Tempo = 4/50s per 1/16th  = 16/50s per 1/4 note  = 187.5 bpm  (60 * 50/16)
Base Tempo = 5/50s per 1/16th  = 20/50s per 1/4 note  = 150.0 bpm  (60 * 50/20)
Base Tempo = 6/50s per 1/16th  = 24/50s per 1/4 note  = 125.0 bpm  (60 * 50/24)
Base Tempo = 7/50s per 1/16th  = 28/50s per 1/4 note  = 107.1 bpm  (60 * 50/28)
Base Tempo = 8/50s per 1/16th  = 32/50s per 1/4 note  =  93.8 bpm  (60 * 50/32)


It is possible to do timings differently than that, but doing so comes with a bunch of costs that game developers back then usually didn't see the need to incur.


QuoteHere's an example of an instrument: I have this wave-phased steel drum instrument, it only uses 4 wavetables, so what I do is update the wavetable on every tick on a single channel 4 times every time I play it and then hold on the last wavetable (I do it on every 2 ticks for the lower pitches), So from what you say, I could do this on 2 channels and not have to worry about CPU time right?
Changing the wavetables on every channel every 1/60s is a tiny cost.

Far, far less than a single sample-channel (they're expensive).


QuoteAlso, I've asked why they had limited the amount of waves in Deflemask to only 32, and basically there's no good reason... In fact, they actively don't want people to push the limits of the system, which is pretty stupid if you ask me, their reasoning is that they want people to compose music that sounds 'genuine', but here's the thing, people aren't gonna stop composing songs that don't show off the hardware just because you allow them to have more than a hundred waves... Oh well, I can live with only 32...
Hahaha ... that's such totally bogus reasoning from the community!!!  :lol:

256 32-byte waveforms only take up 8KB, which is a minimal cost.

Yet for some reason, they're allowing people to add hundreds of KB of sample data into songs at playback rates that would never have been used back-in-the-day.

The PCE is *practically* limited to 7KHz samples, with 8KHz and 16KHz possible, but unlikely to be worth the higher CPU costs, except in specific uses (from my game developer perspective).

On the PCE CD, you do also have the ADPCM chip, which makes higher-rate samples more usable, but you've got limited sample memory.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 12/20/2016, 05:46 PM
Quote from: elmer on 12/20/2016, 04:27 PM
Quote from: TurboXray on 12/20/2016, 04:02 PMBut something interesting happens; where ever that playback pointer is of the channel's waveform, the byte in the waveform memory will be replaced with the byte written to DDA port. So you can corrupt or change the waveform over time, in very specific ways, to create timbre type effects.
I forgot to ask you about this when you mentioned this a week ago ...

But, if you're just writing to wherever-in-waveform-ram the pointer is at the time that you do the write, then how can say that it's a "very specific" change?

Wost-case would be that you'd always be writing to exactly-the-same location in waveform ram.

Is there some reasonably efficient way that you know of to predict where the waveform pointer is at some specific time?  :-k
Well, that's why I tend to call it waveform corruption. Because it's not exact. You'd have more control if you could do this with the TIMER than 60hz. But either way, you'd need a fixed point counter - and as you've already guess - it's rather course (at least at 60hz). You'd need to know the note and octave the channel, and then you would know what fixed point counter to use with it - or however you want to sync the corruption part, that way the timbre effect scales with the notes. But the idea would be a rate of corruption relative to the frequency of the channel - that way you can get replicate-able results - even if they vary somewhat.

QuoteOK, I guess that you could switch to DDA mode and then back to normal mode and that would reset the waveform pointer, and you could time it from there ... but ... that sounds like a lot of effort!
No. But... mednafen author (I always call her that on these forums, because I don't know if she likes her real name used here), discovered a way to 'walk' the waveform pointer. The channel has to be off to do it, but you can reset the waveform pointer and then "walk it". It had something to do with.. meh - forget the reason behind it. But I had it saved on my blog somewhere. I should probably write it down in my notes folder.

QuoteAlso, I've asked why they had limited the amount of waves in Deflemask to only 32, and basically there's no good reason... In fact, they actively don't want people to push the limits of the system, which is pretty stupid if you ask me, their reasoning is that they want people to compose music that sounds 'genuine', but here's the thing, people aren't gonna stop composing songs that don't show off the hardware just because you allow them to have more than a hundred waves... Oh well, I can live with only 32...
Hah! Considering how deflemask handles long samples for PCE tunes, you'd think they would think otherwise. Let's limit the computer with some artificial limitation because it doesn't fit our point of view - that's a great attitude to have for a tracker, especially for something as simple as expanding on sample memory that's still only a tiny fraction of long wave samples they support.

QuoteSo from what you say, I could do this on 2 channels and not have to worry about CPU time right?
You could do it on all channels and not even sweat it. Let me give you a relative example of cpu resource; if you did this on all six channels - it would still be less CPU resource than play a single long sample on just one channel @ 7kz playback rate. Playing a long sample on a single channel would take up 3-4x the resource as it would to do what you're asking for on all six channels. If someone tells you different, they don't know what they're talking about. I mean, it's not like the PCE sound chip has a slow interface like the YM2612 in the Genesis, where you can't just blast whatever amount a bytes in sequence to it (you have to wait for the delays - read the delay/ready flag). The PCE sound chip has no delays; it's just a simple matter of copying over 32bytes per channel. No sweat for the HuC6280.

QuoteI use different clocks depending on the song, I usually do custom so that I can have more control over the tempo of the song, but I don't know if I should be using custom clock speeds or not, if not then I can do the block transfer thing to get a tempo relatively close to what I want (9xx for even lines and Fxx for odd lines in Deflemask)
From a programming perspective, it's just easier to stick with vsync timing (60hz). Though in my book, multiples of 60hz (using the TIMER to do this) would be an ok trade off; 120hz, 180hz. Something with a fixed interval in the whole frame (which relates to game loop and logic). Anything higher than 60hz requires special interrupts. And anything not multiple of 60hz means the music engine has to drift out of sync with the game logic (not to mean out of sync with playing music; just where that music engine will get called relative to a frame logic layout). It can complicate things. It has its own overhead (cpu resource). It can imposed limitations in strange ways (because of timing). 60hz and 120hz are nicer options to work with. 60hz being optimal (NTSC setting for deflemask).



Michirin9801:
Have you seen this trick before: https://web.archive.org/web/20160304225633id_/http://www.pcedev.net/audio/sub_waveform6.xm

If you load it up in a tracker, check out pattern #2 first (it only has two channels playing). See how the waveforms are setup? The main waveform is a triangle wave and the other is a saw wave (with a delay onset). The triangle samples exist only in the upper band of the amplitude range. The  saw waveform is played on the other channel, and only has samples in the lower band of the amplitude range. Can you guess why? Normally when you play samples, their amplitudes add together. Having them in separate ranges (positive range vs negative range), you get a more pronounced effect as they add together. Channel 4 is the main sound, and channel 2 is used to subtract from the main channel's waveform shape. Volume envelopes are used for emphasis (like controlling the amplitude of a modulator affecting a carrier wave). And the final step is pitch sliding. If you've ever looked at some synths waveform output, it looks like to waveforms going out of phase from one another (besides other stuff happening). So if you look at the channel, there are very precise pitch sliding FX to control how the subtractive channel is in phase with the main channel (instead of letting it endlessly drift). This is difficult to do in a tracker, because the depth if pitch sliding directly depends on the main channels note or frequency - and without macros, it has to be done manually for every note or chord. The lower the note, the bigger the steps need to be in the pitch FX column. Think of it as specialized version of detuning two channels.

 Now check out pattern #1, only two channels are doing this effect but it's distinct enough to be heard in a chord - giving the whole chord a timbre like effect when the other contributing channels have no timbre change at all. I call it subtractive waveform phasing. But I'm sure it has a real name, as someone has probably already thought of the idea.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 06:06 PM
Quote from: elmer on 12/20/2016, 05:13 PMOn the PCE CD, you do also have the ADPCM chip, which makes higher-rate samples more usable, but you've got limited sample memory.
That brings me to another question: I know that some PCE CD games had PSG soundtracks that used all 7 channels, the 6 wavetables and the ADPCM of the CD unit, one example that comes to mind is Dragon Slayer The Legend of Heroes (Feel free to name other examples, I always welcome more PC engine music to listen to ;3)

I also know that some Game Boy games such as Kirby's Dream Land 2, Donkey Kong and Space Invaders take advantage of the Super Nintendo hardware when played on the Super Game Boy, DK adds colourful backgrounds, Kirby uses some SNES sound channels to play sound effects, I also know that some GBC games are playable on both the original Game Boy and on the colour variant, and there are even some GBC games like Shantae (I can't think of any other from the top of my head) that take advantage of the GBA hardware when detected (although I have no idea how exactly)...

I think you can already predict where I'm going with this, but here's the question:
Could a HuCard game in any way shape or form access the CD add-on and make use of the ADPCM channel?
Like for example, imagine that I wanted to make a HuCard game that had one soundtrack that played on regular PC engine units without the CD add-on, but then if a CD was detected you could enable a second soundtrack that's "CD-enhanced"?
Could you have some samples stored on the HuCard and play them back on the ADPCM? That would free up a channel on the regular soundchip where you could maybe make triad instead of a power chord or maybe add a delay-reverb effect in order to make the sound of the game more robust!

Now, I know what you're thinking: "If you wanna take advantage of the CD unit why not just make a CD game then?"
And I totally see where you'd be coming from, but the point is to make a game that could be enjoyed on any PC engine model, but also take advantage of the CD add-on when possible!
Also keep in mind that this situation is 100% hypothetical, at the moment it's all a matter of my own curiosity...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 06:27 PM
Quote from: TurboXray on 12/20/2016, 05:46 PMMichirin9801:
Have you seen this trick before: sub_waveform6.xm (https://web.archive.org/web/20160304225633id_/http://www.pcedev.net/audio/sub_waveform6.xm)
No I hadn't seen that, but I believe Legend of Xanadu 2's soundtrack does these effects a lot, which is why it sounds so ~BEAUTIFUL~
And I recognise these waveforms, they're from Ys IV aren't they? I have them all on Deflemask ;3
Also, the effect in Deflemask to make the instruments on different channels go out of phase like that is E5xx, I've been using it quite a bit recently!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: spenoza on 12/20/2016, 07:18 PM
Related to the CPU popping issue, could you use two channels for sample waveform playback but have them on opposite ticks, one going off as the other goes on, and getting two samples played back while also eliminating the pop?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 12/20/2016, 09:15 PM
Quote from: Michirin9801 on 12/20/2016, 06:06 PMI think you can already predict where I'm going with this, but here's the question:
Could a HuCard game in any way shape or form access the CD add-on and make use of the ADPCM channel?
Like for example, imagine that I wanted to make a HuCard game that had one soundtrack that played on regular PC engine units without the CD add-on, but then if a CD was detected you could enable a second soundtrack that's "CD-enhanced"?
Could you have some samples stored on the HuCard and play them back on the ADPCM? That would free up a channel on the regular soundchip where you could maybe make triad instead of a power chord or maybe add a delay-reverb effect in order to make the sound of the game more robust!
Yes, there's no problem (in theory) in detecting the presence of the CD add-on and then choosing to play a different tune that supports an ADPCM channel.

As you mentioned ... it's no different to how developers made GBC games backwards-compatible with the GB in order to increase the amount of target consumers.

It costs both development time and some cartridge space, but it's not particularly difficult.

But ... and it's a big "but" ... the existing System Card sound driver that we have access to doesn't support it, and neither does Deflemask AFAIK.

So the question becomes ... how do you compose tunes that take advantage of the combination?  :-k

That's been one of the top questions that I've been considering as I port my old Amiga/ST/GameBoy sound driver over to the PCE.

A decent driver isn't *that* complicated to write, it's all really a question of how to enable the musician to actually create all those wonderful tunes that the sound driver can then play back.

And when you've solved that, then it becomes a question of finding a musician that will push and expand the requirements ... to define and then use new capabilities to make the resulting tunes sound even better.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 10:01 PM
Quote from: elmer on 12/20/2016, 09:15 PMSo the question becomes ... how do you compose tunes that take advantage of the combination?  :-k

That's been one of the top questions that I've been considering as I port my old Amiga/ST/GameBoy sound driver over to the PCE.

A decent driver isn't *that* complicated to write, it's all really a question of how to enable the musician to actually create all those wonderful tunes that the sound driver can then play back.

And when you've solved that, then it becomes a question of finding a musician that will push and expand the requirements ... to define and then use new capabilities to make the resulting tunes sound even better.
I have a vague idea on how to do that actually... Instead of composing my music on a single track/file I'd make it in two, one for the HuC6280 and the other for the ADPCM, so one track would have the regular 6 channels and the other just the one ADPCM with some drum samples (btw is the ADPCM capable of re-pitching samples? Just in case I wanna throw in some orch hits or something...)
And then in the hardware itself you make the two tracks play together! Or at least that's how I'd imagine it being done...

I've already done some songs that use 2 trackers or 2 instances of the same tracker, and even if you need MML, I've read in another thread in this forum that there are tools to convert MIDI into MML for the PC engine (I think you guys know which thread I'm talking about) and I can use OpenMPT to export MIDI! So it's all a matter of me remaking some song I've already done in Deflemask onto OpenMPT and then figuring out the rest with the MML tools, so I'd totally volunteer to do that!
Heck I've already started doing a song that way a while ago, I just have to finish it...

Unless of course everything I just said is all a load of bollocks and it doesn't work like that... Please let me know...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 12/20/2016, 11:08 PM
Quote from: Michirin9801 on 12/20/2016, 10:01 PMI have a vague idea on how to do that actually... Instead of composing my music on a single track/file I'd make it in two, one for the HuC6280 and the other for the ADPCM, so one track would have the regular 6 channels and the other just the one ADPCM with some drum samples (btw is the ADPCM capable of re-pitching samples? Just in case I wanna throw in some orch hits or something...)
And then in the hardware itself you make the two tracks play together! Or at least that's how I'd imagine it being done...
It can be done that way, but it doesn't sound like a lot of fun to create a tune that way.

"Yes", you can re-pitch samples ... but not in any musically-meaningful way.

The ADPCM hardware only supports the following playback rates ...

 2000 Hz
 2133 Hz
 2286 Hz
 2462 Hz
 2667 Hz
 2909 Hz
 3200 Hz
 3556 Hz
 4000 Hz
 4571 Hz
 5333 Hz
 6400 Hz
 8000 Hz
10667 HZ
16000 Hz



QuoteI've already done some songs that use 2 trackers or 2 instances of the same tracker, and even if you need MML, I've read in another thread in this forum that there are tools to convert MIDI into MML for the PC engine (I think you guys know which thread I'm talking about) and I can use OpenMPT to export MIDI! So it's all a matter of me remaking some song I've already done in Deflemask onto OpenMPT and then figuring out the rest with the MML tools, so I'd totally volunteer to do that!
Well, if you're willing to put up with the bleeding eyes and anal discomfort that go with MML, then things do get somewhat easier.

The biggest problem with the MIDI-to-MML route, is that you'll lose all of the effect information, and just get stripped back to basic note information.

Then you've got to recreate the effects tables in a text-editor and add the appropriate commands back into the MML in the appropriate places.

It can be done ... and it's how it all used to be done ... but it's not particularly "friendly", and it's a lot more work than most folks want to deal with these days.

If you want to go down the MIDI-to-MML path, then Arkhan and TheOldMan may be able to help out, or have suggestions on how to handle things within the Squirrel toolset and the System Card player.


QuoteUnless of course everything I just said is all a load of bollocks and it doesn't work like that... Please let me know...
Hahaha ... British yourself, or perhaps just British parents?  :wink:

Nope, what you propose is workable within the existing toolchain if Arkhan decides to try to update the system Card player to handle samples, and then maybe add ADPCM, too.

With a different sound driver, 7 channel OpenMPT-to-MIDI-to-3MLE is probably even easier.

It then becomes a question of defining the process needed to create tables (i.e. envelopes) for volume/vibrato/arpeggio/drum and all the other effects.

But ... an alternative idea might be to ask Delek to add a 7-channel variant to Deflemask, heck, that would be nice for the PC-FX too, although IIRC, I think that we've got 2 ADPCM channels on that console, and could use an 8-channel variant (it's got the same Hu6280 sound chip as the PCE).
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/20/2016, 11:51 PM
Quote from: elmer on 12/20/2016, 11:08 PM
Quote from: Michirin9801 on 12/20/2016, 10:01 PMI have a vague idea on how to do that actually... Instead of composing my music on a single track/file I'd make it in two, one for the HuC6280 and the other for the ADPCM, so one track would have the regular 6 channels and the other just the one ADPCM with some drum samples (btw is the ADPCM capable of re-pitching samples? Just in case I wanna throw in some orch hits or something...)
And then in the hardware itself you make the two tracks play together! Or at least that's how I'd imagine it being done...
It can be done that way, but it doesn't sound like a lot of fun to create a tune that way.

"Yes", you can re-pitch samples ... but not in any musically-meaningful way.

The ADPCM hardware only supports the following playback rates ...

 2000 Hz
 2133 Hz
 2286 Hz
 2462 Hz
 2667 Hz
 2909 Hz
 3200 Hz
 3556 Hz
 4000 Hz
 4571 Hz
 5333 Hz
 6400 Hz
 8000 Hz
10667 HZ
16000 Hz
Well, nothing is gonna be more fun than just using Deflemask, but then again if I'm gonna re-do stuff on OpenMPT I might as well do it the hard way...
Also, I guess no Orch Hits for me... It's fine though...

Quote from: elmer on 12/20/2016, 11:08 PMWell, if you're willing to put up with the bleeding eyes and anal discomfort that go with MML, then things do get somewhat easier.

The biggest problem with the MIDI-to-MML route, is that you'll lose all of the effect information, and just get stripped back to basic note information.

Then you've got to recreate the effects tables in a text-editor and add the appropriate commands back into the MML in the appropriate places.

It can be done ... and it's how it all used to be done ... but it's not particularly "friendly", and it's a lot more work than most folks want to deal with these days.

If you want to go down the MIDI-to-MML path, then Arkhan and TheOldMan may be able to help out, or have suggestions on how to handle things within the Squirrel toolset and the System Card player.
Well that changes things... It sure is gonna be harder and I don't know if I'll be able to get used to MML soon... We'll see...
(If I can't I hope you don't mind if I just send you a deflemask file or an openMPT file with the song data, whichever one you prefer)

Quote from: elmer on 12/20/2016, 11:08 PM
QuoteUnless of course everything I just said is all a load of bollocks and it doesn't work like that... Please let me know...
Hahaha ... British yourself, or perhaps just British parents?  :wink:

Nope, what you propose is workable within the existing toolchain if Arkhan decides to try to update the system Card player to handle samples, and then maybe add ADPCM, too.

With a different sound driver, 7 channel OpenMPT-to-MIDI-to-3MLE is probably even easier.

It then becomes a question of defining the process needed to create tables (i.e. envelopes) for volume/vibrato/arpeggio/drum and all the other effects.
I hope that happens soon!

Quote from: elmer on 12/20/2016, 11:08 PMBut ... an alternative idea might be to ask Delek to add a 7-channel variant to Deflemask, heck, that would be nice for the PC-FX too, although IIRC, I think that we've got 2 ADPCM channels on that console, and could use an 8-channel variant (it's got the same Hu6280 sound chip as the PCE).
Weeeelllllllllllllll... That's probably never gonna happen... (Or at least not anytime soon, unless they make the tracker open-source someday)
You see, when Delek adds a new system to the tracker he does a poll to decide which system should be the next one, and apparently the one most people want in the Deflemask Forum is the OPL2, but personally the ones I'm hoping for are the SPC-700 or the YM2203/YM2608...
By the time he's done with all of those then MAYBE he'd do the PC engine CD or the PC-FX, if at all...
But hey, who knows? It doesn't hurt to ask right?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ParanoiaDragon on 12/21/2016, 02:23 AM
Quote from: Gredler on 12/20/2016, 02:57 PMWelcome to the boards! Another musician has been revealed! Hooray!

Can't wait to hear the responses to your query, good luck finding the answers you're seeking!
Indeed, we are in desperate need of chiptune artists!  I have nowhere near enough time to try to do chiptunes, only redbook with what limited time I do have, so I'm hoping for wonderful things from Michirin9801! :)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 12/21/2016, 01:52 PM
Quote from: Michirin9801 on 12/20/2016, 06:27 PM
Quote from: TurboXray on 12/20/2016, 05:46 PMMichirin9801:
Have you seen this trick before: sub_waveform6.xm (https://web.archive.org/web/20160304225633id_/http://www.pcedev.net/audio/sub_waveform6.xm)
No I hadn't seen that, but I believe Legend of Xanadu 2's soundtrack does these effects a lot, which is why it sounds so ~BEAUTIFUL~
And I recognise these waveforms, they're from Ys IV aren't they? I have them all on Deflemask ;3
Also, the effect in Deflemask to make the instruments on different channels go out of phase like that is E5xx, I've been using it quite a bit recently!
Falcom does phasing on those games, but it's different than I what I was talking about. It's just detune phasing form what I looked at. But yeah, Xanadu games sounds awesome - and fuller too. I don't remember where the samples came from - but it's from a hucard game. Probably stock waveforms that even the system card PSG player uses. R-type on the PCE has some really interesting samples, though you wouldn't know it just by hearing the sound track in the game. Check it out: pcedev.net/audio/R-type.xm
 
Quote from: guest on 12/20/2016, 07:18 PMRelated to the CPU popping issue, could you use two channels for sample waveform playback but have them on opposite ticks, one going off as the other goes on, and getting two samples played back while also eliminating the pop?
Unless you keep the alternate channel off the whole time - it won't solve the popping issue.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 12/22/2016, 12:22 AM
Loving that Kirby cover!  :)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/22/2016, 01:23 PM
Quote from: fragmare on 12/22/2016, 12:22 AMLoving that Kirby cover!  :)
Glad you do ^^
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 12/22/2016, 10:50 PM
I don't know how much this will help, but if you have a PCE/Turbo flash cartridge, you can try out wave phasing* on real hardware easily enough using my never-finished PCE sound tool:

(?action=dlattach&topic=21779&attach=4869&image) (?action=dlattach&topic=21779&attach=4871&image)
chrismcovell.com/data/PCMgine_b1.zip

In the top-right of the first image, you can see a "WF Cycle" function that ping-pongs between up to 7 different waveforms in memory at selectable speeds.  You can at least test things out this way.

*or a crude facsimile
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/22/2016, 11:15 PM
Quote from: ccovell on 12/22/2016, 10:50 PMI don't know how much this will help, but if you have a PCE/Turbo flash cartridge, you can try out wave phasing* on real hardware easily enough using my never-finished PCE sound tool:

(?action=dlattach&topic=21779&attach=4869&image) (?action=dlattach&topic=21779&attach=4871&image)
chrismcovell.com/data/PCMgine_b1.zip

In the top-right of the first image, you can see a "WF Cycle" function that ping-pongs between up to 7 different waveforms in memory at selectable speeds.  You can at least test things out this way.

*or a crude facsimile
That's the tool you've used in your last video right?
It's a pretty good tool but I still don't have a real PC engine to use it on... But I'll get one eventually!
Also, the fact that this tool can even do that is already proof enough that it can be done in real hardware!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Arkhan Asylum on 12/23/2016, 05:39 PM
You can do this in MML as we've mentioned before just by changing the waveforms in succession.

You'll just have to be careful while doing it, and it will probably look a little messy.   You could define notes as patterns though, and play the patterns instead of notes.  It's a bit cheating, but would let you not have to keep redoing work.

It would definitely be good for PWM'd lead sounds like the C64, without the arps.

https://youtu.be/HTbOO7dEIEo

I did this stuff with a bit of C64 in mind.  I made a sort of SID sounding lead with PC Engine flare.  I'm not doing any phasing though.   IIRC, it's two channels combined with a bit of detuning.   
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Windcharger on 12/23/2016, 09:24 PM
Quote from: Michirin9801 on 12/20/2016, 02:36 PMHello everyone, I'm new here...
Hey!  I didn't know you were on the forums too...  Too cool, and welcome!   :D

Quote from: Gredler on 12/20/2016, 02:57 PMWelcome to the boards! Another musician has been revealed! Hooray!
Indeed!  Seems like we're making some good and much needed PCE audio progress as of late!  whoo hoo!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/24/2016, 08:55 PM
Quote from: guest on 12/23/2016, 05:39 PMYou can do this in MML as we've mentioned before just by changing the waveforms in succession.

You'll just have to be careful while doing it, and it will probably look a little messy.   You could define notes as patterns though, and play the patterns instead of notes.  It's a bit cheating, but would let you not have to keep redoing work.

It would definitely be good for PWM'd lead sounds like the C64, without the arps. https://youtu.be/HTbOO7dEIEo I did this stuff with a bit of C64 in mind.  I made a sort of SID sounding lead with PC Engine flare.  I'm not doing any phasing though.   IIRC, it's two channels combined with a bit of detuning.
I would if I could but I don't know MML yet... I think I'll wait for elmer's DMF2PCE thing to be complete before I really dabble into it >w>

Also, the soundtrack is pretty good, but you'd get a better C64 effect if you used a sawtooth in one channel and a reverse-sawtooth in the other and play those two slightly out of phase...
Kinda like this:

Waves:
(https://web.archive.org/web/20190509211931im_/http://orig15.deviantart.net/66ce/f/2016/359/d/d/capture_by_michirin9801-dasvy00.png)
Result: http://web.archive.org/web/20190509211928id_/http://orig05.deviantart.net/5abe/f/2016/359/9/0/pce64_test_by_michirin9801-dasvydc.wav

Quote from: Windcharger on 12/23/2016, 09:24 PM
Quote from: Michirin9801 on 12/20/2016, 02:36 PMHello everyone, I'm new here...
Hey!  I didn't know you were on the forums too...  Too cool, and welcome!   :D

Quote from: Gredler on 12/20/2016, 02:57 PMWelcome to the boards! Another musician has been revealed! Hooray!
Indeed!  Seems like we're making some good and much needed PCE audio progress as of late!  whoo hoo!
Thank you very much ^^
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Arkhan Asylum on 12/24/2016, 09:39 PM
Agreed.  I actually tried that, and felt that without the rest of things being as thick as a SID tends to be, it didnt quite feel right. 

What i went with was close and similar, with more of a pcengine charm.   

Since the pce is generally weaker in bassland, some things just dont sound right, lol.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 12/24/2016, 10:57 PM
Quote from: Arkhan on 12/24/2016, 09:39 PMAgreed.  I actually tried that, and felt that without the rest of things being as thick as a SID tends to be, it didnt quite feel right. 

What i went with was close and similar, with more of a pcengine charm.   

Since the pce is generally weaker in bassland, some things just dont sound right, lol.
Well depends... Maybe you could also use 2 channels for the bass to make it thicker? Or maybe you could use a heavier wavetable like the one used for the bass in Devil's Crush, it's a pretty simple wave:
00 00 00 31 31 31 00 00 00 00 00 31 31 31 31 31 00 00 00 00 00 00 00 00 31 31 31 31 31 31 31 31
But hoo boy does it sound powerful!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Arkhan Asylum on 12/25/2016, 12:50 AM
Yeah.   Its powerful but still not as thick as a c64 can get out of a pwmd bass with those 6581 filters.   The thing is essentially a real analog synth.   I prefer the pce anyways, but wont even try pretending it can do some of that.   I got arps to work though!  And remembered why i dont like using them.  \(☆o☆)/  pce seems really good for plucked bass sounds, though.   


Anyway, the bigger problem is that it goes in a game, so you have to contend with pewpew and explodey noises.

Thats why I ended up leaning more towards a more typicalish pce setup for the song.   

The sid will always be better at certain things.

... but then its only three channel, and games tend to suck at sfx, and often just shrug em off in favor of music, lol.


Anyway, getting all these sorts of things to work is definitely doable.    Either with one or two channels.

Im of the opinion that vying for sid style stuff isnt a great idea though.   Leave that to cd tracks, or a c64 .     Pce has its own unique charm that the sid cant deal with.

But, using the idea for the little worbly steeldrummy effects its definitely worth doing.


Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/06/2017, 09:31 PM
So, about that popping sound, I've just started using Mednafen because you guys seem to agree that it's the more accurate PC engine emulator out there (although I've been using Wii Mednafen for a while, which btw is MUCH more user-friendly to my experience) and I've loaded up some .hes exports from Deflemask, and I came out with 2 impressions:
1 - Mednafen runs Deflemask's .hes exports much better than pretty much anything else I've used thus far...
2 - Yeah, I can definitely hear the popping sound you've mentioned, but how bad it sounds depends a lot on the pitch of the note and the instrument being used, for example, in higher pitched notes the popping is much less noticeable than in lower pitched notes, and instruments that change the wavetable more quickly and/or fewer times sound much better than instruments that change the wavetable more slowly and/or more times...

Here's a few examples of what I've attempted to do with this trick (all of which are WIPs):

http://web.archive.org/web/20190509211128id_/http://orig11.deviantart.net/b1f0/f/2017/006/e/2/puyo_pop_mednafen_by_michirin9801-dauhme2.mp3 ^This one sounds fairly close on Mednafen to what it sounds like in Deflemask, the steel drums have little-to-no popping, but the trumpets have some noticeable popping going on, but it's not that bad, or at least I don't think so... I think the reason why this song works is because all of the wave-phasing instruments are higher-pitched and change the wavetable pretty quickly, the trumpet only really sounds worse because it changes the wavetables very often, meanwhile the bass is just a pulse...

http://web.archive.org/web/20190509211127id_/http://orig04.deviantart.net/6bbf/f/2017/006/3/b/pce64_test_mednafen_by_michirin9801-dauhojb.mp3 ^This little thing I've made a while back uses wave-phasing just to do C64 style pulse length modulation, and it's only in the higher pitched lead, the bass is just a sawtooth, and as you can hear this one has no popping at all, so for the pulse length modulation wave-phasing is fair game right? Well...

http://web.archive.org/web/20190509211930id_/http://orig07.deviantart.net/d71c/f/2017/006/0/8/shape___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...

http://web.archive.org/web/20190509211129id_/http://orig13.deviantart.net/0416/f/2017/006/5/e/dqv_castle_wip_mednafen_by_michirin9801-dauhqcb.mp3 ^And then I've decided to do some more complicated wave-phasing on every single instrument on every single channel for this one, and as you can hear, it sounds rubbish... Hardly any of the instruments sound any good, maybe a string here and there but that's about it...

So, after these experiments I've concluded that this trick is only really worthwhile for Steel Drums and Pulse Length Modulation on higher-pitched notes... Other than that, the only wave-phased instruments I've managed to get sounding good were some wave-phased drums like toms, kicks and a surprisingly good harp, but I don't have any examples to show them in action at the moment... Maybe someday I'll find/make other instruments that sound good with this trick, but it has to be kinda like the steel drum, where it's on the higher-pitched end and doesn't change the wavetables a whole lot...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Arkhan Asylum on 01/06/2017, 11:31 PM
I think the trumpets in the first example sound kind of bad, honestly.      The steeldrums are good, thought.

It sounds like what happens when theres too much going on in FruityLoops and everything starts clipping.



Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/07/2017, 02:02 PM
Allright, here's an example of a song using just the wave-phased steel drums, the rest is just regular waves for the baselines, but I also wanted to throw in some sampled drums just to make the song really sound more advanced! Don't worry though, it's just 6 short 8 KHz samples (Deflemask doesn't support 7 KHz)
https://web.archive.org/web/20190509211906if_/https://sta.sh/0wwnrqn721w
It's a cover of the first stage theme from Cratermaze (I love that game and its soundtrack♥) In it you can hear just how the steel drums sound on their own, without a not-very-good trumpet getting in the way, it has a little more popping than the other song, but that's probably because I'm using the steel drums on 3 channels...

Here's the .dmf file just in case:
https://web.archive.org/web/20190509211906if_/https://sta.sh/074vzxbo5bk

These steel drums only use these 4 waves:
18 20 22 24 26 26 26 26 26 26 24 22 20 18 16 14 10 08 04 02 02 00 02 04 06 10 12 16 18 20 20 22
28 24 24 26 26 22 16 10 08 08 10 16 18 20 18 16 14 14 12 12 10 04 00 02 04 08 10 14 20 26 28 28
18 14 14 14 14 12 12 12 12 14 18 22 24 26 24 20 12 10 08 06 06 08 10 10 10 12 16 20 24 28 26 20
06 04 08 12 18 22 20 18 18 18 20 24 26 24 16 08 04 02 02 10 16 18 16 12 12 16 22 26 28 24 16 10

And every time you play a new note you switch between the four of them in that order on each tick and hold on the 4th one, simple as that!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/07/2017, 03:51 PM
Quote from: Michirin9801 on 01/06/2017, 09:31 PMSo, about that popping sound, I've just started using Mednafen because you guys seem to agree that it's the more accurate PC engine emulator out there (although I've been using Wii Mednafen for a while, which btw is MUCH more user-friendly to my experience) and I've loaded up some .hes exports from Deflemask, and I came out with 2 impressions:
1 - Mednafen runs Deflemask's .hes exports much better than pretty much anything else I've used thus far...
2 - Yeah, I can definitely hear the popping sound you've mentioned, but how bad it sounds depends a lot on the pitch of the note and the instrument being used, for example, in higher pitched notes the popping is much less noticeable than in lower pitched notes, and instruments that change the wavetable more quickly and/or fewer times sound much better than instruments that change the wavetable more slowly and/or more times...
Quote from: Michirin9801 on 01/07/2017, 02:02 PMHere's the .dmf file just in case:
http://sta.sh/074vzxbo5bk

These steel drums only use these 4 waves:
18 20 22 24 26 26 26 26 26 26 24 22 20 18 16 14 10 08 04 02 02 00 02 04 06 10 12 16 18 20 20 22
28 24 24 26 26 22 16 10 08 08 10 16 18 20 18 16 14 14 12 12 10 04 00 02 04 08 10 14 20 26 28 28
18 14 14 14 14 12 12 12 12 14 18 22 24 26 24 20 12 10 08 06 06 08 10 10 10 12 16 20 24 28 26 20
06 04 08 12 18 22 20 18 18 18 20 24 26 24 16 08 04 02 02 10 16 18 16 12 12 16 22 26 28 24 16 10

And every time you play a new note you switch between the four of them in that order on each tick and hold on the 4th one, simple as that!
Thanks for the .dmf!  :)

Including that allowed me to easily blank-out all the extra channels except for the steel drum and then export a .hes to look at.

The popping occurs because of a misunderstanding/bug in deflemask.

As bonknuts said, the pop happens when there is a large change in the channel's main volume.

When you upload a new waveform to the PSG, you're supposed to keep the volume the same as it was, and just change the bits that switch the mode into the upload-mode.

So, in your example, whenever the waveform is changed, the HES that deflemask spits out sets the volume+mode register to $00 (volume $00), then uploads the new waveform, then sets it back to $9F (volume $1F).

That causes an audible pop ... particularly with the lousy-and-slow upload code that's probably used in the .hes (assembly-language programmer-types can do a waveform upload a *lot* faster).

They should set the register to $1F, then upload the waveform, then set it back to $9F (or whatever the current volume is).

You *could* make an argument that they should set it to $5F, then $1F, then upload the waveform, and then set it back to $9F ... it depends upon whether you want to reset the waveform address back to 0 before you upload the new waveform.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/07/2017, 04:37 PM
Quote from: elmer on 01/07/2017, 03:51 PM
Quote from: Michirin9801 on 01/06/2017, 09:31 PMSo, about that popping sound, I've just started using Mednafen because you guys seem to agree that it's the more accurate PC engine emulator out there (although I've been using Wii Mednafen for a while, which btw is MUCH more user-friendly to my experience) and I've loaded up some .hes exports from Deflemask, and I came out with 2 impressions:
1 - Mednafen runs Deflemask's .hes exports much better than pretty much anything else I've used thus far...
2 - Yeah, I can definitely hear the popping sound you've mentioned, but how bad it sounds depends a lot on the pitch of the note and the instrument being used, for example, in higher pitched notes the popping is much less noticeable than in lower pitched notes, and instruments that change the wavetable more quickly and/or fewer times sound much better than instruments that change the wavetable more slowly and/or more times...
Quote from: Michirin9801 on 01/07/2017, 02:02 PMHere's the .dmf file just in case:
http://sta.sh/074vzxbo5bk

These steel drums only use these 4 waves:
18 20 22 24 26 26 26 26 26 26 24 22 20 18 16 14 10 08 04 02 02 00 02 04 06 10 12 16 18 20 20 22
28 24 24 26 26 22 16 10 08 08 10 16 18 20 18 16 14 14 12 12 10 04 00 02 04 08 10 14 20 26 28 28
18 14 14 14 14 12 12 12 12 14 18 22 24 26 24 20 12 10 08 06 06 08 10 10 10 12 16 20 24 28 26 20
06 04 08 12 18 22 20 18 18 18 20 24 26 24 16 08 04 02 02 10 16 18 16 12 12 16 22 26 28 24 16 10

And every time you play a new note you switch between the four of them in that order on each tick and hold on the 4th one, simple as that!
Thanks for the .dmf!  :)

Including that allowed me to easily blank-out all the extra channels except for the steel drum and then export a .hes to look at.

The popping occurs because of a misunderstanding/bug in deflemask.

As bonknuts said, the pop happens when there is a large change in the channel's main volume.

When you upload a new waveform to the PSG, you're supposed to keep the volume the same as it was, and just change the bits that switch the mode into the upload-mode.

So, in your example, whenever the waveform is changed, the HES that deflemask spits out sets the volume+mode register to $00 (volume $00), then uploads the new waveform, then sets it back to $9F (volume $1F).

That causes an audible pop ... particularly with the lousy-and-slow upload code that's probably used in the .hes (assembly-language programmer-types can do a waveform upload a *lot* faster).

They should set the register to $1F, then upload the waveform, then set it back to $9F (or whatever the current volume is).

You *could* make an argument that they should set it to $5F, then $1F, then upload the waveform, and then set it back to $9F ... it depends upon whether you want to reset the waveform address back to 0 before you upload the new waveform.
Oh I see... So is it possible to do a work-around on that that diminishes or preferably eliminates the popping sounds? If you could make it work on Huzak it would be great!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/07/2017, 04:51 PM
Quote from: Michirin9801 on 01/07/2017, 04:37 PMOh I see... So is it possible to do a work-around on that that diminishes or preferably eliminates the popping sounds? If you could make it work on Huzak it would be great!
Yes, you should write it up as a bug on the deflemask forum, and point them back here if Delek or DeadFish (the ROM-builder programmer) want any more details.

I suspect that it'll be better coming from you, rather than me, because you already have an established presence over there.

And "nope", Huzak won't suffer from that mistake ... but I'm not guaranteeing that that's going to 100% eliminate the pop.

<edit>

Or you can point them to Mednafen's forums. Mednafen's author can tell them all about it, and they might trust her more than us.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 01/07/2017, 06:51 PM
Quote from: elmer on 01/07/2017, 03:51 PMThey should set the register to $1F, then upload the waveform, then set it back to $9F (or whatever the current volume is).
Pretty sure that's not going to fix it. I did a bunch of tests, and putting the channel into waveform update mode is the same as silencing the channel (zero volume).
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/07/2017, 07:35 PM
Quote from: TurboXray on 01/07/2017, 06:51 PMPretty sure that's not going to fix it. I did a bunch of tests, and putting the channel into waveform update mode is the same as silencing the channel (zero volume).
Ah ... cr*p ... I must have misunderstood what you said when we were talking about this a few weeks ago.   #-o :oops:

One thing ... even if there's a voltage-spike in the circuit that causes the click, the effect of that on the physical speaker movement should be considerably-less with a 200-cycle TIN update of the waveform rather than the slow software-loop that the System Card Player uses, or the simplistic-and-horribly-slow naive software loop that a .hes player probably uses on real-hardware.  :-k
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 01/07/2017, 07:37 PM
Leave the channel waveform on, set the channel frequency to a specific matched state and TIN to it while it's playing?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/07/2017, 07:41 PM
Too bad you can't have the PCE HW play in DDA mode while simultaneously filling the waveform memory with new data...  :(
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/07/2017, 07:44 PM
Quote from: TurboXray on 01/07/2017, 07:37 PMLeave the channel waveform on, set the channel frequency to a specific matched state and TIN to it while it's playing?
Is that a question, or a suggestion???  :-k

At 6-cycles-per byte, what frequency setting would that be?

And then you'd get each byte output to the DAC when you wrote it ... which would provide another (but different) audible glitch, wouldn't it?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 01/08/2017, 01:28 AM
Quote from: elmer on 01/07/2017, 07:44 PM...which would provide another (but different) audible glitch, wouldn't it?
Yup. But might not be so harsh. Dunno.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: TurboXray on 01/08/2017, 01:31 AM
Quote from: ccovell on 01/07/2017, 07:41 PMToo bad you can't have the PCE HW play in DDA mode while simultaneously filling the waveform memory with new data...  :(
You can. (leave the channel in waveform mode -> write to the DDA port, DDA sample gets both output and written to the waveform memory. Not sure what you'd want to do with it though)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/08/2017, 02:51 PM
Quote from: elmer on 01/07/2017, 07:44 PM
Quote from: TurboXray on 01/07/2017, 07:37 PMLeave the channel waveform on, set the channel frequency to a specific matched state and TIN to it while it's playing?
Is that a question, or a suggestion???  :-k

At 6-cycles-per byte, what frequency setting would that be?

And then you'd get each byte output to the DAC when you wrote it ... which would provide another (but different) audible glitch, wouldn't it?
OK, so it *might* be technically possible to do this, but the idea fills me with dread over the unknowns, and the potential dependence upon undocumented internal hardware behavior that could have changed between revisions of the chipset.  :-k

If you set the channel's period/frequency to "3", then the documentation says that's exactly 6-cycles per value that's output.

So a TIN instruction to write the waveform (at 6-cycles-per-write) would sync up with the channel's internal address register.

BUT ... when you change the period to "3" ... how do we know when that clocking gets written to the internal counter?

Is it when you write the lo-byte of the period ... or the hi-byte ... or when the current counter hits zero (which could be anytime)?

This sounds, to me, like the perfect kind of experiment for bonknuts!  :lol:

BTW ... I really, really, really, wouldn't expect Mednafen to emulate this kind of nasty hardware trick.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Mednafen on 01/08/2017, 07:33 PM
mednafen . fobby . net/junk/pcmplay-neo-noheader.zip

Old demo from 2008 that uses a 6-cycles-per-sample+TIN trick to try to get > 5-bit PCM resolution from one channel by using dithering.  Sounds ok in Mednafen, not so great on a real HuC6280, as I recall(think it sounded like data was being ANDed with other data)...

Don't think we ever tested to see if the corruption was occurring in the latched 5-bit sample, or in the sample memory.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/08/2017, 08:20 PM
I wrote this one up quickly... It alternates every second between a square wave and sawtooth wave, and you can adjust the "copying frequency" setting that goes into $0802/3 with L/R on the joypad.  No good results on the real hardware, tho.  It just keeps the square wave and corrupts it slightly.

https://chrismcovell.com/data/TIN_SndTest.zip

An example of the main switching code; perhaps I'm being too methodical?  I tried with and without NOPs, just a stab in the dark.
.do_saw:
stz $0800
stw <Copy_Freq,$0802
nop
TIN wave_saw,$0806,32
nop
stw #DEF_FREQ,$0802 ;Write default frequency
rts
Mednafen: your sound example sounds pretty nice on the real HW, but far too quiet.  Is that normal?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Mednafen on 01/08/2017, 09:29 PM
Try writing 0xDF, then 0x9F, to $804, after at least the first stw to $0802.  Like:

.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).
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/08/2017, 10:50 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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/09/2017, 02:49 AM
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:

(https://chrismcovell.com/images/PCE_WSG_TIN.gif)

Here is the code for it:

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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 01/09/2017, 10:32 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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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...

(https://web.archive.org/web/20190510000056im_/http://orig02.deviantart.net/090e/f/2017/009/b/8/capture_by_michirin9801-daut5ly.png)
^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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/09/2017, 01:04 PM
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:
(https://chrismcovell.com/images/PCE_WSG_TIN.gif)
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).
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/09/2017, 01:13 PM
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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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.

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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/09/2017, 02:20 PM
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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/09/2017, 03:35 PM
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...)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/09/2017, 04:31 PM
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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/09/2017, 06:07 PM
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:
(https://web.archive.org/web/20190510000100im_/http://orig10.deviantart.net/33d2/f/2017/009/2/f/capture_by_michirin9801-dauubyy.png)
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:
(https://web.archive.org/web/20190510000100im_/http://orig00.deviantart.net/5e45/f/2017/009/e/d/capture_by_michirin9801-dauueqd.png)
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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/09/2017, 07:19 PM
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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/09/2017, 08:03 PM
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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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?

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
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 01/09/2017, 08:49 PM
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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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) ...

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.)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 01/10/2017, 03:46 AM
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...

(https://web.archive.org/web/20190510000056im_/http://orig02.deviantart.net/090e/f/2017/009/b/8/capture_by_michirin9801-daut5ly.png)
^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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/10/2017, 08:41 AM
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.
(https://chrismcovell.com/images/PCE_WSG_TIN.gif)
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?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Arkhan Asylum on 01/10/2017, 02:49 PM
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. 

Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 01/11/2017, 11:32 AM
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?
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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).

 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: http://web.archive.org/web/20150725150004id_/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).
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 01/12/2017, 06:11 AM
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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: ccovell on 01/22/2017, 12:21 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, the program, with ASM files in case anybody can suggest changes to the code:
https://chrismcovell.com/data/TIN_SndTest.zip

(?action=dlattach&topic=21779&attach=6661&image)

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
(https://chrismcovell.com/images/TIN_Old1.gif) (https://chrismcovell.com/images/TIN_Old2.gif)


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
(https://chrismcovell.com/images/TIN_SGX_New.gif) (https://chrismcovell.com/images/TIN_SGX_Old.gif)

And the SGX again (both below are "NEW" writes) showing that sometimes the waveform changes instantly, sometimes there's the flatline.
(https://chrismcovell.com/images/TIN_SGX_OK.gif) (https://chrismcovell.com/images/TIN_SGX_NG.gif)

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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: elmer on 01/26/2017, 12:52 PM
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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 01/26/2017, 02:05 PM
Quote from: ccovell on 01/22/2017, 12:21 AM(https://chrismcovell.com/images/TIN_SGX_OK.gif)
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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/12/2017, 05:55 AM
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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/12/2017, 04:03 PM
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
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 02/12/2017, 04:39 PM
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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/17/2017, 06:26 AM
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.

http://soundcloud.com/user-716572978/wave-phase-demo01

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.  :)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 02/17/2017, 02:53 PM
Very nice ^^
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: esteban on 02/17/2017, 03:33 PM
A: It is feasible.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: spenoza on 02/17/2017, 07:51 PM
I don't think Mednafen is going to pop the way real hardware will.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/18/2017, 07:18 AM
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!  :)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: 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!
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/18/2017, 05:46 PM
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
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 02/18/2017, 06:53 PM
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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/18/2017, 09:16 PM
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.  ;)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 02/18/2017, 10:02 PM
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)
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: FraGMarE on 02/19/2017, 07:11 AM
Yea, here we go.  PSG voice sample being playing on channel 1...

PSG Sample HES File (https://fs12n5.sendspace.com/dl/0f20227024e415f44a72854f97c66c8e/58a986065330b0aa/tg5bqb/PCE_PSG_Sample01.hes)

PSG Sample DMF File (https://fs12n5.sendspace.com/dl/34c88ef355a520d91bab099db3c038d4/58a986ae771dd1f8/oualf2/PCE_PSG_Sample01.dmf)

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

PCE Chipify app by Zeromus (https://fs08n1.sendspace.com/dl/2f257d61ed5503e34e06c39b75c73447/58a98b564f302879/yganpz/PCE_Chipify.zip)

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.
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: Michirin9801 on 02/19/2017, 02:01 PM
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...
Title: Re: Question: Wave-phasing on the PC engine, how feasible is that?
Post by: NightWolve on 08/12/2021, 01:19 AM
Quote from: Michirin9801 on 01/06/2017, 09:31 PMshape___artillery_wip_mednafen_by_michirin9801-dauhpi7.mp3 (https://web.archive.org/web/20190509211930id_/http://orig07.deviantart.net/d71c/f/2017/006/0/8/shape___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...
http://web.archive.org/web/20190509211930id_/http://orig07.deviantart.net/d71c/f/2017/006/0/8/shape___artillery_wip_mednafen_by_michirin9801-dauhpi7.mp3
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. [emoji444] [emoji445]

(https://web.archive.org/web/20210909203627im_/https://a.deviantart.net/avatars/m/i/michiharuruko.jpg) 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 (https://www.deviantart.com/michiharuruko) as a consequence (which hosts these MP3s)... I invited her back without knowing about it, but now I understand her polite reply better...