Needed Help With VAG Playback!

Post a topic about yourself to let others know your skills, hobbies, etc.
Post Reply
HectyHector
What is PSXDEV?
What is PSXDEV?
Posts: 3
Joined: Jan 30, 2019
I am a: Programmer

Needed Help With VAG Playback!

Post by HectyHector » January 30th, 2019, 11:11 am

Hello! I'm very new to PSX Development, and I've followed the hello world guide to compile a hello world project via psyq.

While I did manage to compile Hello World project without any issues, I've now been trying to tackle making stuff on my own. One of the things I wanted to try doing is playing back a vag. I converted a wav by opening it in VAGTool, and then saving it as a .vag file.

I also found a thread with a .vag playback example here: http://www.psxdev.net/forum/viewtopic.php?t=153

However, there is a problem with this. I tried replacing the existing .vag in the example's source code (pedobear.vag) and then compiling the exe, but that doesn't do anything. I saw someone in the replies say something about uploading the vag to a certain address, but I have no idea on how to do that.

Help would be appreciated, thanks!

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » January 31st, 2019, 11:46 am

That example definitely needs some fixing - aside from the fact that it's meant to be used with xploder + caetla, even after adjusting it for emulators by embedding the .VAG file in the exe it works only with pedobear.vag, for the simple reason that it uploads the file to SPU RAM starting from offset 0 since pedobear.vag lacks a .VAG header for whatever reason.
So I tried to upload it starting at offset 0x30(basically skipping the header) to see if proper vag files get played, and they do... unfortunately the sample rate is hardcoded according to that of pedobear.vag, so if your vag's sample rate isn't the same as pedobear.vag's it will play either too fast or too slow :evil:
I'll try to fix it up and upload it once it's done.

EDIT: Alright, it should work now - all you have to do is edit datafile.asm and change this line:

Code: Select all

VAGname	equs	"test.vag"
by changing test.vag to the vag file you want to play (after placing it in the same folder as the project, of course), then double-click make.bat, and voilà :D

I didn't bother polishing the original code too much nor commenting my additions/changes since they seem pretty straightforward to me, so if something is unclear just ask and I'll try to clarify :)
You do not have the required permissions to view the files attached to this post.

HectyHector
What is PSXDEV?
What is PSXDEV?
Posts: 3
Joined: Jan 30, 2019
I am a: Programmer

Post by HectyHector » February 1st, 2019, 10:22 am

Yagotzirck wrote: January 31st, 2019, 11:46 am That example definitely needs some fixing - aside from the fact that it's meant to be used with xploder + caetla, even after adjusting it for emulators by embedding the .VAG file in the exe it works only with pedobear.vag, for the simple reason that it uploads the file to SPU RAM starting from offset 0 since pedobear.vag lacks a .VAG header for whatever reason.
So I tried to upload it starting at offset 0x30(basically skipping the header) to see if proper vag files get played, and they do... unfortunately the sample rate is hardcoded according to that of pedobear.vag, so if your vag's sample rate isn't the same as pedobear.vag's it will play either too fast or too slow :evil:
I'll try to fix it up and upload it once it's done.

EDIT: Alright, it should work now - all you have to do is edit datafile.asm and change this line:

Code: Select all

VAGname	equs	"test.vag"
by changing test.vag to the vag file you want to play (after placing it in the same folder as the project, of course), then double-click make.bat, and voilà :D

I didn't bother polishing the original code too much nor commenting my additions/changes since they seem pretty straightforward to me, so if something is unclear just ask and I'll try to clarify :)
It worked! Thanks so much :D

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests