Page 1 of 1

ps2 audio

Posted: Thu Jun 29, 2006 6:40 am
by offonoffoffonoff
howdy all,

I've been looking for a while for some audio tutorials for the ps2.

http://forums.ps2dev.org/viewtopic.php?t=4122

In this thread, several people talk about making some tutorials, and there are excellent links to info on the spu (although i'm not very sure about exactly how similar the spu is to the spu2, small differances can be headaches when you don't know whats going on). Does anyone know if these tutorials got made and, if so, where i might find them? or, are there other tutorials?

there's many threads on using codecs and mp3 and what not, but I was wondering specifically about writing sounds out bit by bit to the buffer, and if the ps2 can add different sounds together for me (i would really think it should be able to), or if i need to do that before i write to the buffer.

also, are all the available audio libraries in the sdk? if not, where can i find others, and do you know of documentation for any of these?

lots of questions...

- 010010

Posted: Thu Jun 29, 2006 7:03 am
by jbit
Yeah, sorry, I still havn't got round to writing sound documentation (so much to cover, and I have other things to be doing). AFAIK there is no decent documentation or tutorial for doing sound on the PS2, though I may be wrong about this.
My tutorials (when done) will mainly cover in-game audio (playing samples for sound-fx, adding environmental effects, playing in-game music, etc), not really the kind of stuff you're talking about.

However, the SPU2 can mix upto 48 channels of ADPCM audio in hardware, ADPCM is a lossy compression of PCM, and PlayStation specific. The ADPCM format used is EXACTLY the same as that used on the PS1.
It can also output a few (four I think) 16bit 48KHz PCM single channel streams mixed in hardware, which sounds more like what you'd want.
You can also send data directly to the S/PDIF TOSLINK output on the back, which will probably allow you to output 32bit/192khz digital audio, but there's no "hardware" support for that, it's just a pass-through.

The audio libraries in ps2sdk can exploit pretty much all the features of the SPU2. ps2snd (written by me) gives relativly direct access to the SPU2 features, while others (audsrv, etc) offer simple PCM streaming and such.

Hope this helps a bit.

Posted: Thu Jun 29, 2006 2:37 pm
by Kojima
Sorry to interject but,
Are there any source examples of ps2sound?

and can you do custom sound fx by reading raw data to the spu2? (I.e so you can do echo, sound occlusion etc)

Posted: Fri Jun 30, 2006 2:21 am
by jbit
There are a couple of basic samples bundled with ps2sdk.
A while ago I wrote a little sound example program using ps2kit (which still isn't availible yet, sorry)
But the sound code doesn't use anything from ps2kit, so hopefully it might be some help anyway.
http://jbit.net/~jbit/SoundStuff-snapoff.tar.bz2
Is a link to the example.

Again, you won't be able to compile it right out of the box since it uses ps2kit, but it should give you at least an idea how to do sound. (the sound code just uses ps2snd)

I am still working on a nice sound tutorial, but I've recently been working on other stuff (writing a game for the compo), so it's not quite finished yet.

Posted: Fri Jun 30, 2006 6:21 am
by offonoffoffonoff
thanks jbit for the excellent reply.

I'll just mess around with ps2snd and wait for a tutorial. I'm sure it'll be awesome when it shows up but i understand what its like to be busy.

My goal is to beable to construct musical sounds and sound effects using dsp algorithims, adapting in real time to whatever is going on in the program. It sounds like ps2snd will work for this. Mixing four pcm channles would be very helpful and i'll have to see exactly how crappy the adpcm is, as that might work for somethings also.

If i get it working I'll make a simple karplus-strong plucked string tutorial, because i agree there isn't adequate documentation of the audio stuff. no promises though.

thanks again,

-010 010