deadbeef icon indicating copy to clipboard operation
deadbeef copied to clipboard

GME: Can't play certain SAP files correctly, requires a new plugin using libASAP

Open wolfensg opened this issue 7 years ago • 22 comments

Atari SAP support seems to be handled by the port of outdated sources. While using the players based on older sources I've seen issues like the ones with these example files (attached). They either get skipped or only part of the channels are being played.

Issues on older sourecs: Alley Kat.sap - not playable Humanoid.sap - not playable Das Omen Intro.sap - digitalized percussion missing

Zipped sap files.zip

wolfensg avatar Apr 13 '17 14:04 wolfensg

@kode54 this issue seems to be valid. I don't have foobar2000 at hand right now (will have next week), would be nice if you can have a look, if it's interesting to you.

The issue is not a regression, just seems that GME can't play these 3 files correctly.

@wolfensg can you provide an example of an app / library that plays these files correctly? We might be able to find the necessary patches.

Oleksiy-Yakovenko avatar Apr 20 '17 18:04 Oleksiy-Yakovenko

Sure. ASAP seems to be most compatible with all sap files (there are also sources available):

http://asap.sourceforge.net/

Although humanoid.sap seems to be working only on an old winamp plug-in I have. But anyway ASAP is the best choice so far. There should be also some more .sap files which seems to be not playing correctly under current implementation provided by the GME plugin but these are the ones I just grabbed as I knew already that they are 'problematic' ones and I had some issues with them before :)

wolfensg avatar Apr 20 '17 18:04 wolfensg

Game_Music_Emu also plays SAP files, but requires Coleco firmware for files targeting that machine.

kode54 avatar Apr 21 '17 00:04 kode54

Why should it require Coleco Vision firmware as it is totally unrelated (totally different machine)?

SAP (in short) is similar to SID format that contains the music data from Atari 8-bit computers (XL/XE series) in the form of either the memory dump from a game/demo or a music in native format (like Chaos Music Composer, CMC format) encapsulated with some player related information and header with some text info about who was the composer, title, etc.

In order to be played in a player it requires the emulation of the MOS 6502C CPU and POKEY chip.

So in short - the SAP is for Atari the same as SID is for C64. There is also a library (inspired by the Commodore's HVSC) called ASMA which contains most of the Atari tunes.

Links: http://asma.atari.org/ http://www.hvsc.c64.org/

wolfensg avatar Apr 21 '17 04:04 wolfensg

@kode54 you confused it with SGC? I can't seem to find any way to specify a firmware for SAP emu.

Oleksiy-Yakovenko avatar Apr 21 '17 08:04 Oleksiy-Yakovenko

Oops, yeah, I guess you're right.

kode54 avatar Apr 21 '17 18:04 kode54

SAP Emu (if requires one) could require the same "firmware" as the ROM for Atari800 emulator:

https://sourceforge.net/projects/atari800/files/ROM/Original%20XL%20ROM/

wolfensg avatar Apr 26 '17 05:04 wolfensg

@wolfensg the problem is that I can't seem to find a way to load any custom ROM into Sap Emu of GME.

Oleksiy-Yakovenko avatar Apr 26 '17 07:04 Oleksiy-Yakovenko

@Alexey-Yakovenko any way of switching plugin for SAP emulation from GME to ASAP?

wolfensg avatar Apr 26 '17 07:04 wolfensg

Someone would have to develop a new plugin for ASAP.

Oleksiy-Yakovenko avatar Apr 26 '17 07:04 Oleksiy-Yakovenko

btw, I just checked, the provided SAP files behave exactly the same in foobar2000 + foo_gep.

Oleksiy-Yakovenko avatar Apr 26 '17 07:04 Oleksiy-Yakovenko

So I guess most of the plugins share outdated sources for SAP emulation :) http://asap.sourceforge.net/ which I've mentioned already contains also the source code but creating new plug-in seems to be far out of scope for DeadBeef.

wolfensg avatar Apr 26 '17 08:04 wolfensg

You just mentioned, that even ASAP can't play Humanoid.sap, so developing a new plugin for fixing playback of one file seems like an overkill... We should first consider fixing GME.

