CCD Frames to CUE Time Conversion

I had a situation come up where I needed to convert frame data in a *.ccd file to standard time notation for a *.cue file.

Example CCD File Data:

[TRACK 1]
MODE=2
INDEX 1=0

[TRACK 2]
MODE=0
INDEX 0=174524
INDEX 1=174674

Example CUE File Data:

TRACK 01 MODE2/2352
INDEX 01 00:00:00
TRACK 02 AUDIO
INDEX 00 38:46:74
INDEX 01 38:48:74

Assuming there are 75 frames per second, we arrive at the following BASH code:

######################################################################
# Script takes in a frame value (integer) and outputs in human
#    readable time format. MINUTES:SECONDS:TICKS
#        EX: 12:45:33
#  Use Case – Converting frame data in .ccd file for .cue usage
#            (C) monroec.com
######################################################################

#!/bin/bash

# We declare 75 frames per second. (Standard for *.ccd files)
# Anything smaller than a second is a TICK.

# Frames per second, seconds per minute, frames per minute
FRAMESPS=75
SECONDSPM=60
FRAMESPM=$(($FRAMESPS * $SECONDSPM))

# Integer input only
if echo $1 | egrep -q ‘^[0-9]+$’; then

MINUTES=$(($1 / $FRAMESPM))
SECONDS=$((($1 % $FRAMESPM) / $FRAMESPS))
TICKS=$((($1 % $FRAMESPM) % $FRAMESPS))

# Print with two characters
echo $(printf “%02d\n” $MINUTES):$(printf “%02d\n” $SECONDS):$(printf “%02d\n” $TICKS)
else
echo Error: Argument must be an integer!
fi

Usage:

burt@reynolds:~/Roms/SCRIPTS$ ./frameConv.sh 174623
38:48:23

I suppose I could write a proper .ccd to .cue converter, but this addresses the short term need. I only need the data on-demand, after all.

 

2016-10-25 Koto

We had a late lunch in Koto and walked around the shops at DiverCity Tokyo Plaza. The Gundam statue was really neat and convincing. I was impressed by the meticulous detail added to make it look lifelike.

Later, by chance, I noticed Rainbow Road was fully visible from this side of town. After trying some shots with the 50mm and 24mm, we headed back home to pack and get ready for tomorrow’s flight.

I’m starting to like the 50mm much more….

img_4145 img_4155 img_4162 img_4171 img_4173

2016-10-24 Minato

We headed back to Shibuya for lunch and some shopping. Afterwards, we made our way towards Minato. To me, the view from Tokyo Tower was reminiscent of Toronto.

Atop the tower we found a gentleman reading a notepad and transmitting something via portable HAM radio. I obviously couldn’t make out what he was saying, but I certainly paid attention to his tone. My brother and I joked that he was a spy. Almost immediately after this statement, he hid his radio, took one or two random pictures and left. We saw him again downstairs, but he was walking as fast as possible. Busted?

My best shots of Rainbow Bridge were from Tokyo Tower. I was unable to find a good place to position myself at street level. I believe the onramp is where people go; next time….

img_4115 img_4119 img_4123 img_4142 img_4144

2016-10-23 Chiyoda, Akihabara, & Shibuya

We started the day by walking through the East Gardens. Direct visibility to the palace was impossible without a tour. Instead, we enjoyed the moat and castles within.

Akihabara was a combination of anime, video games, and swap meet. Locals of all ages buying manga, dolls, playing cards; surreal. We ran into a scam artist, posing as a Buddhist monk, looking for donations. He handed me a good luck charm, log book, and a pen to write my donation amount. Naturally, everyone before me had donated 10000+ yen. I looked at him in the eye and said “rei” (zero in Japanese). He got mad and showed me some change as if to say any money was fine. He grabbed his log book, the good luck charm he handed me, and stormed off to the next pair of tourists. It was awesome.

We finished off the night in Shibuya. We experienced the famous crossing and had a few drinks. We tried going into “Gas Panic,” but it was an off night. Instead, we headed to “British Pub.” We met an American DJ on vacation that has been living in Bangkok for a few years, and a writer to a video game blog that has relocated to Japan. Both gave us really good insight into various towns.

img_4016 img_4020 img_4029 img_4030 img_4032 img_4042 img_4047 img_4053 img_4054 img_4064 img_4070 img_4072 img_4091 img_4094 img_4095 img_4097 img_4105