Multiple PCM channels.
Moderator: BigEvilCorporation
Multiple PCM channels.
I've heard and seen some MD games that supposedly play multiple pcm samples at once. Some games I've heard of include: Street Fighter 2 CE, Mortal Kombat 2 and 3, Mega Turrican and apparently Probotector MD does it too.
I'm interested in how this is achieved, ways such as using 4-bit samples, interpolating and software sample mixing can be quite intriguing for someone slightly experienced in MD sound programming.
Tiido's sound driver also has 2 pcm channels, at the expense of FM4 and FM5 (the usual pcm channel).
So, does anyone else know of MD games that play more than one sample at the same time?
-Toddo
I'm interested in how this is achieved, ways such as using 4-bit samples, interpolating and software sample mixing can be quite intriguing for someone slightly experienced in MD sound programming.
Tiido's sound driver also has 2 pcm channels, at the expense of FM4 and FM5 (the usual pcm channel).
So, does anyone else know of MD games that play more than one sample at the same time?
-Toddo
-Chill dude, the 68k can handle it.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
You do software mixing on the hardware PCM channel. How many channels you can mix depends greatly on your code quality. My sound engine does not lose 2 FM channels, just the last one that does PCM. It is possible to play PCM on a FM channel but there's quite some technicalities involved and the logarithmic volume scale only gets like 4...5 bits of precision at most, more is possible but the code gets very ugly and complex so that normal PCB mixer would be a piece of cake to do.
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://oerg866.tototek.com/toy.html[/quote]
.Mod player, that's cool. From what I've heard very few games use polyphony on the 6th channel. However it may be possible with the use of 2x4-bit being mixed to 8-bit. The 68k has enough power to mix 8-bit samples. If I see a z80 driver (which is usually used for sound) with 2*pcm channels or more, then I'll be impressed.
.Mod player, that's cool. From what I've heard very few games use polyphony on the 6th channel. However it may be possible with the use of 2x4-bit being mixed to 8-bit. The 68k has enough power to mix 8-bit samples. If I see a z80 driver (which is usually used for sound) with 2*pcm channels or more, then I'll be impressed.
-Chill dude, the 68k can handle it.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
There's a thread around here somewhere where me and couple other regulars talk about some z80 code to do a resampling mixer via the z80. The 68000 would handle music score processing, as well as instrument handling, but pass the actual sample mixing vars to the z80. That simplified the z80 code enough that it should be able to mix four channels at 7 to 8 kHz per channel. That should leave enough 68000 power to play a game while playing a MOD, not just only during a title screen like Toy Story.
-
- Very interested
- Posts: 256
- Joined: Tue Sep 11, 2007 9:10 pm
Why limit yourself to 4bit channels? 7bit+7bit=8bit. Or 6bit+6bit+6bit+6bit=8bit. I mean, that assumes you don't want to waste cycles on clipping detection. You're not multiplying a 4bit channel with another channel; you're accumulating them. Unless I missed something here, and you want to use 4bit specifically for some other reason (space/storage?).
Unless I missed something here, and you want to use 4bit specifically for some other reason (space/storage?).[/quote]
4 bit samples use less space than the 7 or 6 bit samples, I'd also hope to save some reasonable amount of cpu power for things such as sound effects and voices.
A single digital audio channel can have sample mixing done by a 7.68mhz cpu from 1979, that in it's self is impressive
4 bit samples use less space than the 7 or 6 bit samples, I'd also hope to save some reasonable amount of cpu power for things such as sound effects and voices.
A single digital audio channel can have sample mixing done by a 7.68mhz cpu from 1979, that in it's self is impressive
-Chill dude, the 68k can handle it.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
4bit will certainly not save any CPU power, you spend extra in separating the samples from one another. It would take 2x less space but also sounds 16 times worse (noise fest).
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Stef has a 4 channel PCM player that runs on the z80 and plays 16khz files in SGDK. This uses the just the one FM channel.
The mixing macro consists of the following:
The mixing macro consists of the following:
Code: Select all
; doEnvAndMix
; = 35 --> 49 cycles
macro doEnvAndMix
LD A, (BC) ; compute volume ' 7 |
ADD (HL) ; mix ' 7 | 24
JP PO, .ok ; check overflow ' 10 |
LD A, $7F ; fix overflow ' 7 |
ADC $0 ; A = $7F/$80 ' 7 | +14
.ok
LD (HL), A ; write sample in buffer ' 7 | 11 (35)
INC L ; next ' 4 |
endm
-
- Very interested
- Posts: 256
- Joined: Tue Sep 11, 2007 9:10 pm
Assuming you nibble pack the 4bit samples to save space, you're gonna eat up more processor time separating those nibbles than just using a single byte and wasting a couple of bits.Toddo wrote: 4 bit samples use less space than the 7 or 6 bit samples, I'd also hope to save some reasonable amount of cpu power for things such as sound effects and voices.
How about an 8bit cpu from 1978? http://www.youtube.com/watch?v=49uB068i3ZU (frequency scaling, applying voluming, AND mixing all 4 channels in realtime). Still has processor power left over to display a player screen with waveform monitor! That video is the 6309 version, but there's a 6809 version just the same (minus a few areas of the screen that don't have stats). 2mhz. The CoCo has no acceleration. Not for audio, not for video. Just a brute force cpu, some interrupts, single dac, and a bitmap display (no tiles or sprites).A single digital audio channel can have sample mixing done by a 7.68mhz cpu from 1979, that in it's self is impressive
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
With some help from Google I found the thread
I'm currently working on a sound driver that supports 2 PCM channels with resampling and a 12KHz output frequency. It runs entirely on the Z80, but scheduling of bank switches and sample buffering is encoded on the command stream which makes it complicated to work with. I'm currently working on a script to deal with that complexity so that you can write the command stream in a more sane format. I'll hopefully have something demoable in a few days.
I'm currently working on a sound driver that supports 2 PCM channels with resampling and a 12KHz output frequency. It runs entirely on the Z80, but scheduling of bank switches and sample buffering is encoded on the command stream which makes it complicated to work with. I'm currently working on a script to deal with that complexity so that you can write the command stream in a more sane format. I'll hopefully have something demoable in a few days.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Yeah, that's the thread and code I was talking about. The last mixer loop code was in this post in that thread: viewtopic.php?p=17741#17741Mask of Destiny wrote:With some help from Google I found the thread
I'm currently working on a sound driver that supports 2 PCM channels with resampling and a 12KHz output frequency. It runs entirely on the Z80, but scheduling of bank switches and sample buffering is encoded on the command stream which makes it complicated to work with. I'm currently working on a script to deal with that complexity so that you can write the command stream in a more sane format. I'll hopefully have something demoable in a few days.
I really need to work on that idea some more. Maybe after Doom...