Oleksiy-Yakovenko avatar Apr 26 '17 08:04 Oleksiy-Yakovenko

Well, I only gave 3 examples (unfortunately only 2 were valid). Anyway - there are quite a few songs not being played correctly with this GME plugin.

I can give more examples and upload them here but I wonder if this makes sense.

Its not however that GME plugin does not play the files at all but it has some problems in c/a 5% of files (at least from my favourites ;).

Issues include missing samplings, inability to start playback at all, missing playback on one of four generated channels or sound artifacts during playback (high pitched noise on one song which I briefly checked).

wolfensg avatar Apr 26 '17 08:04 wolfensg

I looked a bit into ASAP library, and it looks that such plugin would bring more value than just SAP playback fix, because of the many file formats it supports. I'll consider this for the future (fairly busy with other stuff for now)

Oleksiy-Yakovenko avatar Apr 26 '17 09:04 Oleksiy-Yakovenko

Worth mentioning - the ASAP library supports (via SAP container) various Atari native formats like CMC being a song saved in Chaos Music Composer on Atari 8-bit computer.

wolfensg avatar Apr 26 '17 09:04 wolfensg

I've made some research and it seems there are two widely used libraries for providing support for SAP files.

  1. ASAP
  2. libSAP

The first one is the one I've mentioned so far and provides nearly 100% accurate emulation (with some minor flaws depending on version of the sources and complete inability to play humanoid.sap file ;) (maybe some other files as well but not really often having much problems)

libSAP has two "widely available" versions: 1.54 and 2.0 Unfortunately version 1.54 is not compatible with GNU PL and cannot be used. Version 2.0 does not include any license thus also... should not be used... To make things even more complex... It seems the sources were removed and available only via... archive.org Also it doesn't help much that players based on libSAP 2.0 works flawlessly ( playing all files correctly, including also humanoid.sap, etc) :(

Example of the player working with libSAP 2.0: SAP player v2.0 - http://asma.atari.org/bin/sap2.zip (Windows)

Source for information on SAP libraries (in this case for compiling DOSSAP): http://dossap.sourceforge.net/index_pl.html

wolfensg avatar May 05 '17 11:05 wolfensg

I wasn't able to find any working link to the libSAP source code..

Oleksiy-Yakovenko avatar May 05 '17 11:05 Oleksiy-Yakovenko

Funny fact. There are couple of SAP tunes which are only possible to be played under ASAP library, the reason is that they utilize the... graphics chip (GTIA) to produce the audio (I know how weird it sounds ;). Atari SAP 1-bit GTIA tunes.zip

Example how it should sound: https://www.youtube.com/watch?v=gqGOjyOWCMs

Information about using GTIA graphics chip to play sound: http://atariage.com/forums/topic/212810-tritone-gtia-beeper-engine/

wolfensg avatar May 05 '17 11:05 wolfensg

Sooo... summing up:

  1. ASAP library provides quite accurate support for most SAP files. Provides also support (at least newest ones) for 1-bit songs played originally on GTIA graphics chip (very rare songs ;)
  2. libSAP provides support for all standard SAP files. Does not support SAP files utilizing the GTIA graphics chip to play audio.

The first one has sources available (but would involve some work to prepare the plug-in). The second one (libSAP) does not have sources available (at least not easily google-able).

Current level of SAP support in DeadBeef is quite satisfactory (but I don't know on which sources GME plug-in is based... I could assume that either older ASAP library or older libSAP.

In this case... well... I guess it's a dead-end for better SAP support...

wolfensg avatar May 05 '17 11:05 wolfensg

but I don't know on which sources GME plug-in is based... I could assume that either older ASAP library or older libSAP

From what I can see, there are no references to either ASAP or libSAP in GME sources, so I'm assuming it's not derived from them.

Oleksiy-Yakovenko avatar May 05 '17 13:05 Oleksiy-Yakovenko

(the code looks very different from libASAP too)

Oleksiy-Yakovenko avatar May 05 '17 13:05 Oleksiy-Yakovenko