public String[] toFile(TimedTextObject tto) {
		
		//first we check if the TimedTextObject had been built, otherwise...
		if(!tto.built)
			return null;
		
		//we will write the lines in an ArrayList 
		int index = 0;
		//the minimum size of the file is double the number of captions since lines are double spaced.
		ArrayList<String> file = new ArrayList<>(20 + 2 * tto.captions.size());

		//first we add the header
		file.add(index++,"Scenarist_SCC V1.0\n");

		//line is to store the information to add to the file
		String line;
		//to store information about the captions
		Caption oldC;
		Caption newC = new Caption();
		newC.content = "";
		newC.end =  new Time("h:mm:ss.cs", "0:00:00.00");

		//Next we iterate over the captions
		Iterator<Caption> itrC = tto.captions.values().iterator();
		while(itrC.hasNext()){
			line = "";
			oldC = newC;
			newC = itrC.next();
			//if old caption ends after new caption starts
			if (oldC.end.mseconds > newC.start.mseconds ){
				//captions overlap
				newC.content+="<br />"+oldC.content;
				//we add the time to the new line, and clear old caption so both can now appear
				newC.start.mseconds-=1000/29.97;
				//we correct the frame delay (8080 8080)
				line+=newC.start.getTime("hh:mm:ss:ff/29.97")+"\t942c 942c ";
				newC.start.mseconds+=1000/29.97;
				//we clear the buffer and start new pop-on caption
				line+= "94ae 94ae 9420 9420 ";
				
			} else if (oldC.end.mseconds < newC.start.mseconds ){
				//we clear the screen for new caption
				line+=oldC.end.getTime("hh:mm:ss:ff/29.97")+"\t942c 942c\n\n";
				//we add the time to the new line, we clear buffer and start new caption
				newC.start.mseconds-=1000/29.97;
				//we correct the frame delay (8080 8080)
				line+=newC.start.getTime("hh:mm:ss:ff/29.97")+"\t94ae 94ae 9420 9420 ";
				newC.start.mseconds+=1000/29.97;
			} else {
				//we add the time to the new line, we clear screen and buffer and start new caption
				newC.start.mseconds-=1000/29.97;
				//we correct the frame delay (8080 8080)
				line+=newC.start.getTime("hh:mm:ss:ff/29.97")+"\t942c 942c 94ae 94ae 9420 9420 ";
				newC.start.mseconds+=1000/29.97;
			}
			
			//we add the coded caption text along with any styles to the off-screen buffer
			line += codeText(newC);
			//lastly we display the caption
			line += "8080 8080 942f 942f\n";
			
			//we add it to the "file"
			file.add(index++,line);

		}

		//an empty line is added
		file.add(index++,"");

		//we return the expected file as an array of String
		String[] toReturn = new String [file.size()];
		for (int i = 0; i < toReturn.length; i++) {
			toReturn[i] = file.get(i);
		}
		return toReturn;
	}