Page 1 of 1

PCSPLAY

Posted: March 7th, 2013, 4:42 pm
by musa
I'm releasing a tool for DOS: PCSPLAY!

It can play Prince of Persia 1 PC Speaker sounds & music.

Just type: pcsplay [whatever sound you want to play].

Bugs:
Speed is not very accurate.

Re: PCSPLAY

Posted: March 7th, 2013, 8:25 pm
by Norbert
Should this work under DOSBox?
With, for example, "PCSPLAY.EXE IBM_SND1.DAT"?
I tried that, but it doesn't play anything recognizable; after the second note it's stuck or something. :P

Re: PCSPLAY

Posted: March 7th, 2013, 8:46 pm
by musa
Extract them first and then play them.

Re: PCSPLAY

Posted: March 7th, 2013, 8:51 pm
by Norbert
Ah, yes, that works.
I've attached the .PCS files that can be used with PCSPLAY.
[Edit: (SND54.PCS = intro tune)]

Re: PCSPLAY

Posted: March 7th, 2013, 11:32 pm
by Norbert
Hey musa, I have a question.
I checked the code and as I understand it, each tone has a frequency to generate (note.freq) and a delay (note.duration).
I don't understand what is being passed to 0x42... some kind of frequency? But we already have a note.freq for each note...

Re: PCSPLAY

Posted: March 8th, 2013, 12:45 pm
by musa
I was trying set the speed according to the bps to PIT Channel 2.

More information on this can be found here: http://bespin.org/~qz/pc-gpe/pit.txt

Re: PCSPLAY

Posted: March 9th, 2013, 10:35 am
by Norbert
Can you make a custom version for me that displays the following values while running:
- bps, after being read from the handle
- the two values being passed to 0x42
- while the tones are playing, their note.freq and note.duration

I tried porting your program to GNU/Linux and it almost works, but when I pass the intro tune (SND54.PCS) to it, it doesn't sound right, so I'm wondering what I'm doing wrong. :)

Re: PCSPLAY

Posted: March 10th, 2013, 7:05 pm
by musa
Norbert wrote: - the two values being passed to 0x42
Why would you require that?
Norbert wrote: I tried porting your program to GNU/Linux and it almost works, but when I pass the intro tune (SND54.PCS) to it, it doesn't sound right, so I'm wondering what I'm doing wrong. :)
Does your PC have a PC Speaker? If so, is it properly supported?

I have compiled my program with your suggestions except the second one which I'd like to know why you require it.
BTW you need Turbo C to compile the code.

Re: PCSPLAY

Posted: March 10th, 2013, 11:12 pm
by Norbert
musa wrote:Why would you require that?
Not required, I was just curious. :)
musa wrote:Does your PC have a PC Speaker? If so, is it properly supported?
Well, as I wrote before, it almost works, but the port... "it doesn't sound right".
It still doesn't sound right. I've attached what I've got so far to this post.
Anyways, thanks for creating the custom version. At least it confirmed my suspicion about what's wrong with my code.
I'm not going to look into it any further, but it was fun for a while, looking into how this PC speaker stuff works.

Re: PCSPLAY

Posted: March 12th, 2013, 11:11 am
by David
Musa, your player plays snd55.pcs too fast. (That is the music played when the "In the Sultan's absence" text is shown.)
Perhaps the value of "bps" is ignored?
I see you're using it to set the timer, but shouldn't you use it in the call to delay instead?

There is another topic about PCspeaker sounds: viewtopic.php?f=67&t=566

I made a player back in 2006 which is mentioned in that topic. I've attached it to this post.
I made the source more readable, and fixed a bug. The value of "whole" used to be 2000, but then it plays everything too slow. Now it's 1000.
Oddly, I remember listening to all the music with the correct speed.

Re: PCSPLAY

Posted: March 17th, 2013, 1:19 pm
by musa
I've released a newer version of PCSPLAY.

Fixed:
The speed is now more accurate.