Jump to content
Synthpopalooza

SAP format .... tips needed

Recommended Posts

So, I was wondering if there were any tools available to tweak SAP audio files ...

 

In particular, this one ... I have the .xex and .asm source, and I used Altirra to render .sap, but it doesn't carry over the SKCTL two tone mode I used in the tune.  Is there any way of fixing this?  I was thinking about putting some of my experiments up on the SAP archive.

 

 

zanac.asm zanac.s zanac.sap zanac.xex

Share this post


Link to post
Share on other sites

Not with SAP type R. A Type R file only contains samples of AUDC1-4, AUDF1-4, and AUDCTL. It doesn't capture the SKCTL writes needed for two-tone mode.

 

Share this post


Link to post
Share on other sites

OK, one other question ... is it possible to edit the AUDFx data in the file?  Some of my musics have 0 frequency whining that I'd like to change to silences.

Share this post


Link to post
Share on other sites
1 hour ago, Synthpopalooza said:

OK, one other question ... is it possible to edit the AUDFx data in the file?  Some of my musics have 0 frequency whining that I'd like to change to silences.

Yes, it's easy to do in a SAP type R file. After the blank line is just a raw dump of $D200-D208 values per frame, so you can easily check the AUDF1 value and kill the corresponding AUDC1 volume when it is 0. Just search for the first instance of $0D/$0A/$0D/$0A in the file and then read/write the remainder of the file as an 9xN byte array.

 

Share this post


Link to post
Share on other sites

one other thing .. in the code where the screen gets turned black, can a LDA $8B STA SKCTL be hacked in?

Share this post


Link to post
Share on other sites

You can use ASAP player to export the original RMT/CMC/. .. for editing

Share this post


Link to post
Share on other sites

I was also wondering:  Maybe there needs to he an extension to the SAP format, maybe an SKCTL tag, if this is active, the host player can then set SKCTL.  Then it would be down to getting the SAP players to support this feature.

Share this post


Link to post
Share on other sites
Posted (edited)

AFAIK there is no SAP player that supports SAP-R. Altirra can play them and dmsc's SAP-R compressor can read them and turn them in an .xex file. Not other programs are aware of SAP-R yet.

 

When I first added SAP-R recording to atari800, I considered adding SKCTL, but decided against it because it wasn't in the spec. But neither was stero recording, IIRC.

 

Perhaps a header field can be added that specifies how many values there are per line, i.e. 9 or 18 for normal SAP-R, and 10 or 20 for files that need SKCTL.

 

Edited by ivop

Share this post


Link to post
Share on other sites

Would be great if Altirra supported dmsc's compression format, and stereo. It seems easy enough to add but @phaeron probably has an already long list of other features to implement... ? Not sure if he's interested in adding code from other people in Altirra?

 

2 hours ago, ivop said:

Perhaps a header field can be added that specifies how many values there are per line, i.e. 9 or 18 for normal SAP-R, and 10 or 20 for files that need SKCTL.

 

It looks like @Synthpopalooza only changes SKCTL at the start of the tune, not sure if it's worth saving it once per frame ? ( I have no idea what SKCTL does )

Share this post


Link to post
Share on other sites

SKCTL is serial control.  Default value is $03. but writing $8B to it engages two tone mode.  This normally is used for cassette I/O (CSAVE, CLOAD, etc.) but has musical applications.  In $Ax distortion,  you silence first channel and play the second one.  First channel is the frequency carrier and the second modulates the frequency.  The result is a pseudo pulse wave with variable width.

 

In my usage, SKCTL is set once.  But there is theoretically the possibility of turning on and off two tone throughout the tune, I suppose.

  • Like 1

Share this post


Link to post
Share on other sites

Also:

 

Most of my usage has been with SKCTL using $Ax distortion, which I have reasonably good documentation for.   I did a demo tune using $4x SKCTL, which has a whole bunch of random distorted guitar timbres, but I haven't fully documented all the settings yet.

Share this post


Link to post
Share on other sites

I had been using Altirra to do the recordings.  I use a custom routine for sound playback and unsure how that converts into normal SAP usage. 

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, Synthpopalooza said:

I had been using Altirra to do the recordings.  I use a custom routine for sound playback and unsure how that converts into normal SAP usage. 

