Author Topic: More questions about PCE audio capabilities  (Read 1466 times)

spenoza

  • Hero Member
  • *****
  • Posts: 2751
More questions about PCE audio capabilities
« on: May 04, 2017, 02:45:27 AM »
So, some random questions about PCE audio:

What's the lowest frequency the system can generate? I know bass often doesn't feel very bassy on the system, but is that because it can't generate low enough frequencies? Is it because they sound like ass that low? What's the deal, yo?

Can the PCE vary the pitch of samples? I know the NES has some limited ability to vary the pitch of samples, and is used sometimes for some drum effects. Can the PCE do the same thing, or would there have to be a separate sample for every different pitch?
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

SignOfZeta

  • Hero Member
  • *****
  • Posts: 8497
Re: More questions about PCE audio capabilities
« Reply #1 on: May 04, 2017, 04:29:32 AM »
I have no hard answers but...

Usually when I comes to cheap analog synth technology the bass sounds terrible. This isn't because it can't go low enough, it's because it only uses a single osscilator or a reasonable equivalent of one.

If you look at a single note as a sign wave, compare higher notes to lower ones. The difference isn't just the perceived pitch. A lower freq essentially has fewer "events" by its very nature, and the roughness comes from the time gap between peaks.

I'd assume the PCE could go down to 1hz if you wanted to, but you aren't going to get a 1hz tone, you're going to get a single click every 1000 ms.

This is why expensive boutique analog synths advertise more than one OSC, this way they make better bass. From my experience moving from one to two is huge, from two to three not as much. On higher freqs it's less noticeable.

To get smoother bass on PCE maybe you could give the same part to two channels, making sure they aren't just exactly in phase with each other. That might "fatten it up".

Black Tiger

  • Hero Member
  • *****
  • Posts: 11242
Re: More questions about PCE audio capabilities
« Reply #2 on: May 04, 2017, 04:47:28 AM »
PCE has enough horsepower to spare to do shift the pitch of  samples in software and not all types of games are cpu intensive in the first place. Tom has made demos experimenting with forms of it.
http://www.superpcenginegrafx.net/forum

Active and drama free PC Engine forum

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: More questions about PCE audio capabilities
« Reply #3 on: May 04, 2017, 04:54:06 AM »
PCE has enough horsepower to spare to do shift the pitch of  samples in software and not all types of games are cpu intensive in the first place. Tom has made demos experimenting with forms of it.

Oh, I know that. I was wondering if it had any such capabilities baked into the silicon.
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: More questions about PCE audio capabilities
« Reply #4 on: May 04, 2017, 06:41:31 AM »
What's the lowest frequency the system can generate?

Without wavetable switching (and its associated "clicks" on standard PCE hardware), the PSG can generate tones down to 27Hz (A0 on the standard A440-pitch notation).

The hardware-playback range is basically the full 88-key piano keyboard range A0..C8.

But low-frequency tones don't sound too great because the PSG waveform is digital with only 32-steps and 32-levels.

So at the 27Hz cycle rate, that's 27*32 -> 864Hz sample rate for playing back a tone that low.


Quote
Can the PCE vary the pitch of samples?

Errr ... "yes" and "no".

Technically "yes", because the PSG waveforms *are* samples ... but they're only 32-samples long, so practically "no".

You're talking about the SNES's capability to pitch-shift long samples, just like the Amiga, which the PCE's PSG hardware can't do.


As Black Tiger said, and as Tom has demonstrated ... you can always switch one-or-more PSG channels into "sample" mode and write a soft-synth to do it, but that takes up a significant chunk of CPU cycles, and the results aren't going to be anywhere near as good as having it done in hardware.

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: More questions about PCE audio capabilities
« Reply #5 on: May 04, 2017, 07:18:09 AM »
You're talking about the SNES's capability to pitch-shift long samples, just like the Amiga, which the PCE's PSG hardware can't do.

OK, so the PCE hardware can't do that. But that's not necessarily what I was talking about. The NES APU can actually take a brief sample and do a limited pitch shift on it. It can only shift to certain notes, however, unlike something more robust like the SNES or the Amiga. At least, if I'm interpreting the documentation correctly. It does this by varying the playback rate of the sample.
« Last Edit: May 04, 2017, 07:21:13 AM by spenoza »
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: More questions about PCE audio capabilities
« Reply #6 on: May 04, 2017, 07:56:45 AM »
The NES APU can actually take a brief sample and do a limited pitch shift on it. It can only shift to certain notes, however, unlike something more robust like the SNES or the Amiga. At least, if I'm interpreting the documentation correctly. It does this by varying the playback rate of the sample.

Ah ... my bad, I was confusing the NES and the SNES.

The answer is "no", there's nothing quite like the APU's DPCM channel.

