Jump to content
mariuszw

AY-3-8910 music player

Recommended Posts

Hello,

 

While working on my Spectrum -> Atari ports, I got interested in playing AY-3-8910 music (Spectrum 128 sound chip, also known as PSG) in ported games. I found an idea for such player developed by drac030 (details in Polish here: http://www.atari.org.pl/forum/viewtopic.php?id=2908&p=2).My player has drac030's idea expanded.

 

The idea is as follows:

- 2 Pokey chips are needed, as one PSG channel is mapped to 16bit Pokey channel, and PSG has three tone channels and one noise channel

- each channel uses 1,773 MHz

- tone channel frequency is calculated by multiplying PSG by 8 and subtracting 7 (this is developed from frequency formulas for PSG and Pokey)

- when noise is enabled on any of PSG channels, it is played on 4th Pokey channel using PSG noise frequency

- volume values are mapped 1:1

- envelopes from AY are ignored

 

Source code for player is found in psg.asm file.

 

Player uses .psg files as input. These files store raw values of PSG registers and VBL sync commands. I created .psg files using Ay_Emul (https://bulba.untergrund.net/emulator_e.htm) and .ay files from WorldOfSpectrum Project AY (http://www.worldofspectrum.org/projectay/).

 

Player uses compressed files, as regular .psg files are too large to fit in Atari memory. I am using Exomizer (https://bitbucket.org/magli143/exomizer/wiki/Home) for compression. Psg file should be compressed with following command:

exomizer.exe raw Hydrofool.psg -m 1024 -c -o Hydrofool.psg.exo

Parameters raw, -m 1024, -c are important, as they are required for streaming depacker to work. There seems to be also an issue with streaming depacked from Exomizer, and end of data condition is not properly detected. To work around this, be sure to add 8 bytes with value FD at the end of the file (FD is a command recognized by player which stops playing).

 

Attached music files (in xex format):

- Cybernoid (Nick Jones)

- Cybernoid 2 (Nick Jones)

- Exolon (Nick Jones)

- Hydrofool (Rob Hubbard)

- Robocop (Jonathan Dunn)

 

If you convert additional music, please post it here.

 

I am interested in making this player work on one Pokey. If you have some idea (or maybe even the code), please let me know.

 

Enjoy the music!

 

psg.asm

exostreamdecr1.s

Cybernoid.xex

Cybernoid2.xex

Exolon.xex

Hydrofool.xex

RobocopTitle.xex

Cybernoid.psg.exo.bin

Cybernoid2.psg.exo.bin

Exolon.psg.exo.bin

Hydrofool.psg.exo.bin

RobocopTitle.psg.exo.bin

  • Like 9

Share this post


Link to post
Share on other sites

Sounds good though I prefer you keep 8bit guys busy because it is coming to a point where it all seems so simply and automatically converted. You then don't need A8 musicians...

What's next? You get straight way to put A8 PMGs over ZXs hi-res gfxs and what about me? Will I be unemployed?

:grin:

:thumbsdown: maybe not and is :thumbsup:

Share this post


Link to post
Share on other sites

While working on my Spectrum -> Atari ports, I got interested in playing AY-3-8910 music (Spectrum 128 sound chip, also known as PSG) in ported games. I found an idea for such player developed by drac030 (details in Polish here: http://www.atari.org.pl/forum/viewtopic.php?id=2908&p=2).My player has drac030's idea expanded.

Yes, the exact link to my post is this: http://www.atari.org.pl/forum/viewtopic.php?pid=220030#p220030

 

I have recorded some of the results of those experiments here: http://drac030.krap.pl/ay/

 

The *_ay.mp3 file is recorded from the original. The corresponding *_pokey.mp3 is the version played on the dual Pokey.

 

- envelopes from AY are ignored

I have built this player later into Let's Emu!, my ZX Spectrum 48k emulator. Since it cannot occupy the entire CPU time, such emulation is far from being exact, therefore the results very, from quite good to very bad.

The biggest loss are the envelopes. In a standalone player you could emulate a wide range of them, though.

 

Mono has written (but, as far as I know, has not released) a player which is able to synthesize the PSG chip and replay the sound on the available devices (e.g. on a single Pokey, or on a Covox, when available, or so). It also adapts the quality of the synthesis to the CPU speed, so it plays on a stock Atari, but the faster the CPU the result is better (on an Atari with the Rapidus the synth frequency is IIRC up to 64 kHz).

If you make some pressure on the author, he might consider officially releasing the program :)

Edited by drac030
  • Like 4

Share this post


Link to post
Share on other sites

Sounds good though I prefer you keep 8bit guys busy because it is coming to a point where it all seems so simply and automatically converted. You then don't need A8 musicians...

What's next? You get straight way to put A8 PMGs over ZXs hi-res gfxs and what about me? Will I be unemployed?

:grin:

:thumbsdown: maybe not and is :thumbsup:

 

My goal was to have sound effects ported, as I was not happy with sound effects I had in Pentagram and Gunfright. It looks that creating sound effects with current tools is not easy, as musicians want to do music, but not sound effects. Player for AY music is just a side effects of experiments with sound effects ;)

 

Personally, I'd prefer to have some original music in game like Exolon, as original music doesn't sound nice for me. But surely I'd like to have original sound effects in Exolon, as they sound really superb.

Share this post


Link to post
Share on other sites

P.s.- Hey, Hydrofool isn't on our long long list. Do you want me to have a look?

:)

 

Yes, please take a look. I like the game and I like Rob Hubbard's music in it (Warhawk and its music from Rob Hubbard was one of my favourites back in the day).

Share this post


Link to post
Share on other sites

Yes, the exact link to my post is this: http://www.atari.org.pl/forum/viewtopic.php?pid=220030#p220030

 

I have recorded some of the results of those experiments here: http://drac030.krap.pl/ay/

 

The *_ay.mp3 file is recorded from the original. The corresponding *_pokey.mp3 is the version played on the dual Pokey.

 

 

I have built this player later into Let's Emu!, my ZX Spectrum 48k emulator. Since it cannot occupy the entire CPU time, such emulation is far from being exact, therefore the results very, from quite good to very bad.

The biggest loss are the envelopes. In a standalone player you could emulate a wide range of them, though.

 

Mono has written (but, as far as I know, has not released) a player which is able to synthesize the PSG chip and replay the sound on the available devices (e.g. on a single Pokey, or on a Covox, when available, or so). It also adapts the quality of the synthesis to the CPU speed, so it plays on a stock Atari, but the faster the CPU the result is better (on an Atari with the Rapidus the synth frequency is IIRC up to 64 kHz).

If you make some pressure on the author, he might consider officially releasing the program :)

 

