OMG! ZIRIA! ZIRIA!! ZIRIA!!! IT ACTUALLY HAPPENED!! 34 YEARS LATER!! The epic/legendary Tengai Makyou/Far East of Eden: Ziria JRPG has finally been localized! Supper the Subtitler struck again! Simply unstoppable, NOTHING can prevent him from TOTAL PCECD localization domination!!!! WHACHA GONNA DO BROTHER?!?!
Main Menu

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

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

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Michirin9801

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:
And here's another one that's still unfinished (and I'm probably never gonna finish it):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!

Gredler

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!

TurboXray

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?

TurboXray

I'm kinda surprised Deflemask doesn't support this:
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.

elmer

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:

Michirin9801

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

elmer

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!

Michirin9801

Quote from: TurboXray on 12/20/2016, 04:02 PMI'm kinda surprised Deflemask doesn't support this:
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:Also, it's very nice to hear an example of a game actually doing it and changing the wavetable on-the-fly!

elmer

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&lt;


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.

TurboXray

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.

Michirin9801

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

Michirin9801

Quote from: TurboXray on 12/20/2016, 05:46 PMMichirin9801:
Have you seen this trick before: 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!

spenoza

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?

elmer

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.

Michirin9801

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

elmer

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).

Michirin9801

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?

ParanoiaDragon

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! :)
IMG

TurboXray

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

FraGMarE


Michirin9801


ccovell

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:

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

Michirin9801

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:

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

Arkhan Asylum

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

Windcharger

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!

Michirin9801

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

Arkhan Asylum

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

Michirin9801

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!

Arkhan Asylum

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.


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

Michirin9801

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):^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...^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...^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...^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...

Arkhan Asylum

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.



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

Michirin9801

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!

elmer

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.

Michirin9801

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!

elmer

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.

TurboXray

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).

elmer

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

TurboXray

Leave the channel waveform on, set the channel frequency to a specific matched state and TIN to it while it's playing?

ccovell

Too bad you can't have the PCE HW play in DDA mode while simultaneously filling the waveform memory with new data...  :(

elmer

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?

TurboXray

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.

TurboXray

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)

elmer

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.

Mednafen

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.

ccovell

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?

Mednafen

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).

ccovell

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.

TurboXray

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.

ccovell

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:

IMG

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.

FraGMarE

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!