The PCE PSG hardware has no built-in hardware mechanism for automatically playing back a sample from RAM/ROM.

You either use the 32-sample-single-waveform-RAM built into the chip, or you switch to "sample" mode, but then you have to load each individual 5-bit sample with the CPU, at whatever sample rate you can manage.

The thing is ... that's not a terrible limitation in practice. You've got 6 sample-capable playback channels on the PCE, and far more memory than a NES.

You just store multiple samples, and you generally don't pitch-shift percussion samples, or sound-effects anyway.

Gredler

  • Guest
Re: More questions about PCE audio capabilities
« Reply #7 on: May 04, 2017, 09:30:52 AM »
Apologies and please ignore if a digression but besides PCE as a whole I'd love to hear what Squirrel is specifically able to do. I ran into trouble trying to do what I think is a pitch shift, taking a note and sliding it up to another note while the sound plays. I am the furthest thing from a musician, but I tried to learn and was not able to get that to work.

Didn't fragmire do this in deflemask with some of his thunderforce iv covers?

@ 00:10 seconds in.

Great reading this stuff, thanks for the convo

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: More questions about PCE audio capabilities
« Reply #8 on: May 04, 2017, 10:44:58 AM »
Apologies and please ignore if a digression but besides PCE as a whole I'd love to hear what Squirrel is specifically able to do. I ran into trouble trying to do what I think is a pitch shift, taking a note and sliding it up to another note while the sound plays.


You mean like this? (1:30 seconds in, and 1:40 seconds in)



Thunder Force IV : Fighting Back - Michirin9801 (Huzak ROM)



A pitch-slide (i.e. a pitch-change) is a pretty standard thing in a sound driver.

It's entirely done in software by the driver changing the channel-frequency every 1/60th, and has nothing to do with the PSG hardware itself.

A quick look at Hudson's System Card Player (i.e. Squirrel) docs says that it's called a "Sweep" in there, so presumably Squirrel supports it.

Unfortunately, I can't see that it supports the slide-to-note, which is pretty sad if true, but it can definitely do some kind of pitch-slide.
« Last Edit: May 04, 2017, 10:50:20 AM by elmer »

Gredler

  • Guest
Re: More questions about PCE audio capabilities
« Reply #9 on: May 04, 2017, 12:45:26 PM »
A pitch-slide (i.e. a pitch-change) is a pretty standard thing in a sound driver.

Yeah that's exactly what I mean, thanks for the clear example, and nice job michirin!

Arkhan and I had talked a bit about it, and he wondered if maybe it was disabled for some CD sound related elements. I'll need to dig to find the specifics of the conversation, but I figured it was feasible on the system (I hear it in many games) I just was not able to reproduce it in le squirrel. I can bridge two of the same notes for one longer continuous tone, but to shift between two notes/octaves I always had a break in the tone between notes.

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: More questions about PCE audio capabilities
« Reply #10 on: May 04, 2017, 02:57:33 PM »
I wanted to comment on this thread earlier but I had to go out...
Thanks for the plug Elmer, and glad you like it Gredler ^^

That pitch-slide you're talking about is often called "Portamento", practically every system can do it, but depending on what you use to do it it can either work fine all the time (like it does in Deflemask) or be pretty sucky and near unworkable (like in OpenMPT) but if it isn't supported on Squirrel then that's just wrong...

Also, SignOfZeta, I think you're thinking of the PCE soundchip like it's FM or some other kind of analogue synth, which it kind of isn't as far as I'm concerned, it's a 5 bit wavetable PSG, its synthesis is digital and works completely differently from FM because it doesn't have any "oscillators", it simply takes a string of 32 5 bit values and turns them into a repeating waveform that it can play at almost any frequency you'd need...

Personally, I'm pretty fond of the basses the PCE can put out, I mean, I'd take them over the awful NES triangle wave any day, but if you 'really' need your bass to have more punch or more 'twang', you still have options, although they have their drawbacks...
One of them is to do wave-phasing, which is updating the waveform information many times as the note plays, but we've already established in other threads that the PCE has a clicking sound that can sound pretty awful when it does that...
Here's a few of my experiments with wave-phasing:
Here's one that turned out fine: http://orig04.deviantart.net/6bbf/f/2017/006/3/b/pce64_test_mednafen_by_michirin9801-dauhojb.mp3


One that's 'Eh...:http://orig11.deviantart.net/b1f0/f/2017/006/e/2/puyo_pop_mednafen_by_michirin9801-dauhme2.mp3


And one that turned out real bad:http://orig13.deviantart.net/0416/f/2017/006/5/e/dqv_castle_wip_mednafen_by_michirin9801-dauhqcb.mp3


And here's a ROM courtesy of elmer of a song that I made almost entirely out of wave-phasing that's okay-ish sounding, but the bass is just a pulse wave...
http://sta.sh/0yelqs30ixn

