VOGONS


First post, by Tronix

User metadata
Rank Member
Rank
Member

Hello,

I found outdated similar thread on pouet.net but unfortunately it is outdated. I was helped by the basic information on turning on the envelope generators and pumping samples as amplitude at channels 2 and 5. I did a little research with a multimeter:

P113092.JPG
Filename
P113092.JPG
File size
159.77 KiB
Views
2868 views
File license
Public domain

X-axis is the amplitude of 05 channel, Y-axis is the amplitude of 02 channels. The values are the output voltage.

I take unsigned 8 bit PCM mono WAV file, do some bit shifts right and left and got the first DIGITAL sounds from my GameBlaster clone. I even recorded these sounds.

Filename
L007.mp3
File size
1.1 MiB
Downloads
84 downloads
File license
Public domain
Filename
L009.mp3
File size
334.94 KiB
Downloads
73 downloads
File license
Public domain

Not great not terrible 😉

https://github.com/Tronix286/

Reply 2 of 38, by Tronix

User metadata
Rank Member
Rank
Member

My code for output 8 bit unsigned PCM raw value look like this:

     cmsReset;         {Fill all registers with zeros, reset chip and enable sound}
cmsWrite($18,$82);
cmsWrite($19,$82);
 mov    al,2                    ; select amplitude register channel 2
mov dx,SoundPort
inc dx
out dx,al

mov al,byte ptr es:[bx] ; AL = 8 bit unsigned WAV data
shr al,4 ; AL = (AL / 16); 0000XXXX
push ax ; save AL for future ch5 processing
shl al,1 ; AL = 000XXXX0
and al,0fh ; AL = 0000XXX0 ; right ch volume
mov ah,al ; AH = 0000xxx0
shl ah,4 ; AH = xxx00000 ; left ch volume
or al,ah ; AL = xxx0XXX0 ; right and left volume
dec dx
out dx,al ; write to SAA1099 ch2 amp register

mov al,5 ; select amplitude register channel 5
inc dx
out dx,al

pop ax ; restore AL (AL = 0000XXXX)
mov ah,al ; move to AH (AH = 0000XXXX)
xor al,al ; zero amplitude (AL = 00000000)
test ah,8 ; test AH third bit set
jz @skp
mov al,0EEh ; maximum amplitude (AL = 11101110)
@skp:
dec dx
out dx,al ; write to SAA1099 ch5 amp register

https://github.com/Tronix286/

Reply 3 of 38, by Tronix

User metadata
Rank Member
Rank
Member

I found a STM/MOD player with an open driver architecture with source codes - http://www.dcee.net/Files/Music/Player/ (play382.arj) [Sound Wave Pro / FRIENDS software / Andrew Zabolotny] , so i modify a little COVOX.ASM and play few STM and MOD files over Creative Music System / Game Blaster...

159cc1967843c9090ea566bcaa713.png
Filename
159cc1967843c9090ea566bcaa713.png
File size
7.42 KiB
Views
2801 views
File license
Public domain
Filename
L010.MP3
File size
1.53 MiB
Downloads
77 downloads
File license
Public domain
Filename
L011.MP3
File size
2.62 MiB
Downloads
73 downloads
File license
Public domain

The source code of the CMS driver and the driver itself for this player are in the attached archive.

Attachments

  • Filename
    cms_drv.zip
    File size
    4.72 KiB
    Downloads
    89 downloads
    File license
    Public domain

https://github.com/Tronix286/

Reply 5 of 38, by Tiido

User metadata
Rank l33t
Rank
l33t

SAA output should be logarithmic as is AY and the Ti PSG. You will need to take this into account for a decent sound quality. Here are two examples I have done on Sega Master System, one without taking the log scale into account and one that does :
http://www.tmeeco.eu/BitShit/SMSPCM0.SMS
http://www.tmeeco.eu/BitShit/SMSPCM1.SMS

And here is one that has double sample rate + log compensation : http://www.tmeeco.eu/BitShit/SMSPCM.SMS

A good emulation is necessary for good sound, or actual hardware off flashcart.

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 7 of 38, by Benedikt

User metadata
Rank Oldbie
Rank
Oldbie

Could this be combined with Sigma/Delta modulation, i.e. error diffusion?
I used it with a high-baud-rate serial port, once, and got audio output of roughly similar quality.

Reply 8 of 38, by darry

User metadata
Rank l33t++
Rank
l33t++
Benedikt wrote on 2021-03-13, 17:07:

Could this be combined with Sigma/Delta modulation, i.e. error diffusion?
I used it with a high-baud-rate serial port, once, and got audio output of roughly similar quality.

That reminds me of this .

https://hackaday.com/2021/02/24/audio-out-ove … b-to-trs-cable/

Reply 9 of 38, by Benedikt

User metadata
Rank Oldbie
Rank
Oldbie

