Post by whengreg on Apr 13, 2008 18:50:59 GMT -5
Alright, after a bit of research, it turns out that
1) pSX runs poorly when reading directly from the cdrom.
2) While cdrdao can make cue/bin files with a bit of work, the audio tracks are not recorded in the format pSX expects, resulting in pure static. (This is also the problem with the script posted at psxemulator.proboards54.com/v45index.cgi?board=rules&action=display&thread=1058#1195747981 )
3) There existed no good way to make cue/bin files under Linux.
Anyway, after figuring out what format the audio needed to be in, I wrote a script to do the conversion for me. (As follows) This script requires Python, sox, and cdrdao to be installed, and assumes you placed the psx disk into /dev/cdrom.
Also note:
1) I have not tested this script with any disks lacking audio tracks, as I don't know of any off the top of my head. However, those should be rippable with the standard cdrdao method anyway.
2) The music is not byte-for-byte identical with the output from cdrwin. However, it does play correctly inside pSX. I'm not sure what the problem is here, but it's good enough for me, so I'm going to ignore it.
3) You might need to clean out /tmp occasionally if you're ripping a large collection in one session; this script leaves behind a cd-sized .cdr file for each cd you rip, on top of the .bin file that results.
1) pSX runs poorly when reading directly from the cdrom.
2) While cdrdao can make cue/bin files with a bit of work, the audio tracks are not recorded in the format pSX expects, resulting in pure static. (This is also the problem with the script posted at psxemulator.proboards54.com/v45index.cgi?board=rules&action=display&thread=1058#1195747981 )
3) There existed no good way to make cue/bin files under Linux.
Anyway, after figuring out what format the audio needed to be in, I wrote a script to do the conversion for me. (As follows) This script requires Python, sox, and cdrdao to be installed, and assumes you placed the psx disk into /dev/cdrom.
Also note:
1) I have not tested this script with any disks lacking audio tracks, as I don't know of any off the top of my head. However, those should be rippable with the standard cdrdao method anyway.
2) The music is not byte-for-byte identical with the output from cdrwin. However, it does play correctly inside pSX. I'm not sure what the problem is here, but it's good enough for me, so I'm going to ignore it.
3) You might need to clean out /tmp occasionally if you're ripping a large collection in one session; this script leaves behind a cd-sized .cdr file for each cd you rip, on top of the .bin file that results.
#! /usr/bin/env python
#makebincue.py version 1.0
#Run with (for example) "python makebincue.py example1" to generate
#example1.cue and example1.bin
import sys, os
from random import choice
import string
def GenPasswd():
newpasswd = ""
chars = string.letters + string.digits
for i in range(8):
newpasswd = newpasswd + choice(chars)
return newpasswd
def GenPasswd2(length=8, chars=string.letters + string.digits):
return ''.join([choice(chars) for i in range(length)])
if len(sys.argv) < 2:
print "Please include output filename (not including extension)"
sys.exit()
filename = sys.argv[1]
if os.path.exists(filename+".bin"):
print "file "+filename+".bin already exists. Stopping now to avoid overwriting"
sys.exit()
if os.path.exists(filename+".cue"):
print "file "+filename+".cue already exists. Stopping now to avoid overwriting"
sys.exit()
while 1:
tmpdir = "/tmp/makebincue."+GenPasswd()+"/"
if not os.path.exists(tmpdir): break
try:
print tmpdir
os.mkdir(tmpdir)
except:
print "error generating tmp directory. Is /tmp writable?"
sys.exit()
print "copying data from cdrom..."
os.system("cdrdao read-cd --read-raw --datafile "+tmpdir+filename+
".cdr --device /dev/cdrom --driver generic-mmc-raw "+tmpdir+filename+".toc")
if not os.path.exists(tmpdir+filename+".cdr"):
print "file "+filename+".cdr does not exist. This should not happen."
sys.exit()
try:
tocfile = open(tmpdir+filename+".toc", 'r')
except:
print "could not open "+tmpdir+filename+".toc. Aborting."
sys.exit()
toc=tocfile.readlines()
for line in toc:
if line.find("length in bytes") != -1:
line = line[line.find("length in bytes") + 17:].strip()
break
else:
print "could not find length of datatrack in toc file. Aborting."
sys.exit()
print "converting toc to cue"
os.system("toc2cue "+tmpdir+filename+".toc "+filename+".cue")
print "copying data track to output"
print "head -c "+line+" "+tmpdir+filename+".cdr > "+filename+".bin"
os.system("head -c "+line+" "+tmpdir+filename+".cdr > "+filename+".bin")
print "processing music tracks"
os.system("tail -c +"+str(int(line)+1)+" "+tmpdir+filename+".cdr | sox -t raw -c 2 -r 44100 -2 -B -s"+
" - -c 2 -2 -L -r 44100 -s -t wav - | tail -c +45 >> "+filename+".bin")