I would definitely not recommend doing wave-phasing for basses unless you're only changing like, once or twice in the very beginning of the instrument, but if you wanna do a C64 style pulse-length modulation you'll not be disappointed! And I have that wave-phased Steel Drum which sounds okay too, so not everything will sound bad...

Another option is what SignOfZeta mentioned, you use 2 channels for the bass and slightly detune them, Cratermaze did it and I think it sounds amazing!
https://youtu.be/Vbt6_dlkN9M?t=25m5s

But the best results come at a big cost of Memory and CPU time, and that is to do basically the same thing that Sunsoft's Batman did on the PCE, that game uses Bass samples, one sample for each note, and it has a sample-looping software routine so that the note can play for as long as the musician needs instead of cutting out whenever it ends like DPCM samples do on NES...
https://youtu.be/fTKwMYmzB8g?t=2m49s
^Here's an example of PCE Batman's music, as far as I'm concerned, that was the only game that used this technique, for better or for worse... I mean, this game plays sampled basses with loop points, sampled drums AND Sampled orch-hits, often at the same time, that has to take a toll on the CPU, maybe that's why they made it a top-down collect-a-thon instead of a platformer...

-~-~-~-~-~-~-~-~-~-~-~-~-{In other news}-~-~-~-~-~-~-~-~-~-~-~-~-

I've heard elsewhere, probably from elmer on the Deflemask forum that you can update PCE PSG data faster than at every 60th, but I was thinking of using it not to update the wavetable because, well, we already know that wave-phasing can sound like s***, no what I was thinking of was updating the frequency/pitch at a faster speed... You see, Deflemask has this option to "Overclock" whatever system you're working on which is often used, including by me, to adjust the tempo of your song, but I've stopped doing that because Huzak doesn't support it, so I've found another means to adjust the tempo of the song, but that's another conversation entirely, what I'm getting at is that I tried changing the clock speed to a ludicrous amount (480Hz) in order to 'simulate' what it would be like to update the pitch of an overdriven triangle wave 8 times faster than normal in order to produce this pumping Kick Drum:http://orig06.deviantart.net/ba7b/f/2017/124/b/c/hatsune_miku___po_pi_po__pce__by_michirin9801-db85ipo.mp3


By the way, the kicks are on the same channel as the bass (Channel 1), at such a high frequency I can play the kick and switch back to the bass without any noticeable cut on the baseline! Unfortunately, this kind of messed up with my PCE PSG drum instruments, so I used just white noise for the rest of the drums on channel 6, this wouldn't have been a problem if that White Noise Envelope had been implemented in Deflemask =w=';

Either way, here's my question, would it be too hard on the PCE CPU to update the Pitch/Frequency information just for one or two instruments in just one channel 8 times every 60th?
My gut says no, but I'd like to hear it from the pros...
« Last Edit: May 04, 2017, 04:42:06 PM by Michirin9801 »

SignOfZeta

  • Hero Member
  • *****
  • Posts: 8497
Re: More questions about PCE audio capabilities
« Reply #11 on: May 04, 2017, 04:15:21 PM »
You're right, I have an FM based brain! As you said, the same thing still applies; layer that shit. The reason the E string on an electric bass sounds amazing isn't because its a particularly special super hi res 41.204 hz wave, it's because it's THOUSANDS of 41.204 hz waveforms on top of each other, completely filling all the gaps between cycles. It's real easy to see on a scope, sorta hard to explain in text...

That kick is gooooood, btw.
« Last Edit: May 04, 2017, 04:34:52 PM by SignOfZeta »

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: More questions about PCE audio capabilities
« Reply #12 on: May 04, 2017, 04:46:25 PM »
That kick is gooooood, btw.
Thanks! And yeah, you're right, that's pretty much why your 2 channel detuned bass suggestion is good...

Side note: I've updated the link for the song with the overclocked kicks, It's pretty much finished now, but there's a 2nd half that sounds slightly different that I could make later, and it kind of ends after the 2nd half, there are also some minor tweaks I wanna do, but it's presentable as it is...

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: More questions about PCE audio capabilities
« Reply #13 on: May 05, 2017, 07:20:22 AM »
Side note: I've updated the link for the song with the overclocked kicks, It's pretty much finished now, but there's a 2nd half that sounds slightly different that I could make later, and it kind of ends after the 2nd half, there are also some minor tweaks I wanna do, but it's presentable as it is...

Hahaha ... "presentable"?  :roll:

Nope, that's way more than "presentable", that's "excellent"!  :clap:

OK, so now that Wave Phasing has turned into a bit of a bust ... we've got another technique to explore.


