First post, by IllidanS4
- Rank
- Newbie
Hello, is it possible to capture PC Speaker sound, preferably in DRO format?
Hello, is it possible to capture PC Speaker sound, preferably in DRO format?
you can capture it as WAV, not DRO as DRO is for raw opl data.
Water flows down the stream
How to ask questions the smart way!
I don't want to capture it as WAV. Is there a raw pc speaker data format?
wrote:Is there a raw pc speaker data format?
There is no such thing and never has been. The PC speaker is an analog device. The WAV output you can capture with DOSBox is as raw as it gets.
Is there something in particular you are hoping to accomplish?
the other way is to logs data sent to PC speaker related ports ($42, $43, $61) along with timestamp when its happens.
good luck modifying dosbox sourcecode for that.
-fffuuu
wrote:wrote:Is there a raw pc speaker data format?
There is no such thing and never has been. The PC speaker is an analog device. The WAV output you can capture with DOSBox is as raw as it gets.
Is there something in particular you are hoping to accomplish?
That's incorrect. PC speaker is a digital device. It changes output level when those ports mentioned by Joey_sw are written to.
I made such recording functionality for debugging Dosbox pc speaker emulation. I don't have the code handy at the moment, but you wouldn't be able to play back any recorded files anyway, because you would need a compatible standalone PC speaker emulator.
If you know even a bit of C or C++, here's what you need to do:
- Open a new file when Dosbox starts. Just cheat and put the file handle in a global variable where it's easily accessible from other source code files.
- Create a struct for logging state changes. Something like this:
struct SpeakerStateEntry {
struct {
Bitu PIC_Ticks; // Dosbox's absolute timestamp
Bit32s CPU_CycleMax; // max emulated cycles per millisecond frame?
Bit32s CPU_Cycles; // current emulated cycles per frame?
Bit32s CPU_CycleLeft; // ??
} timeStamp;
enum {
Port42,
Port63,
Port61
} eventType;
Bitu value;
};
- Log calls to write_latch (ports 0x40 and 0x42), write_p43, and write_p61 by creating a new SpeakerStateEntry, filling its event and timestamp values, then writing it to the file.
- When Dosbox quits, close the file.
- Write an emulator to play back the captured data 😀
You don't need to log everything written to those ports since not everything affects PC speaker. For example, write_latch only affects PC speaker if "counter" is 0x02.
wrote:That's incorrect. PC speaker is a digital device. It changes output level when those ports mentioned by Joey_sw are written to.
Oops. It seems I was misinformed.
If it was really that easy, I would have thought someone would have done it at some point long before now.
What I do (did) for some of my videos is simply capture the signal through a Sound Blaster (they have PC speaker connectors) 😀
Thanks a lot for your help! I've finally managed to compile 😵 DOSBox and add the logging code. If interested, you can download it here. It requires SDL.dll. It stdout-logs relevant ports 42, 43, and 61 in the format "$42:state=value" | "$43=value" | "$61:oldvalue=newvalue" @PIC_Ticks. I am eventually going to write an application that would convert it to more computer-readable format, maybe the one used in Monotone. 😀
The principle of the DRO format, recording port address and data writes, would work with the PC Speaker (3 registers), Covox/Disney Sound Source (3 registers), the Tandy 3-voice chip (8 registers) or the Game Blaster (64 registers).
http://nerdlypleasures.blogspot.com/ - Nerdly Pleasures - My Retro Gaming, Computing & Tech Blog
I stumbled upon this thread on my search on how to extract the pc speaker music from e.g. monkey island 1. I managed to capture the stdout from dosbox logging the three registers with the help of the files IllidanS4 provided (Thanks!!)
now I'm writing a simple analyser in py to see if I can convert it to some sort of format I can play back via maybe a python script using pwm GPIOs on a rpi and a piezo speaker.
Would any of you be interested in helping me with the "decoding"?
IllidanS4 wrote on 2020-05-10, 21:16:If you need help, you can check out my repository here for a converter from the format produced by the mod.
this is awesome!
I just finished my py script that cleans up the RPC code that comes from your script (consolidates delays and removes some weird sounds) and generates hardware_PWM commands (for pigpio)
You cant believe how happy it makes me to hear this old game music I grew up with coming out of a "real" piezo speaker again.
Hi,
I definitely need it for Tandy as well,
I am currently trying to decrypt the Tandy .sng file format, but the Tandy music use "Instruments", I suppose these instruments are done with variations of the output frequency/Volume…
We can surely extend the .DRO format with PC Speaker, CMS and Tandy extract.
Or if somebody can drive me to .ASM source code for 386 that trap the I/O, like done by RDOS for Adlib…..
Hi,
I did a wave output with different Deskmate"Instruments" and these are really basic Volume envelop applied on the Square wave output.
Then, I can surely handle it without problem.
Anyway, Tandy and PC Speaker would be a plus for me, and the community as I added .DRO format replay in my player, I would like to be able to demonstrate/Replay all the games music (From the 80's) in one software.
IllidanS4 wrote on 2013-10-17, 19:25:Thanks a lot for your help! I've finally managed to compile 😵 DOSBox and add the logging code. If interested, you can download it here. It requires SDL.dll. It stdout-logs relevant ports 42, 43, and 61 in the format "$42:state=value" | "$43=value" | "$61:oldvalue=newvalue" @PIC_Ticks. I am eventually going to write an application that would convert it to more computer-readable format, maybe the one used in Monotone. 😀
Hi, I wanted to convert supaplex beeper sounds to midi (or mod with a recording of a real speaker 😀).But I just don't understand how I can get notes and delays from the dosbox output. Could you explain how to do it?. (A midi/mod export setting in your pcsconv program would also be great).
Thanks a lot.
mills26 wrote on 2020-11-03, 19:53:Hi, I wanted to convert supaplex beeper sounds to midi (or mod with a recording of a real speaker 😀).But I just don't understand how I can get notes and delays from the dosbox output. Could you explain how to do it?. (A midi/mod export setting in your pcsconv program would also be great).
Thanks a lot.
You can use pcsconv with input PCS and output DRO and then find a tool that converts DRO to MIDI. I might some day add support for saving MIDI as well, though.
Old thread is old. Closed