I simply put a panel mount 3.5mm audio jack and an RC low-pass in a DE9 plug enclosure.
The low-pass was pretty much necessary, but the SAA1099 is not limited to one bit precision.

Reply 10 of 38, by Tronix

User metadata
Rank Member
Rank
Member
Tiido wrote on 2021-03-13, 16:44:

SAA output should be logarithmic as is AY and the Ti PSG.

I dont think so. If you take a look at my first post on this topic, the picture, you can see that the voltages decrease linearly depending on the volume:
vol 0 -> vout 5,12V
vol 2 -> vout 5,09V
vol 4 -> vout 5,04V
vol 6 -> vout 5,00V
etc..

My multimeter is not super accurate, but this is enough to understand that the voltages decrease by about 0,03-0,04 each time. This suggests that the dependence is still linear and not logarithmic.

Anyway, i tried to creating lookup tables based on formula y = Pow(2 , - ( ( 15 − n ) / 2 ) where n is PSG volume and got them:

Boring tables
PsgVolume:
DB 00, 00, 01, 02, 03, 03, 04, 04, 05, 05, 05, 06, 06, 06
DB 06, 06, 07, 07, 07, 07, 07, 07, 07, 08, 08, 08, 08, 08
DB 08, 08, 08, 08, 09, 09, 09, 09, 09, 09, 09, 09, 09, 09
DB 09, 09, 09, 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0A
DB 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0A, 0B, 0B, 0B, 0B, 0B, 0B
DB 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B
DB 0B, 0B, 0B, 0B, 0B, 0B, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C
DB 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C
DB 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C
DB 0C, 0C, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D
DB 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D
DB 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D
DB 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D, 0E, 0E
DB 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E
DB 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E
DB 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E
DB 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E
DB 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E, 0E
DB 0E, 0E, 0E, 0F
Ch2reg:
DB 00, 00, 22, 44, 66, 66, 88, 88, AA, AA, AA, CC, CC, CC
DB CC, CC, EE, EE, EE, EE, EE, EE, EE, 00, 00, 00, 00, 00
DB 00, 00, 00, 00, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22
DB 22, 22, 22, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44
DB 44, 44, 44, 44, 44, 44, 44, 44, 66, 66, 66, 66, 66, 66
DB 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66
DB 66, 66, 66, 66, 66, 66, 88, 88, 88, 88, 88, 88, 88, 88
DB 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88
DB 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88
DB 88, 88, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA
DB AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA
DB AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA
DB AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, CC, CC
DB CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC
DB CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC
DB CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC
DB CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC
DB CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC, CC
DB CC, CC, CC, EE

Ch5reg:
DB 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
DB 00, 00, 00, 00, 00, 00, 00, 00, 00, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
DB EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE, EE
Show last 1 line
         DB EE, EE, EE, EE

I tried to apply this to playing a wav file, but I didn't hear a global difference in sound.

https://github.com/Tronix286/

Reply 11 of 38, by Ozzuneoj

User metadata
Rank l33t
Rank
l33t

This is amazing!

I understand almost nothing of what is involved here, but it still blows my mind.

Imagine hearing PCM music or effects coming out of an IBM PC running a Game Blaster back in 1988.

Just curious, how large are the .wav files you played, and what are the rest of the specs of the computer you did this on? I wonder how slow of a PC could actually handle this.

Now for some blitting from the back buffer.

Reply 12 of 38, by Tronix

User metadata
Rank Member
Rank
Member
Ozzuneoj wrote on 2021-03-14, 01:27:

Just curious, how large are the .wav files you played, and what are the rest of the specs of the computer you did this on? I wonder how slow of a PC could actually handle this.

I am very lazy to write my own player for WAV files, so I took someone's ready-made code in Turbo Pascal and changed the procedure for outputting sound from the PC-speaker to a game blaster. This player allows you to play files that fit into the main RAM, so WAV file size usualy limited to ~510-550Kb max. This is enough for me for a simple check of the sound quality.

As for the test configuration, I am using a 486 based machine with AMD 133MHz processor. But I do not think that any super-powerful computer resources are needed, since no serious calculations are made to output one audio byte - no divisions, no multiplications - only bit shifts. Even XT should be able to handle this.

https://github.com/Tronix286/

Reply 13 of 38, by Tronix

User metadata
Rank Member
Rank
Member

I completely forgot about the ImpulseTracker! This is an excellent music tracker, the source code of which is open, so I can easy make support for CMS/GameBlaster output now. I again took the driver for audio output on LPT Covox as a basis and changed it a little. As a result, we got the CMS.DRV driver for ImpulseTracker.

https://github.com/Tronix286/impulsetracker

You can check this on your real CMS/GameBlaster by downloading the files IT.EXE and CMS.DRV and then running the program with the following parameters:

IT /sCMS.DRV

https://github.com/Tronix286/

Reply 14 of 38, by OPLx

User metadata
Rank Member
Rank
Member

Really great to see this! You might want to take a look (or listen) to these:

I haven't tried out playing samples on the SAA1099 (on my eventual list of things to try), but perhaps the above two may be of interest to you. "Solar Flare" on the pouet.net thread is the same author of the video links.

Reply 15 of 38, by stefan

User metadata
Rank Newbie
Rank
Newbie
OPLx wrote on 2021-03-14, 16:48:
Really great to see this! You might want to take a look (or listen) to these: […]
Show full quote

Really great to see this! You might want to take a look (or listen) to these:

I haven't tried out playing samples on the SAA1099 (on my eventual list of things to try), but perhaps the above two may be of interest to you. "Solar Flare" on the pouet.net thread is the same author of the video links.

That's me. 😀

The Bacardi (and CannonFodder) mods as played back by DTA's sample routine are quite a novelty.
Every time I think about how it works, I can't quite get my head around it.
The main concept is that it each sample is sent to /two/ channels which are /exactly/ out of phase resulting in a sum of no tone.

By not using the volume halved envelope generator, the doubled sample resolution makes a huge audible difference.

SAM Coupé oscilloscope videos

Reply 16 of 38, by OPLx

User metadata
Rank Member
Rank
Member
stefan wrote on 2021-04-15, 17:17:

That's me. 😀

Really appreciate your work and giving the SAA1099 some prominence out there!

stefan wrote on 2021-04-15, 17:17:
The Bacardi (and CannonFodder) mods as played back by DTA's sample routine are quite a novelty. Every time I think about how it […]
Show full quote

The Bacardi (and CannonFodder) mods as played back by DTA's sample routine are quite a novelty.
Every time I think about how it works, I can't quite get my head around it.
The main concept is that it each sample is sent to /two/ channels which are /exactly/ out of phase resulting in a sum of no tone.

By not using the volume halved envelope generator, the doubled sample resolution makes a huge audible difference.

I think I understand the concept and that is pretty amazing that the hardware is capable of this and DTA pulled that off; it makes complete sense that it works in that fashion. That is another thing to add to my "to try" list! 😁

Reply 17 of 38, by stefan

User metadata
Rank Newbie
Rank
Newbie

After a quick flurry of activity over on the sam-users mailing list I had to pull out the debugger and determine how DTA pulled this off.

  1. 1c: 02 - frequency reset (all channels)
  2. 1b - 00: 00 - zero all registers, tone 0 octave 0 -> 31 Hz tone
  3. 01-04: 88 - channels 1-4: medium amplitude
  4. 11: 11 - channels 2-3: octave 1
  5. 14: 1e - frequency enable channels 1-4
  6. 1c: 01 - sound enable (all channels)
  7. wait ~12ms (on the SAM Coupé the above is executed on screen line 0, the following is executed on screen line 192, a 50Hz frame including border has 312 lines)
  8. 11: 00 - channels 2-3: octave 0
  9. on line interrupts and software timing in border area sample data is pumped
  10. 01-04: sample data

Retriggering the notes by setting the octave results in channels 2 and 3 now being in opposite phase of channels 1 and 4.
As long as retriggering occurs within a margin (which?) the outputs align internally.

SAM Coupé oscilloscope videos

Reply 18 of 38, by ViTi95

User metadata
Rank Member
Rank
Member

This is great! The code looks very simple and sounds pretty decent, maybe I can add support for FastDoom with this technique.

One little question, what's the maximum frequency the GameBlaster supports?

EDIT: Another question, does this work on DosBox?

https://www.youtube.com/@viti95

Reply 19 of 38, by OPLx

User metadata
Rank Member
Rank
Member
stefan wrote on 2021-09-02, 20:51:
After a quick flurry of activity over on the sam-users mailing list I had to pull out the debugger and determine how DTA pulled […]
Show full quote

After a quick flurry of activity over on the sam-users mailing list I had to pull out the debugger and determine how DTA pulled this off.

  1. 1c: 02 - frequency reset (all channels)
  2. 1b - 00: 00 - zero all registers, tone 0 octave 0 -> 31 Hz tone
  3. 01-04: 88 - channels 1-4: medium amplitude
  4. 11: 11 - channels 2-3: octave 1
  5. 14: 1e - frequency enable channels 1-4
  6. 1c: 01 - sound enable (all channels)
  7. wait ~12ms (on the SAM Coupé the above is executed on screen line 0, the following is executed on screen line 192, a 50Hz frame including border has 312 lines)
  8. 11: 00 - channels 2-3: octave 0
  9. on line interrupts and software timing in border area sample data is pumped
  10. 01-04: sample data

Retriggering the notes by setting the octave results in channels 2 and 3 now being in opposite phase of channels 1 and 4.
As long as retriggering occurs within a margin (which?) the outputs align internally.

Wow! This is pretty amazing. It would be interesting to read about how DTA came to the conclusion to do this. Thank you for sharing the information!