Page 1 of 1

XMPlay Example + Tools

Posted: July 3rd, 2013, 12:48 am
by zeroZshadow
I made a small example that shows how to use the XMPlay library and tools to add music to your application.
Please read the README.TXT included to see how the example is used.

The .BAT files are commented to show what each action does.
I tried to comment the main.c as clear and simple as possible to show the workings of XMPlay

Have fun!

Re: XMPlay Example + Tools

Posted: July 3rd, 2013, 11:30 am
by zeroZshadow
Small addition
I am using the cpe2psx tool here (its in the MAKE_AND_PLAY.BAT)
if you do not have this, please change this command to CPE2X
and remove the line "ren main.psx main.exe"
Sorry for not adding this in the readme

Re: XMPlay Example + Tools

Posted: August 28th, 2013, 4:42 am
by Nikoomba
If I follow the instructions in the readme file, the .exe does not compile.
This is without changing the .xm. It comes up with a parsing error.
I did change the .bat file as you instructed in your post since I wanted to use cpe2x.
I think cpe2x can't compile the code properly or something.

Re: XMPlay Example + Tools

Posted: January 8th, 2017, 3:47 am
by Shadow
I have had the XMPLAY.LIB file on my PC for ages, but I never got around to using it nor uploading it. I checked the MD5, and it matches yours so both versions are the same. I was hoping yours would be newer since I've been playing around with it, and a few XM's don't play correctly which lead me to the library being not that accurately coded. As an example, I made a song from scratch using Fast Tracker, and the timing is off, even with a fixed BPM. The library isn't perfect, but this is a fantastic way to play several minute long songs with everything running from SPU RAM which is why it's being implemented into PSIO's Menu System.

I also contacted Jason Page (since he wrote the library) and I asked if he still had the source code. Unfortunately he does not, but, he did give me the PlayStation 2 source code which can be downloaded below.

Code: Select all

<!-- Sample code showing how to play .XM files -->
***** XMPlayer *****

PS2 Example code. 12.Dec.2000 - Jason Page (Technology Group (a division of SCEI R&D))

Plays XM files (converted into .XM, .XMH and .XMB files using the utility XM2PSX)
Main code runs on the IOP.
See "Info.TXT" for full list of commands.
Full source code included for xm player.

Handles playback of a maximum of 32 songs, using a maximum of 8 XM files.

To run:
From the EE directory:
dsedb -r run main.elf
xmplay.zip

Re: XMPlay Example + Tools

Posted: June 21st, 2023, 10:10 pm
by Mills
Does anyone know if the included SEQ players in the psyq, are faster than this library?.

I imagine the included MID/SEQ player is just another software program that reads midi files, so it will be as fast as any other program (like this XM player).

I read some psyq samples and docs, and it looks like there is no "hardware" midi player, some programs send samples to the SPU with a few parameters, so I think the CPU has to read and process the MIDI/SEQ.

Re: XMPlay Example + Tools

Posted: July 7th, 2023, 2:23 pm
by MottZilla
Correct the CPU has to tell the SPU what to do, it can't play a sequence on it's own. I wish I had something to add, but I haven't yet messed around with sequenced music, only standard CD audio.

Re: XMPlay Example + Tools

Posted: August 4th, 2023, 8:56 pm
by Mills
MottZilla wrote: July 7th, 2023, 2:23 pm Correct the CPU has to tell the SPU what to do, it can't play a sequence on it's own. I wish I had something to add, but I haven't yet messed around with sequenced music, only standard CD audio.
Thanks!

Re: XMPlay Example + Tools

Posted: August 4th, 2023, 10:29 pm
by nocash
Mills wrote: June 21st, 2023, 10:10 pm Does anyone know if the included SEQ players in the psyq, are faster than this library?.
I don't know. But the SPU-ADPCM playback is done by hardware, and the CPU does merely need to send some parameters (for things like changing the sound frequency, sending key on messages). The CPU load should be less than 1%, so there shouldn't be much of a difference between faster or slower sound drivers (or completely disabling the music).

Re: XMPlay Example + Tools

Posted: March 27th, 2024, 8:27 pm
by soundy
I have the same timing problem here. Not a question of CPU or performance. Even at slow BPM, notes are not played on time. It sounds like VSyncCallback(XMPlayer::vbl); was not stable in term of time interval.

Re: XMPlay Example + Tools

Posted: March 28th, 2024, 12:07 am
by nocash
The same timing problem than what? Nobody mentioned any timing problems.

Anyways, the timing problems I could think of:

Vblank accuracy is approx +/-0.001 minutes, but I doubt that even audiophiles could hear differences between 119.999 bpm and 120.001 bpm.
PAL vs NTSC have different vblank timings.
Don't block audio playback by doing things like disabling IRQs for longer periouds, or doing huge DMA transfers with hundreds of kilobytes.
That callback thing sounds as if you need to call it (exactly?) once per frame. Which would be up to you to do so accurately. It may be best to call it from within vblank interrupt handler. Or when manually polling vblanks: Be sure to do that polling often enough (eg. poll several times during slow initialization functions).

Re: XMPlay Example + Tools

Posted: April 8th, 2024, 8:50 am
by baku-chan
This looks interesting from the perspective of someone who would love to see hombrew sequenced music running on either the PS1 or PS2 (preferably the latter, which is why I'm glad to see the source code for this program for that console here). I'd personally prefer either MIDI or its PlayStation SDK equivalents in SEQ/VH/VB and SQ/BD/HD, but you've gotta start somewhere, right? I'm presuming that this all runs using IOP cycles; or in order words, not using the actual SPU/SPU2 channels besides playing the final output mixed on the IOP. I'm making said guess based on the fact that the PowerPoint slides say that reverb isn't implemented in at least whatever version they're referring to, which I would be relatively trivial and you have access to the registers through the sound drivers, isn't that true?