Oh, if that's your concern, you can just encapsulate your 6502 binary player routine in a normal SAP file. Specify INIT and PLAY in the header and you're good to go. Depending on the player, SKCTL and the rest of Pokey will be emulated properly.

 

Edit: and with asapconv you can convert it to an xex file and replay it on better emulators than the SAP players, or on real hardware.

Edited by ivop

Share this post


Link to post
Share on other sites
3 hours ago, rensoup said:

Would be great if Altirra supported dmsc's compression format, and stereo.

It does. Dmsc's compression tool results in an xex file, which includes the decompressor and player.

 

If I'm not mistaken, Altirra also records stereo SAP-R files, 18 registers per VB.

 

Share this post


Link to post
Share on other sites
Posted (edited)
26 minutes ago, ivop said:

It does. Dmsc's compression tool results in an xex file, which includes the decompressor and player.

 

If I'm not mistaken, Altirra also records stereo SAP-R files, 18 registers per VB.

 

I meant if Altirra supported converting to LZSS directly because it would hopefully favor its adoption...

 

Last time I tried it didn't support recording in stereo, I think Phaeron mentioned it being non standard (not sure anymore...)

 

Unrelated question: Would a 50hz stereo recording played at 100hz in mono sound atrocious generally ?

 

Edited by rensoup

Share this post


Link to post
Share on other sites
Posted (edited)
14 minutes ago, rensoup said:

I meant if Altirra supported converting to LZSS directly because it would hopefully favor its adoption...

Ah, misunderstanding. Would be great indeed if Altirra converted a SAP-R recording directly to an LZSS compressed xex including decompressor and player.

 

14 minutes ago, rensoup said:

Last time I tried it didn't support recording in stereo, I think Phaeron mentioned it being non standard (not sure anymore...)

I think that is correct. What I said five hours ago, the original SAP-R description did not include stereo recording.

 

But I implemented it in atari800 anyway:

	-pokeyrec                  Enable Pokey registers recording
	-pokeyrec-interval <n>     Sampling interval in scanlines (default: 312)
	-pokeyrec-ascii            Store ascii values (default: raw)
	-pokeyrec-file <filename>  Specify output filename (default: pokeyrec.dat)
	-pokeyrec-stereo           Record second Pokey, too (default: mono)

These options don't result in a SAP-R .sap file right away. You need to add the header by yourself.

 

-pokeyrec-interval was meant to also record 2x, 3x or 4x speed players, and the same for NTSC (262 == 1x), et cetera.

 

Edited by ivop
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
4 hours ago, Synthpopalooza said:

I had been using Altirra to do the recordings.  I use a custom routine for sound playback and unsure how that converts into normal SAP usage. 

SAP is the routine. SAP is basically XEX. Turning XEX into SAP is adding a header, and sometimes removing stuff not needed for music. There is no need to use SAP-R only because you use custom routine. Of course, you can still use something which is not supported in SAP players. But so far I haven't find anything. For example my IRQ bass works fine in SAP players, even if it doesn't run at all in Atari800 family emulators.

 

Read the documentation I linked, and you should be able turn your XEX into SAP easily. If you have XEX for example exported from RMT, I suggest using SAP-D, as you simply set entry point. SAP-A requires you to have Init routine and Play routine, which is also simple to do, but SAP-D is even simpler.

Edited by R0ger

Share this post


Link to post
Share on other sites

Here is example of simplest possible SAP header, AFAIK, and resulting SAP. Should be good starting point.

 

ahead.sap sap.txt

  • Thanks 1

Share this post


Link to post
Share on other sites

Indeed, tried to redo one of them myself .. same result. I'm using foobar SAP plugin. You simply went too far 🙂

Share this post


Link to post
Share on other sites

This is actually a bug in Altirra. The OS ROM isn't available in SAP files, and the reason you're crashing in the SAP players is due to the use of XITVBV. The reason why you're able to do this in Altirra, though, is that your executable has INIT/RUN vectors in it, which is also not supported in SAP but in Altirra prevents the type D player stub from running. The type D player stub normally sets up a proper SAP-like environment with RAM at $D800-FFFF, a title screen, and invokes the player VBI at the proper 50/60Hz rate regardless of whether the system is NTSC or PAL.

 

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...