I was working on soft mixing some audio channels. I wanted to do simple stuff/output. Something to give back a few channels but without a lot of resource, so you can get those 4 note chords out without eating up almost all of PCE’s channels. I was looking at amplitude modulation (ring modulation, but DC/unipolar offset only for modulator’s output/waveform). I got a working example up and running. The carrier was a 2 sample square waveform (50% duty cycle). The modulator was a 16 sample inverted SAW waveform. I took the idea from C64’s SID and uses a 24bit phase accumulator, with the top 4bits as the direct waveform. But instead of incrementing on overflow, I decrement (easier to test for ZERO with a BNE than a CMP for up counting).
Both the carrier and the modulator has separate 24bit PHA (though the carrier only used 17bit as 1bit:16bit). And the driver was the 7.012khz of the TIMER (resync’d on vblank to get 7012hz vs 6991hz). 7khz is kind of low, but with a 2 sample waveform – you can get up to 3500hz notes. That’s incredibly high. To give an example, PCE C octave 7 note is 2110hz. Note in that range are rare, let alone octave 6. Please note (no pun intended), this is PCE’s note scale. Not MIDI, which has a different octave range and is offset by comparison. Combined that top range, with the 17bit phase accumulator that gives steps of 0.1hz resolution, and you’ve got a pretty solid setup.
The reason I wanted to use AM modulator, is to get some timbre out of a soft channel. Square wave by itself isn’t always that fun. But the problem I came across, is that you need C:M ratios about 1:1 or higher M multiples. M is 16 samples per cycle (SAW) and C is 2 samples per cycle, you’ll need a frequency of 8x on for M just to get 1:1. So if both PHA were set to same frequency, you get 1:8. And for AM, it’s too low. It’s not high enough to blend as timbre. So you have to offset this. This means 8:1 PHA just to get 1:1 in output. That means 7012/16 gives a top frequency of 438hz note frequency or roughly A4 as the highest note. If I’m gonna do that, I might as well use a more complex waveform for the Carrier then. Whatever I can fit into 16 samples. Or, bring the Modulator down to 8 samples, Carrier to 8 samples, and have a note range to A5. That’s still limiting. And what if I want high ratios than 1:1? See where this is going?
I’m not going to shelve the project completely, but I am going to put it on the back burner for now. As there might be some interesting bass to mid sounds you can generate with it.
So, last night I was talking with madbrain (check out his OPL3 stuff on 8bc). Give gave me a few ideas of what I could do. And I had a couple of my own. I originally had plans to do four square channels via soft mix. And the reason for doing that many, is to pair them (chords, detuned pairs, etc). But it gets expensive with four 24bit phase accumulators (even in self modifying code setup). About the same as doing a MOD driver (27% cpu resource, buffered for dual interrupt friendly setups). On Yamaha’s 2612 and other similar chips, if you want to set all 4 operators as carriers – then you set the main frequency of the channel and the rest are multiple of that. So I could have one PHA for the carrier and have a 8bit float PHA for the other carriers, since they are not going to be that far apart (for what you’re trying to use them for).
There are some other ideas I had as well. Since this is all done in software, I have full control over syncing anything to the ‘tee’. I could shift another waveform against a carrier to get gradual phase effects, or do it at audiorate for timbre control. Stuff like that. There’s also filter emulated effects by having an lfo envelope corresponding to a waveform table LUT, etc. Possibilities…