Can you Convert Aif/Wav to .ADP? (Saturn XA Adpcm)

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

LackofTrack

New Member
Joined
Mar 31, 2018
Messages
4
Points
3
Hello!
I'm trying to mod Sonic Jam and replace it's music for the Genesis games. The format the music is in though is .ADP. Is there a way to convert Aif or Wav files to .ADP files? From what I've gathered it seems Adp files are just AIFF files with XA audio encoded with in them but I can't find any program that can will allow me to do that. The closest I got was with the Sega Adpcm encoder for Mac but that program doesn't write a AIFF header or Fliter values, just raw xa audio which Sonic Jam does not like.
 

XL2

Member
Joined
Jul 5, 2017
Messages
190
Points
43
Age
34
I'm interested in knowing too.
What is the header like?
Perhaps we could just write a small program to add the header to the file.
I didn't get the tone editor to work as it doesn't seem to recognize the aif files.
What did you use to create them?
I know that modern aif is in little endian while old Macs and the Saturn use big endian, but I can't even try to load it.
 

LackofTrack

New Member
Joined
Mar 31, 2018
Messages
4
Points
3
The header of an ADP file looks to be a standard AIFF header except it has the tag "APCM". Besides that it seems to be regular XA audio. Here is a page I found about someone adding support for it to FFmpeg. https://patchwork.ffmpeg.org/patch/7100/
I don't think writing a header only will work because when I tryed to copy a header over using a hex editor the song would play but, it would have tons of static over the actual song. Looking over different sites this seems to be a common problem with XA files that don't have any filters within them.

For making AIFF files the process was really simple for me. I just used a program called audacity and converted wav files to Aiff. Saturn games that use AIFF files seem to work just fine with them. I don't know about the tone editor though.
 

XL2

Member
Joined
Jul 5, 2017
Messages
190
Points
43
Age
34
The header of an ADP file looks to be a standard AIFF header except it has the tag "APCM". Besides that it seems to be regular XA audio. Here is a page I found about someone adding support for it to FFmpeg. https://patchwork.ffmpeg.org/patch/7100/
I don't think writing a header only will work because when I tryed to copy a header over using a hex editor the song would play but, it would have tons of static over the actual song. Looking over different sites this seems to be a common problem with XA files that don't have any filters within them.

For making AIFF files the process was really simple for me. I just used a program called audacity and converted wav files to Aiff. Saturn games that use AIFF files seem to work just fine with them. I don't know about the tone editor though.
So using audacity worked? I thought modern AIFF was always little endian.
Did you have to use special options?
And do you think you can try to use it with the tone editor?
 

LackofTrack

New Member
Joined
Mar 31, 2018
Messages
4
Points
3
No special options were used. I just set it to export a 16Bit AIFF file but, I'm pretty sure 8Bit will work too.
I'll see if tone editor will accept the Aiff file.
 
  • Like
Reactions: XL2

Ms. Tea

New Member
Joined
Feb 15, 2016
Messages
42
Points
18
Age
34
The header of an ADP file looks to be a standard AIFF header except it has the tag "APCM". Besides that it seems to be regular XA audio. Here is a page I found about someone adding support for it to FFmpeg. https://patchwork.ffmpeg.org/patch/7100/
I don't think writing a header only will work because when I tryed to copy a header over using a hex editor the song would play but, it would have tons of static over the actual song. Looking over different sites this seems to be a common problem with XA files that don't have any filters within them.
That's my patch. :) Unfortunately FFmpeg doesn't have support for encoding XA ADPCM, so I haven't spent any time at looking at adding support for muxing it.
 

LackofTrack

New Member
Joined
Mar 31, 2018
Messages
4
Points
3
XL2 I think I know why the Sega Tone Editor wasn't accepting your files. I think it has to do with the size of the Aiff file. When I tried to put in a mono 12 second file at 22050hz it wouldn't take the file but, when I put in a mono 1 second file at 16000hz it accepted it just fine. You might have lower the sample rate of your Aiff files and make sure there VERY short.