By the way, the kicks are on the same channel as the bass (Channel 1), at such a high frequency I can play the kick and switch back to the bass without any noticeable cut on the baseline! Unfortunately, this kind of messed up with my PCE PSG drum instruments, so I used just white noise for the rest of the drums on channel 6, this wouldn't have been a problem if that White Noise Envelope had been implemented in Deflemask =w=';

"White Noise Envelope"?

Do you mean using the Wave Macro to switch Noise Mode On/Off, so that the Volume Macro can still function normally? Or is this something else?


Either way, here's my question, would it be too hard on the PCE CPU to update the Pitch/Frequency information just for one or two instruments in just one channel 8 times every 60th?
My gut says no, but I'd like to hear it from the pros...

Well, Huzak is currently taking about 6.5% of CPU time to process an update cycle, and that's without any active sound-effects. That's a bit higher than I'd like, but there's not much that I can do about that and still keep it compatible with DefleMask.

Running the whole Huzak update at 480Hz would take up over 50% of the CPU time ... which is far too high to be usable.

But just updating certain PSG registers is fairly fast, although then you get into the question of triggering interrupts, and interfering with sample-playback interrupts.

It's definitely achievable ... the question is really just one of exactly what you want to achieve, and how you'd want it to work.

Having certain instruments (on one, or maybe two pre-defined channels) being marked as "high-speed" and running only their Macro updates at 480Hz (or 240Hz  :-") might be reasonably-easy to achieve.

The thing to avoid (if possible) to reduce the costs, would be any detune/vibrato on those channels, or wavetable-changing in the macros.

If you actually want a complete channel-update to run at high-speed, on only one-or-two channels, then that starts to get a bit more expensive, and I can't see how you'd actually write a tune in DefleMask like that without going nuts, but ... technically ... it could be done.

Does that make any sense? Would some "high-speed" instruments give you the capabilities that you're looking for?
« Last Edit: May 05, 2017, 07:22:29 AM by elmer »

Michirin9801

  • Hero Member
  • *****
  • Posts: 589
Re: More questions about PCE audio capabilities
« Reply #14 on: May 05, 2017, 09:01:16 AM »
Hahaha ... "presentable"?  :roll:

Nope, that's way more than "presentable", that's "excellent"!  :clap:

OK, so now that Wave Phasing has turned into a bit of a bust ... we've got another technique to explore.

Well, I'm glad you like it ^^
But it's gonna be better when I post it on YouTube, which will take a while considering what I'm planning to do with this one... (Don't ask, it's a secret until it's out ;3)

OK, so now that Wave Phasing has turned into a bit of a bust ... we've got another technique to explore.

Well, it's certainly doable, and it can sound okay depending on what you want to do, but I don't think anybody's gonna need high-frequency wave-phasing on the PCE (Unless they're working on the SuperGrafx which apparently doesn't have that 'click') But yeah, I think changing the pitch at a high frequency is a better idea than changing the wavetable...

"White Noise Envelope"?

Do you mean using the Wave Macro to switch Noise Mode On/Off, so that the Volume Macro can still function normally? Or is this something else?

Yup! That's exactly what I mean ^^

It's definitely achievable ... the question is really just one of exactly what you want to achieve, and how you'd want it to work.

Having certain instruments (on one, or maybe two pre-defined channels) being marked as "high-speed" and running only their Macro updates at 480Hz (or 240Hz  :-") might be reasonably-easy to achieve.

The thing to avoid (if possible) to reduce the costs, would be any detune/vibrato on those channels, or wavetable-changing in the macros.

If you actually want a complete channel-update to run at high-speed, on only one-or-two channels, then that starts to get a bit more expensive, and I can't see how you'd actually write a tune in DefleMask like that without going nuts, but ... technically ... it could be done.

Does that make any sense? Would some "high-speed" instruments give you the capabilities that you're looking for?


Personally all I need is for one or two instruments to update their pitch at a high speed, just the pitch, more specifically the Kick you hear in that song, although it would be nice to have a snare that did it as well, but that one would need the aforementioned white noise envelope...

The way I'm doing it in this song is that I'm using the Fixed Arpeggio macro in order to change the pitch on every 480th by 4 notes for 16 ticks, and on the 17th tick I change the waveform to a distorted sawtooth  that serves as my bass, and whenever I need to play just the kick I cut out the note on the 17th tick preventing the bass to be played...

In order to achieve that I'd need the Arpeggio Macro, the Volume macro and the Wave macro to be updated at 480hz only in channel 1 and only when that instrument is being played, but that's for just this one song, depending on the song I may wanna put a similar kick with or without the bass attached to it on channel 6, but that's just me, some different people might wanna do something completely different, but I'd imagine if they raised their frequency that high, they're probably not even thinking of playing anything in real hardware and probably just making a chiptune for the sake of making a chiptune...