I would be happy to take a look at your code, if possible.

 

With the method I use (and I assume your method is similar), CPU overhead is very low, as it is just a matter of copying values (with some shifts applied), so this is very usable for emulator. My goal is actually to have sound effects played by Pokey and with such simple player, it will be possible to have it in recompiled game I believe.

 

I wonder which music actually use envelopes. It seems the ones I converted, do not use envelopes at all, and they sound really the same on Pokey (at least on emulators). Also, I am not a musicians, so I may be not aware of some differences here and there ;)

 

I hope mono will release his player, so we can hear perfect versions of AY music on Pokey. Although I am afraid it will be not usable in recompiled games or emulator, as it will take too much CPU time for synthesis, just like SID players do.

Share this post


Link to post
Share on other sites

 

I would be happy to take a look at your code, if possible.

 

I can send you it via PM. Maybe today later. But I doubt if you can take any bigger advantage out of that, as the tunes you converted sound well enough. The Cybernoid on your player sounds generally better than on mine, for example, with the sole exception that yours seems to "choke" from time to time, I do not know why.

 

As for which tunes use envelopes, some of those I recorded above do...

Share this post


Link to post
Share on other sites

Atari ST has YM2149 (Yamaha branded version of AY-3-8910). Atari ST got nice rendition of Jeroen Tel's Cybernoid 2 tune by Jochen Hippel (hear here:

).

 

I converted this tune to play with my player. You need 128KB Atari to play this, as tune is long.

 

Enjoy!

 

Technical details:

