Not sure this is a bug... but I think it should work. The idea was to load a cas file while recording it's output to a .WAV with record_channel command. The generated .WAV file does not load correctly. I've tried with many .cas files and talked about it at the MSX IRC channel. They suggested me to open this ticket.
How to reproduce:
- Turn autorun off > set autoruncassettes off
- Record cassette player output > record_channels cassetteplayer -prefix myfile
- Insert the cass file > cassetteplayer insert myfile.cas
- Load the game: RUN"CAS:
- Wait until the game shows up
- Stop recording > record_channels stop
- Stop machine > set power off
- Start machine > set power on
- Load .WAV file > casseteplayer insert myfile_whatever.wav
- Load the game: RUN"CAS:
- It won't work.
Thanks.
Hi, thanks for your report. This is indeed something you could expect to work. Unfortunately it doesn't for the following reason:
The cassette player code actually deals with two cassette data streams:
The former must be perfectly synchronized with the emulated machine, the latter must preferably be synchronized with the host time. In ideal circumstances both are the same because the emulator-time is 100% in sync with the host time. But in case you set the emulator speed to something else than 100% or in case the host machine is too slow (or there is a spike in CPU usage, maybe of another application) it's not always 100% the case.
I don't remember all the details (it's been many years since I wrote this code). But I see comments in the source that that say we get better cassette player sound quality when we don't re-synchronize the above two streams too often. So in the current implementation the first stream is exact, but the audible stream is only a good approximation.
I'm sure this is a solvable problem. Though for me personally this has low priority. But maybe you can convince me to give this higher priority if you can give a useful scenario where you'd like to use this?
I think there is more going on than slightly inaccurate sound generation.
I reproduced the commands that Francesc posted and it seems all bytes are
correct except the last two before each pause (when the motor is turned
off). And when I replace step 4 by the "motor on" command instead of
actually loading, the conversion works perfectly.
I think the problem might be that when the motor is turned off, the audio
stream is cut off at the consumer side. So no more audio is delivered, even
if there is still some buffered audio. I think the audio should be cut off
at the producer side instead: that way no new samples are generated, but the
ones already buffered are still played.
Thanks for your answers.
First of all let me say that openMSX it's an amazing piece of software and
that I'm honored to talk to both of you. Thanks for your amazing talents
and efforts to make this project a reality.
So... I've been playing around with my real MSX machines and openMSX
emulator trying to discover all it's features and squeeze the most out of
it. So far so good!
Then it came to my mind the idea of converting .CAS files to .WAV. I wanted
to copy the .WAV audio file to a cassette tape and see if It worked on a
real MSX1 machine (with no disk drive). Just for the fun of it... but it
could also be useful for people with no other way of loading games to a
real MSX machine than through the cassette player port.
I tried it and it didn't work. I played with the output volumes, I tried
with the "soundlog" command and other stuff with no luck. Then I searched
the net wondering if nobody had ever had the same need, and indeed, some
people did. I found similar projects like this ones:
Searching the net I found some old projects
On Mon, Sep 8, 2014 at 9:11 PM, Maarten ter Huurne mthuurne@users.sf.net
wrote:
Related
Bugs (DISABLED): #553
Ups... my email was sent while I was trying to copy-paste some urls. sorry.
The projects:
http://www.finnov.net/~wierzbowsky/caslink.htm
http://www.finnov.net/~wierzbowsky/caslink2.htm
http://home.kabelfoon.nl/~vincentd/
I've tried Maarten suggestion and it does work, which is great! So
apparently sound synchronization is not an issue...but I really liked the
explanation. Thanks.
Sorry for the long email... I am quite exited to talk to you both and to
have it working!
Good night.
Francesc.
On Mon, Sep 8, 2014 at 10:47 PM, Francesc Vendrell xescoo@gmail.com wrote:
Related
Bugs (DISABLED): #553