CISC2330 Lab11 "Audio Reader conversion program"
(due: Friday, 12/03)

For long car trips, I really like audiobooks. It's easy to get a text file of an old or new book, but it's often difficult to get an audiobook for the books you like. I have rather odd tasks and many of the books I like aren't available.
 

The steps I follow are as follows:

1. First, I get the test file, these are two of the sources I use. There are others, but these will do for now...

The Baen free Library (SciFi books) "March Upcountry", "Oath of Swords" and "On Basilisk Station" are very good...

If you don't want to pick your own, here is " Restoration of Faith by "Jim Butcher" (206 words) " (right click your mouse over the link and use the "Save Link As.." option to transfer the file).

Here is a slightly longer book " Puppet Master by "Robort A. Heinlein" (524,470 words) " (right click your mouse over the link and use the "Save Link As.." option to transfer the file).

The Gutenburg project (30,000 older books)

2. The problem that comes up is that the audio reader can only read lines that are of length 255 chacters or less... Lines are, by default, broken by a carriage-return/linefeed. The paragraphs written in books are often much longer. To solve the problem, we will write a program that will break up the text-file into lines based on line endings ("." "!", "?").

*** Here is the full-listing of my "collada" conversion program. "fix-dae.txt" . It uses more advanced features, which you have not yet used. Here is a rarred up version, you should use as a starting point "fix-dae-files.rar".


//*****************************************************************
// SplitKeepSeps::  Split line, keep seperator in substring.
// Simplified from on-line code from "sprotty" liquid-technologies.com
// last updated 4/07/10 (efa)
//*****************************************************************
public static string[] SplitKeepSeps(string value, char[] seps)
{
   List<string> splitValues = new List<string>();
   int itemStart = 0;

   //check every character
   for (int pos = 0; pos < value.Length; pos++)
   {
      //check every seperator
      for (int sepIndex = 0; sepIndex < seps.Length; sepIndex++)
      {
          if (seps[sepIndex] == value[pos])
          {              
             if (itemStart != pos)
             {
                splitValues.Add(value.Substring(itemStart, (pos - itemStart)+1));
             }
             itemStart = pos + 1;               
             break;
           }
      }
   }
    
   if (itemStart != value.Length)
   {
      splitValues.Add(value.Substring(itemStart, value.Length - itemStart));
   }

   return(splitValues.ToArray());
}

Modify the replaceMaterial() routine... 
 //words = line.Split(sep); //split into lines on ".","!" and "?"
 words = SplitKeepSeps(line, sep);

 foreach (string str1 in words)
 {
   listBox1.Items.Add(str1);
 }


*** You need to make other changes to this routine. Look at the program you worked on last week. We'll discuss this is class. Don't forget to change the form's title and add comments where needed...

3. You'll need an audio reader to test the results of your program. Here is a "local copy (dspeech v1.55.3)". Here is the original link "http://dimio.altervista.org/eng/"
It really is free and comes with pretty good, free voice "Anna".


line

I've spent a lot of research and effort in making this lab, so... I want more than 20 and less than 100 lines of text from somewhere, converted to an mp3 file and turned in separately or with your zipped/rarred up project file...

If you've already turned it in then add it as a second reply to the assignment post... line

4. If you are interested in writing your own Text-to-mp3 program; check out this open-source version. They include source code and information about making voices... Here is the "eSpeak" link: "http://espeak.sourceforge.net/". line

Remember,  this is a programming methods class, neatness and form are important. 

Please turn in your assignment by using the Assignment Turn-in at tinyRealm.com BBS.

Just post a "Reply" to the lab assignment message and upload your assignment (by "Attaching" a file to your reply message). You should attach your entire project zipped up in "zip" or "rar" format. *** If you don't have winzip or winrar, get them at tinyRealm.com They are available from the pull-down menu's (Useful downloads)(Archive...).

Naming convention: class_lab#_YourInitials.format

mine would look like: cisc2330_l11_efa.zip