ADPCM

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
Christuserloeser
Moderator
Moderator
Posts: 5948
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Aug 28, 2003 12:16 am
Location: DCEvolution.net
Has thanked: 10 times
Been thanked: 0
Contact:

ADPCM

Post by Christuserloeser »

So, Dreamcast's AICA supports hardware ADPCM. - Are there free codecs available that actually use this feature ?

I thought Beats of Rage did, but appearently it's a software codec.


Edit - Interesting post by BlueCrab:

viewtopic.php?p=1004962#p1004962
BlueCrab wrote:ADPCM files are just .wav files that have been encoded a different way, and KOS' built-in sound functions can play them (see the sfxmgr.h file in KOS for how to use them).
- Could this codec be used to stream BGM too ?
Insane homebrew collector.
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has thanked: 0
Been thanked: 0

Re: ADPCM

Post by Ex-Cyber »

I don't know about the KOS/Dreamcast side of things, but in general it can be used for music. It's lossy, but if the bitrate is high enough it's pretty listenable anyway. Lots of console games use ADPCM for music.
Guaripolo
DCEmu Freak
DCEmu Freak
Posts: 89
Joined: Mon Jul 28, 2008 10:04 am
Has thanked: 0
Been thanked: 0

Re: ADPCM

Post by Guaripolo »

there's a wav2adpcm utility in kos (directory "utils"), i haven't tested enough, but seems to work. It converts a 16 bits RIFF wave to the specific Yamaha ADPCM that Dreamcast uses.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: ADPCM

Post by BlueCrab »

Christuserloeser wrote:Edit - Interesting post by BlueCrab:

viewtopic.php?p=1004962#p1004962
BlueCrab wrote:ADPCM files are just .wav files that have been encoded a different way, and KOS' built-in sound functions can play them (see the sfxmgr.h file in KOS for how to use them).
- Could this codec be used to stream BGM too ?
You could use the built-in ADPCM support for Background music, but in general something more suitable to background music, like Ogg Vorbis will take up a lot less space. Also, the support in KOS for ADPCM files is more based around doing one-off things, like sound effects, but it could be hacked up to doing full background music if one really wanted to (but as I said, you'd be much better off using Ogg Vorbis for background music anyway).
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: ADPCM

Post by BlackAura »

If space is a bigger concern that CPU time, something like MP3 or Ogg Vorbis is better. If CPU time is a bigger concern than space, you might has well just use CD-quality .WAV files and stream those - at least they'll sound better.

There is an ADPCM encoder in KOS. It works reasonably well (nxDoom used it to cram all of Doom's sound effects into the 2MB of available SRAM), but I'm not entirely convinced that it's correct - the sounds it generates sound noticeably poorer on a Dreamcast than they do with the included software decoder.
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Re: ADPCM

Post by OneThirty8 »

I would go with Ogg like the others said, but if you want to use ADPCM for background music, you could just make a modified version of kos/kernel/arch/dreamcast/sound/snd_stream.c to do the job. It wouldn't be hard at all--the biggest things to change would be in:

Code: Select all

int snd_stream_poll(snd_stream_hnd_t hnd)
The number of bytes it looks for is wrong if you're using ADPCM. Other than that, as long as the sound hardware knows the correct format, you should be able to just feed samples to the sound hardware and have it play.

In response to BlackAura's comment on whether the ADPCM wav files generated by wav2adpcm are totally correct... is this the same ADPCM format as ADX audio? If so, the code that does the conversion in bero's wav2adx/adx2wav is similar but different.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: ADPCM

Post by BlackAura »

OneThirty8 wrote:In response to BlackAura's comment on whether the ADPCM wav files generated by wav2adpcm are totally correct... is this the same ADPCM format as ADX audio? If so, the code that does the conversion in bero's wav2adx/adx2wav is similar but different.
I've no idea. If you run it through a round-trip (encode, then decode), the result sounds fine, but the encoded file doesn't sound quite right on a Dreamcast.
Post Reply