Synthpopalooza Posted July 31, 2020 Share Posted July 31, 2020 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 Quote Link to comment Share on other sites More sharing options...
phaeron Posted July 31, 2020 Share Posted July 31, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
phaeron Posted July 31, 2020 Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 one other thing .. in the code where the screen gets turned black, can a LDA $8B STA SKCTL be hacked in? Quote Link to comment Share on other sites More sharing options...
+JAC! Posted July 31, 2020 Share Posted July 31, 2020 You can use ASAP player to export the original RMT/CMC/. .. for editing Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
ivop Posted July 31, 2020 Share Posted July 31, 2020 (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 July 31, 2020 by ivop Quote Link to comment Share on other sites More sharing options...
rensoup Posted July 31, 2020 Share Posted July 31, 2020 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 ) Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
R0ger Posted July 31, 2020 Share Posted July 31, 2020 (edited) So why SAP-R ? Why you can't use normal SAP ? Good documentation is here: http://asap.sourceforge.net/sap-format.html Edited July 31, 2020 by R0ger Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted July 31, 2020 Author Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
ivop Posted July 31, 2020 Share Posted July 31, 2020 (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 July 31, 2020 by ivop Quote Link to comment Share on other sites More sharing options...
ivop Posted July 31, 2020 Share Posted July 31, 2020 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. Quote Link to comment Share on other sites More sharing options...
rensoup Posted July 31, 2020 Share Posted July 31, 2020 (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 July 31, 2020 by rensoup Quote Link to comment Share on other sites More sharing options...
ivop Posted July 31, 2020 Share Posted July 31, 2020 (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 July 31, 2020 by ivop 1 Quote Link to comment Share on other sites More sharing options...
R0ger Posted July 31, 2020 Share Posted July 31, 2020 (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 July 31, 2020 by R0ger Quote Link to comment Share on other sites More sharing options...
R0ger Posted July 31, 2020 Share Posted July 31, 2020 Here is example of simplest possible SAP header, AFAIK, and resulting SAP. Should be good starting point. ahead.sap sap.txt 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted August 1, 2020 Author Share Posted August 1, 2020 OK, I think I did it ... These are three examples I did using SKCTL=$8B Very curious as to whether they play properly in other SAP players (probably not) ... but I'd wager they will play on real HW. marioworld.sap marioworld1.sap dkc-briarpatch.sap Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted August 1, 2020 Author Share Posted August 1, 2020 And this one too. Noticing that the ASAP player doesn't like these ... but they seem to boot ok in Altirra. worldrunner.sap Quote Link to comment Share on other sites More sharing options...
R0ger Posted August 1, 2020 Share Posted August 1, 2020 Indeed, tried to redo one of them myself .. same result. I'm using foobar SAP plugin. You simply went too far ? Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted August 1, 2020 Author Share Posted August 1, 2020 (edited) Well, everybody's just gotta catch up with us now, right? Edited August 1, 2020 by Synthpopalooza Quote Link to comment Share on other sites More sharing options...
phaeron Posted August 1, 2020 Share Posted August 1, 2020 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. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted August 1, 2020 Author Share Posted August 1, 2020 So would scooping out the VBI code fix this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.