So you did create that patch Ms.Tea! I knew the submitter name seemed familiar:laugh:.

As For encoding Xa audio Aiff files I found some more information about different formats of them. Here's a few quotes from the SBL Program Library User's Guide 3.
Three Types of File Formats
(1) AIFF format (uncompressed PCM)
(2) CD-ROM XA audio format (ADPCM compression)
(3) User-specified ADPCM format (OptImage Interactive Services AudioStack file output format)
Notes:
(1) The “user-specified ADPCM format” refers to the data file format output by an AIFF to ADPCM file converter utility called AudioStack by OptImage Interactive Services
I think this is the Program Sonic Team (and other developers too perhaps) used to convert Aiff files to XA ADPCM audio but, I can't find any information on the program.
 

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,225
Points
63
Age
43
why don't you use the sega adpcm encoder, i've just tried it and it worked well, aiff size was 1.2mb, the adpcm size is around 300kb
upload_2018-4-2_3-16-55.png

upload_2018-4-2_3-18-41.png
 

XL2

Member
Joined
Jul 5, 2017
Messages
190
Points
43
Age
34
XL2 I think I know why the Sega Tone Editor wasn't accepting your files. I think it has to do with the size of the Aiff file. When I tried to put in a mono 12 second file at 22050hz it wouldn't take the file but, when I put in a mono 1 second file at 16000hz it accepted it just fine. You might have lower the sample rate of your Aiff files and make sure there VERY short.

So you did create that patch Ms.Tea! I knew the submitter name seemed familiar:laugh:.

As For encoding Xa audio Aiff files I found some more information about different formats of them. Here's a few quotes from the SBL Program Library User's Guide 3.




I think this is the Program Sonic Team (and other developers too perhaps) used to convert Aiff files to XA ADPCM audio but, I can't find any information on the program.
Thanks.
I managed to read the files simply by using another Mac emulator.
So now I got the tone editor to work, I must figure out how to generate sequences and how to read the files!
 

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,225
Points
63
Age
43
Thanks.
I managed to read the files simply by using another Mac emulator.
which one are you using, basilik 2 is working well, i had some bad behavior/trouble before finding the right settings :

upload_2018-4-2_11-4-2.png
 

XL2

Member
Joined
Jul 5, 2017
Messages
190
Points
43
Age
34
which one are you using, basilik 2 is working well, i had some bad behavior/trouble before finding the right settings :

View attachment 4545
Yes, I also switched to Basilisk and it works fine.
I just need to figure out how to use the tone banks now.
 

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,225
Points
63
Age
43
(bump) anybody tried to play ADPCM files (best with sbl lib) on saturn ?
does it costs some speed on SH2 to decompress file ?
 

Ponut

New Member
Joined
Feb 19, 2018
Messages
34
Points
8
Age
24
In my experiments, I never managed to get SGL or SBL to play the ADPCM files.
I could get the stream and sound system to report no errors, but no sound would play.

I COULD get it to play the ADPCM files as uncompressed PCM, but doing so obviously produced garbage (it did not decompress it).
I know this doesn't help you, but my understanding is that the ADP library that we have available is either broken or in dire need source code to look over and understand.

If I had any guess for their usage, you probably need to decipher the ADP_DecMono and/or ADP_DecStereo commands to figure out where they send the decompressed audio (somewhere in sound memory). Then use SND_PCM_ON with that area of memory as the target. You could scroll through sound memory 16 KB at a time to try and find out where it is, if it even works.

The object code for the Saturn ADP library is for the SH2s, so those are unquestionably what would handle the decompression.

There are ADP decompression/playback libraries for M68K family processors out there, if you understood how to integrate that into the sound driver (assembly), you would probably have an easier time than deciphering the ADP library.
 
Last edited:
Top