How to create a WAV file?
There are people out there, who need this way of creating a disk, as they don't possess a floppy drive at their PC.
I was asked how I get from a DMK image to a WAV file. That I will describe further down ...
(Thanks to Andre in Tokyo/Japan and Andrés in Boston/USA)
I was asked how I get from a DMK image to a WAV file. That I will describe further down ...
(Thanks to Andre in Tokyo/Japan and Andrés in Boston/USA)
A Java program
Analyzing a DMK file is no rocket sience. At Ira Goldklang's Website there is an outstanding description of the details of the DMK format:
https://www.trs-80.com/wordpress/tips/formats/
As an ordinary software developer I am lazy and implemented the analysis in a platform independant Java program.
To avoid errors during transmission, I created a ZIP archiv. dmk2cmd.v5.6.zip
To avoid errors during transmission, I created a ZIP archiv. dmk2cmd.v5.6.zip
SyntaxDMK2CMD 5.6
Converts a DMK file into header and tracks appropreate to BOOTSTRAP
-v = View only (no files are created)
usage: DMK2CMD <DMK-file> [-v]
What is this for?
It creates a number of CMD files from a DMK file. The header.cmd is combining all relevant information to create a floppy. Further on the content of each track is stored in 00.cmd to xx.cmd.
It creates a number of CMD files from a DMK file. The header.cmd is combining all relevant information to create a floppy. Further on the content of each track is stored in 00.cmd to xx.cmd.
A batch file
Well there are some steps required, until the WAV file is ready
file="MyDisk.dmk"
fullname=`basename "$file"`
name="${fullname%.*}"
WAVType="500.wav"
java -jar ~/HausPCData/Software/Java/dmk2cmd.jar "$name.dmk"
HighSpeed=$?
if [ $HighSpeed -eq "1" ]; then
WAVType="1500.wav"
fi
trld header.cmd header.$WAVType
if [ $WAVType == "1500.wav" ]; then
sox header.$WAVType silence-long3.wav header.wav
else
sox header.$WAVType silence-long1.wav header.wav
fi
rm header.$WAVType
rm header.cmd
for fn in [0-9][0-9].cmd; do
number="${fn%.*}"
trld $number.cmd $number.$WAVType
if [ $WAVType == "1500.wav" ]; then
sox $number.$WAVType silence3.wav $number.wav
else
sox $number.$WAVType silence1.wav $number.wav
fi
rm $number.cmd
rm $number.$WAVType
done
sox header.wav $(ls [0-9][0-9].wav | sort -n) "$name.$WAVType"
rm header.wav
rm [0-9][0-9].wav
Now I am about to explane some things:
Beside my Java program I use some other programs
- trld from George Phillips from Canada (http://48k.ca/trld.html)
With this tool I convert the CMD files to WAV files - sox, a Linux tool (https://linux.die.net/man/1/sox)
With this tool I combine the WAV files - basename, a Linux tool (https://www.man7.org/linux/man-pages/man1/basename.1.html)
With this tool I extract the name of the DMK file
Now the attentive reader will notice, that I use four WAV files
- silence1.wav
- silence-long1.wav
- silence3.wav
- silence-long3.wav
They can be created quite easy with sox
sox -n -r 22050 -b 16 -c 1 -L silence1.wav trim 0.0 6.0
sox -n -r 22050 -b 16 -c 1 -L silence-long1.wav trim 0.0 16.0
sox -n -r 22050 -b 16 -c 1 -L silence3.wav trim 0.0 20.0
sox -n -r 22050 -b 16 -c 1 -L silence-long3.wav trim 0.0 55.0
Now we encounter the question: "What the heck is he doing there?"
- The filename is extracted.
- The DMK file is splited and the transmission speed is detected at the same time.
500 bit/s for Model I (10 sectors single density)
1500 bit/s for Model III (18 sectors double density) - A preceding silence is added to the header and each track.
- All parts are combined to one large WAV file.
- All temporary files are deleted.
That's it
As I said, no rocket sience!
With this way even data disks can be transmitted.
With this way even data disks can be transmitted.