Desperation about Sounds/SPU
Posted: January 9th, 2020, 8:07 am
Hey again xO
slowly I start to feel really bad about constantly asking stuff about PSYQ, seems like I'm the only one having those questions...
However, I'm close to giving up so I thought I could ruin my non existing reputation by asking my questions.
After I learned a bit about rendering, I thought it would be a great moment to start experimenting with sounds - but I'm completely overwhelmed with everything right now!
I actually wanted to just play some music and some SFX - but I found a jungle of file formats. My first entry point was actually "Orions Website", there he wrote:
"On the Playstation, the Sound format is called VAG, it's a compressed sound format, and you only have 512Kbytes of space for compressed sound.
To convert a WAV to VAG, you can use a tool called VAGedit. It's pretty straightforward to use."
Okay! Seems easy! So I loaded some random .wav file and created two ~4MB .vag files >_> Yeah... Well I thought, no big deal - I can stream the music from the disk... right? So I started to search through the PSYQ samples for a tutorial how to handle .VAG files. And even though I found an folder with .VAG files, they were NEVER used! Instead they used .VAB, .VH and .VB files who seem to be related to each other. Sooo after problems with the VABTOOL and some research I ran over the thread "[Tutorial] Converting MIDI + Samples to SEQ + VAB" from ArthCarvalho. Which made things even worse for me... I still have no idea how .VAG integrates into .VAB - as I understood, I design an instrument with the .VAG files, load multiple of them into the .VAB file and... Confusion... I simply wanted to stream my oversized .VAG file...
So I kept searching and encountered the thread "VAG Example (VAG DEMO)" from Shadow. So I looked into that code and - yeah! Loading .VAG files but... dang! His .VAG file was small enough to fit the 512KB, also I didn't understood what it is about those multiple channels. So I looked into Orions code how he handles the .VAG files. I saw a lot of similarities to Shadows example, but he wrote stuff like:
u_long size = (adrs[12] << 24) | (adrs[13] << 16) | (adrs[14] << 8) | adrs[15];
u_short freq = (adrs[18] << 8) | adrs[19];
Where adrs was the address of the .VAG file - how did he knew those values? Also I read the the first 16bytes of VAG files must be 0 - so how can he read a size from this? Max confusion!
Last thing I found was the "XMPlay Example + Tools" by zeroZshadow. But what on earth are xm files and how do I generate them?
Now I sit here, and I'm confused as all hell...
The only thing I seem to understand is, that I could be happy with .VAG files smaller then 512KB, but... I still don't get the thing with the multiple channels and how to playback bigger files and stuff...
Maybe I stream my big file into a 512KB buffer and do a SpuWrite? But how do I know it is time to read next? Also... If I fill the 512KB Sound RAM, how could I also play SFX when they are also .VAG?
My gut feeling tells me that .VAB files would be good for SFX buuuut... I'm confusion.
I'm not sure if this reflects my desperation :/ I really feel lost but honestly, I don't want to drop PSX development because of this... It is to interesting to just quit like that :/
Also sorry if this question is dumb.
slowly I start to feel really bad about constantly asking stuff about PSYQ, seems like I'm the only one having those questions...
However, I'm close to giving up so I thought I could ruin my non existing reputation by asking my questions.
After I learned a bit about rendering, I thought it would be a great moment to start experimenting with sounds - but I'm completely overwhelmed with everything right now!
I actually wanted to just play some music and some SFX - but I found a jungle of file formats. My first entry point was actually "Orions Website", there he wrote:
"On the Playstation, the Sound format is called VAG, it's a compressed sound format, and you only have 512Kbytes of space for compressed sound.
To convert a WAV to VAG, you can use a tool called VAGedit. It's pretty straightforward to use."
Okay! Seems easy! So I loaded some random .wav file and created two ~4MB .vag files >_> Yeah... Well I thought, no big deal - I can stream the music from the disk... right? So I started to search through the PSYQ samples for a tutorial how to handle .VAG files. And even though I found an folder with .VAG files, they were NEVER used! Instead they used .VAB, .VH and .VB files who seem to be related to each other. Sooo after problems with the VABTOOL and some research I ran over the thread "[Tutorial] Converting MIDI + Samples to SEQ + VAB" from ArthCarvalho. Which made things even worse for me... I still have no idea how .VAG integrates into .VAB - as I understood, I design an instrument with the .VAG files, load multiple of them into the .VAB file and... Confusion... I simply wanted to stream my oversized .VAG file...
So I kept searching and encountered the thread "VAG Example (VAG DEMO)" from Shadow. So I looked into that code and - yeah! Loading .VAG files but... dang! His .VAG file was small enough to fit the 512KB, also I didn't understood what it is about those multiple channels. So I looked into Orions code how he handles the .VAG files. I saw a lot of similarities to Shadows example, but he wrote stuff like:
u_long size = (adrs[12] << 24) | (adrs[13] << 16) | (adrs[14] << 8) | adrs[15];
u_short freq = (adrs[18] << 8) | adrs[19];
Where adrs was the address of the .VAG file - how did he knew those values? Also I read the the first 16bytes of VAG files must be 0 - so how can he read a size from this? Max confusion!
Last thing I found was the "XMPlay Example + Tools" by zeroZshadow. But what on earth are xm files and how do I generate them?
Now I sit here, and I'm confused as all hell...
The only thing I seem to understand is, that I could be happy with .VAG files smaller then 512KB, but... I still don't get the thing with the multiple channels and how to playback bigger files and stuff...
Maybe I stream my big file into a 512KB buffer and do a SpuWrite? But how do I know it is time to read next? Also... If I fill the 512KB Sound RAM, how could I also play SFX when they are also .VAG?
My gut feeling tells me that .VAB files would be good for SFX buuuut... I'm confusion.
I'm not sure if this reflects my desperation :/ I really feel lost but honestly, I don't want to drop PSX development because of this... It is to interesting to just quit like that :/
Also sorry if this question is dumb.