- I used sndh file from here: http://sndh.atari.org/sndh/sndh_lf/Mad_Max/Games/Cybernoid_2.sndh

- depacked sndh file with ice (Atari ST format) depacker from: https://github.com/DeaDBeeF-Player/deadbeef/tree/master/plugins/sc68/unice68

- written simple sndh player using Musashi 68000 core from: https://github.com/kstenerud/Musashi

- saved all values written to PSG registers, converting frequency values (Atari ST uses 2MHz clock for PSG, my player expects 1,79MHz)

- resulting Cybernoid_2.psg file attached (remove .bin extension). This file can be played with Ay_Emul.

Cybernoid_2.psg.bin

Cybernoid2(Jochen Hippel).xex

  • Like 4

Share this post


Link to post
Share on other sites

Since I am sharing the source code with OP, I can as well share the binary of my PSG player with everyone.

 

Just please remember that this particular version was never intended to run on anything besides my machine. So apart from Dual Pokey you will need Rapidus Accelerator or (since the program does not really require any CPU clock acceleration) Antonia with my OS. Also, a DOS which supports OSS CLI interface (like SpartaDOS). On Antonia, make "Linear on".

 

The plus side is that you can load and replay even very large PSG files with it without any conversions. The Cybernoid 2 PSG attached in the post above sounds very well under the player (to my ear, better than under OPs player, but that may be a question of taste).

bpsg.zip

  • Like 1

Share this post


Link to post
Share on other sites

Jochen Hippel......the guy who bought some of my arcade machines :)

 

Awesome bloke.

 

 

Would be pretty insane if POKEY could play Atari ST music ! :)

Share this post


Link to post
Share on other sites

I converted this tune to play with my player.

 

 

 

superb.

 

Amstrad: Barbarian

Atari ST: Ghost Battle !!!, Turrican II, Monkey Island

ZX Spectrum: Ghouls'n Ghosts, Target Renegade

 

:D

 

maybe music disc :DDD

Edited by xxl

Share this post


Link to post
Share on other sites

Some demonstration of the PSG player embedded in the Let's Emu!

 

 

(The same player code as in the post #13)

Edited by drac030
  • Like 5

Share this post


Link to post
Share on other sites

 

Yes, please take a look. I like the game and I like Rob Hubbard's music in it (Warhawk and its music from Rob Hubbard was one of my favourites back in the day).

Hellooo!....

Sent to Mariusz my idea/proposal.

Don't expect nor publish that Hydrofool is beeing converted to A8 because it can be but we/he have so many on the list and Hydrofoool is the last one.

I'll not/bettter not show you the possible in-game screen because that'll even if not come is trevious so if after, and then after, so many others is in the list you could expect loading screen:

post-6517-0-07943900-1508271700.png

Not much but is a true no DLIs GR.15 bitmap mode to be present while loading 4colour and to more via PMGs.

 

P.s.- No my friend Emkay and you know but you keep teeling and writing here...

Why people never got UWOL? NO and you did some screens and the music... Just because Gauntman disappeared and other I found/ask to complete like others want but no personal life time.

 

The same wayb that more than your always negative/down words I can say YES that Prince of Persia was going and not because your talkings that that way could never happen. It will or not but just because the one doinfg the code has or had ome personal life things that he had to make choices.

 

It's not because because of A8 it's just because of life... Do you have one?

Edited by José Pereira
  • Like 1

Share this post


Link to post
Share on other sites

Do you know why X:8 was nevr completed?

Just because some things in ours lifes happen. Some unexpected (X:8) and others because of life and choices (Prince of Persia)....

A8 is agreat machine and cycles/cpu has way to turn that.

GR.7 Emkay mode is great but isn't the the final dead option to all nor re that A8 will/would have/had only 3d or pseudo 3d like Rescue on Fractalus,... A8 can and could had but hadn't because of bad Atari promotions,... and the best we're her in 21st century.

 

Were A8 top we would have Double Dragon, Out Run,... Better or not than C64 is just shit wars... But I know how or maybe not...

The dream still present but for me I know and talk with others less one....

 

P.s.- Still donl't get untill today a way to do Turrican on A8 but has some nears ;) :grin:...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...