Re: Audio Books

From: Harvey Newstrom (newstrom@newstaffinc.com)
Date: Sun Jan 09 2000 - 10:54:48 MST


<EvMick@aol.com> wrote on Sunday, January 09, 2000 4:12 am,

> I've just (re)discovered audio books..

I loved these a few years ago when I was commuting 90 minutes each way to a
consulting job. I got more "reading" done that year than I had in a long
time! Try looking at your local library for audio books you can borrow for
free to reduce your costs.

> Today I listened to Tom
> Clancy's "Every man A Tiger' from Oklahoma city to Effingham
Illinois....it
> was the easiest St. Louis Transistion I ever made..

I grew up on a farm near Effingham, Illinois.

> Hows about some enterprising software type writing a program that would
turn
> a paperback book into a CD audio?

I already use my Macintosh to do this. I use it to make audio tapes of
texts I download off the Internet, so I don't do much scanning for this
purpose.

The Mac has built-in text-to-speech capabilities, and most text editors have
a "Read outloud" command. Just stick the sound output into a taperecorder,
and you've got it made.

To add a little more control, I wrote my own little Applescript batch job.
It does the following:
    - choose the file to speak
    - select length of each tape side (default is 45 minutes for my tapes)
    - progress bar shows percentage complete
    - progress bar estimates time left to speak
    - progress box shows text of current sentence being spoken
    - script stops before end-of-tape and prompts for turn-over or next tape
    - script keeps track of tape/side number and shows what label to put on
tapes

I wrote and debugged this in about an hour. I tested it with about a year
of use.

> EvMick
> Effingham, Ill.

(I grew up on a little farm just outside Effingham, Illinois.)

--
Harvey Newstrom <http://harveynewstrom.com>
Certified Consultant,  Legal Hacker, Engineer, Research Scientist, Author.
____________________________________________________________
-- This is my script to create audio tapes from ASCII files --
-- Select file to speak
set thisfilename to (choose file with prompt "Speak File:") as string
set startfilename to 0
repeat with i from 2 to (count of thisfilename) - 1
 if character i of thisfilename is ":" then set startfilename to i + 1
end repeat
set thisfileshortname to characters startfilename through -1 of thisfilename
as string
set thisfile to (open for access thisfilename)
tell application "Finder" to set thisfilesize to (get eof thisfile)
-- Select tape length
set lengthtime to 0
set temptime to 45
repeat while lengthtime = 0
 activate
 display dialog "Pause for tape change every:" buttons {"<", (temptime as
string) & " minutes", ">"} default button 2
 set thisbutton to button returned of result
 if thisbutton is equal to "<" then
  set temptime to temptime - 15
 else if thisbutton is equal to ">" then
  set temptime to temptime + 15
 else
  set lengthtime to temptime
 end if
 if temptime ² 0 then
  set temptime to 15
 end if
end repeat
-- Start progress bar
set thistape to 1
set thisside to "A"
set currentposition to 0
set previouslyrecorded to 1
tell application "Finder"
 set myFile to file of (every process whose frontmost is true)
 set comment of information window of myFile to "Speaking:  \"" &
thisfileshortname & "\"" & return & "Current Position:  1A:00:00 out
of --:--:--"
 open information window of myFile
end tell
-- speak entire file
set speaking to "not done"
repeat while speaking is "not done"
 set starttime to (current date)
 set endtime to starttime + lengthtime * minutes
 try
  with timeout of lengthtime seconds
   repeat while (current date) < endtime
    set thistext to (read thisfile until ".")
    set limit to (count of thistext) - 1
    if limit > 30 then
     set limit to 30
    end if
    if limit > 5 then
     if (characters 1 through limit of thistext) contains return then
      if character 1 of thistext is return then set thistext to (space &
(characters 2 through -1 of thistext)) as string
      repeat with i from 2 to limit
       if character i of thistext is return then set thistext to
((characters 1 through (i - 1) of thistext) & space & (characters (i + 1)
through -1 of thistext)) as string
      end repeat
     end if
    end if
    set currenttime to (current date)
    set difftime to currenttime - starttime
    set currentposition to currentposition + (length of thistext)
    set thisminute to round (difftime / 60) rounding down
    if thisminute < 10 then set thisminute to "0" & thisminute
    set thissecond to round (difftime - thisminute * 60) rounding down
    if thissecond < 10 then set thissecond to "0" & thissecond
    set secondsdone to previouslyrecorded + difftime
    set estimatedseconds to secondsdone * (thisfilesize / currentposition)
    set estimatedtapes to round (estimatedseconds / 60 / lengthtime)
rounding up
    if estimatedtapes mod 2 is not 0 then
     set estimatedtapes to (round (estimatedtapes / 2) rounding up) & "A"
    else
     set estimatedtapes to estimatedtapes / 2 & "B"
    end if
    set oddminutes to round ((estimatedseconds / 60) mod (lengthtime))
rounding down
    if oddminutes < 10 then set oddminutes to "0" & oddminutes
    set oddseconds to round (estimatedseconds mod 60) rounding down
    if oddseconds < 10 then set oddseconds to "0" & oddseconds
    tell application "Finder"
     set comment of information window of myFile to "Speaking:  \"" &
thisfileshortname & "\"" & return & "Current Position:  " & thistape &
thisside & ":" & thisminute & ":" & thissecond & " out of " & estimatedtapes
& ":" & oddminutes & ":" & oddseconds & return & thistext
    end tell
    tell me to say thistext
   end repeat
  end timeout
  if thisside is "A" then
   set thisside to "B"
  else
   set thisside to "A"
   set thistape to thistape + 1
  end if
  set previouslyrecorded to previouslyrecorded + (lengthtime * minutes)
  activate
  display dialog "Start recording Tape " & thistape & " Side " & thisside
buttons {"Cancel", "OK"} default button 2
 on error errorMessage number errorNumber -- Handle end-of-file, cancel
button,  time-out or other errors
  set speaking to "Done!"
  activate
  if errorNumber = -39 then -- end of file
   try
    set thistext to (read thisfile)
    tell me to say thistext
   on error
   end try
   tell application "Finder" to set comment of information window of myFile
to "Done speaking \"" & thisfileshortname & "!" & return & "Ending Position:
" & thistape & thisside & ":" & thisminute & ":" & thissecond
   play sound "Done"
  else if errorNumber = -128 then -- cancel button
   tell application "Finder" to set comment of information window of myFile
to "Cancelled speaking \"" & thisfileshortname & "!" & return & "Current
Position:  " & thistape & thisside & ":" & thisminute & ":" & thissecond
   play sound "Synth Twang"
  else
   display dialog errorMessage & "(" & errorNumber & ")" buttons {"OK"}
default button "OK" with icon 0
  end if
 end try
end repeat


This archive was generated by hypermail 2.1.5 : Fri Nov 01 2002 - 15:26:10 MST