From nswccWiki
Jump to: navigation, search

For information about using Keynote with Quicktime Player 10 see Recordari

Live Keynote

Keynote is Apple's presentation software "designed for Steve". Keynote can be driven by AppleScript making it very powerful.

I wanted a slideshow of a rotation of 5 slides, but with one particular slide showing the current time. The purpose was to use it as a Science Fair welcome/ program guide using a data projector, as an unattended kiosk. Yes, it could very easily be done using web pages, but this is to demonstrate the principle.

Firstly, you design the slideshow, making sure that on the slide you want to be updated, the main text field called *body* is left blank but properly formatted for a time display. Secondly, open the slideshow file. This simplifies the script. It does not have to be running. Run the Applescript below.

AppleScript will plant text in the field when it is not displayed, but while the slideshow is running. If you set up the slideshow as a loop, and then start the slideshow using the simple AppleScript below, the two will (co-operatively) interact. The behaviour can become quite complex. An example plants the current time as "<hh:mm> [AM|PM]" in the body text field of slide 3 in a rotation.

-- Live Keynote, Ian W. Parker - vers 0.2 (updated)
-- first worked on: 2009-08-12, last worked on: 2009-08-06
-- works best if the slides display for say 30 s or less at a time
-- we could control the whole show from here but we let
-- Keynote internally do some of the hack work

tell application "Keynote"
	tell slideshow 1
			delay 2 -- seconds.  This script does not need to run faster
			set the_time to current date
			set the_time to time string of (current date) -- get now()
                        set the_time to every word of the_time -- slice
                        set the_time to item 1 of the_time & ":" & item 2 of the_time & " " & item 4 of the_time -- extract fields
			-- plant the current time (while not being displayed) in slide 3
			set body of slide 3 to the_time as string
		end repeat
	end tell
end tell

Multidimensional media presentation

For some time I've been working on the concept of running a movie in parallel with a slideshow. This is not the same as embedding a movie in a slideshow. In that scenario you are locked into a single slide while you watch the movie. In the scenario here, the slide transitions depend on the current elapsed run time of the video! Yes!

I'm sure you can think of reasons to do this in your classroom. My motivation was the following.

In Year 7 science we have a unit of work called "A Trip to the Zoo". Like everyone else we teach classification and food chains and food webs. David Attenborough's "Life … " series is excellent material for students to watch. I wanted students to build up food chains and food webs from the video presentations as they watched the video and without starting or stopping the presentation- after all students today "multi-task".

But… you could spend a lot of time preparing worksheets etc for students and the end result would be that you have put a lot of work in - and you have to sync watching with note taking- possibly by using manual pause.

The small demo applescript below gives you the capability to synchronise a Keynote presentation with a free running movie. Now this requires that you have TWO data projectors running side by side, say on a wide whiteboard.

The idea is you watch a video, taking notes recording elapsed time events. After that construct a Keynote presentation of slides. The slides would contain the information you want students to copy at the point in the video. The slide show could also be keyed to a set of worksheets. The critical feature here is that SyncSlideShow2Movie allows you to load a movie (previously indexed- but do not run), then load a keyed Keynote presentation. Next, SyncSlideShow2Movie is run and then the movie is run. So long as you do not reverse the video, but you can pause the video, as the video runs, at the key time markers you have added to SyncSlideShow2Movie there will be an automatic slide transition.

What do you put on the slides? You place a summary of what students are expected to write as notes. For Year 7 students it could be a cloze passage or "complete the diagram". For more able students it could be a stimulus question/ stem.

Because this is a "proof of concept" you copy the video trigger points (in elapsed seconds) into the trigger-points list. They have to be monotonic increasing (can't go backwards). And 1 min 10 s is recorded as 70 s.

To improve the functionality, you could add the following: open a text file with trigger points, open a movie, open a keynote, and run the system from within the applescript.

-- SyncSlideShow2Movie Vers. 0.2, Slideshow is driven by a movie
-- Ian W. Parker, first worked on 2011-09-03, last worked on 2011-09-24
-- you can pause video but not go backwards

global trigger_start, trigger_current, trigger_item, trigger_points
set {trigger_start, trigger_current, trigger_item} to {0, 0, 0}
set trigger_points to {30, 40, 50} -- change slide @, 30 s, 40 s, 50 s

on start()
	-- show the first slide
	tell application "Keynote"
		set trigger_item to trigger_item + 1 -- show first content slide
		show slide trigger_item of front slideshow -- show title of show
	end tell
	-- get QTP ready
	tell application "QuickTime Player" to activate
	-- run
	repeat with trigger in trigger_points
		set trigger_item to trigger_item + 1 -- slide number (2,3,4,...)
		repeat while trigger_current < trigger or (trigger is 0)
			delay 1 -- s  to reduce processing burden	
			try -- check video progress, allowing for possible errors such as stopped (pause is OK)
				tell application "QuickTime Player" to set trigger_current to current time of document 1
			end try
		end repeat
		tell application "Keynote" to show slide trigger_item of front slideshow -- post-video content update rather than pre-		
	end repeat
end start

on finalise()
	-- shutdown both applications
		tell application "Keynote" to quit
	end try
		tell application "QuickTime Player" to quit
	end try
end finalise

Speaking of Keynotes

Most people know that a slide presentation (usually) consists of a series of slides that are shown by a presenter who manually switches the slides and "speaks to the slide content". Duh! It is possible to also set up an automated slideshow usually without narration. But it is possible for Keynote to generate and perform the whole thing, including narration, (almost) unaided.

That's right the presentation is done entirely by the computer- including speaking! Most people would think that this is done by recording a sound track and playing it as you select the slides. Well, yes you could do that, and you could just simply record the whole thing as a Quicktime movie. There is a more interesting approach.

Keynote (along with Powerpoint Presentation Manager) can have presenter notes embedded in them. In the case of Keynote the "container" is called notes. You can write the notes, and then access them using AppleScript and Applescript has a command that is called "say .."

The idea is:

  • write the presentation as a sequence of slides
  • write a narration for each slide, and place it in the notes field.
  • run the slideshow using an Applescript that treats the notes as narration text (using text-to-speech technology built into each Macintosh).

You will need a Keynote file open but not running. You will also need to put some text in the notes field (these are usually for the presenter to read, but in this case becomes what the 'presenter' says), The style should be as for a narration of a podcast - short sentences, no more than one connective and with pauses. Separating each sentence with blank lines works well.

Next you run the script shown below. This will start the process. You have to be careful about how it runs because of the lack of sophistication. The slide transitions (to the next slide) are performed by a manual press of the command key (left or right of the spacebar). This allows you to pause (for example, if you want students to copy information) at the end of the narration for each slide. It also ensures that the normal transition triggers (e.g.. spacebar, mouse button, right arrow key) don't interfere with the process. No other special considerations are required. It would be a great way to "think different" about presentations, and perhaps get an idea of how to pace a narration. Most people tend to want to speak too quickly and using sentences that are too complicated, as if in a conversation.

Obviously, there are issues, especially with intonation, pace and correct pronunciation, but it's an interesting approach. It would be nice if Apple would integrate an AppleScript entry in the Keynote dictionary, that would actually reduce this script to a few lines but until then …

Here is a short Applescript to get you started. But first download Extra Suites app.

-- Ian W. Parker First worked on: 2010-01-02 (palindromic!) last updated : 2010-01-03
-- and speak the notes in each slide, then you *manually* move on to next slide
-- duration of slide is at least time of the narration
-- requires faceless application: 'Extra Suites' to be installed to detect command key press
	tell application "Keynote"
		-- allows us to queue up the slide show.
		start from current slide of slideshow 1
		set start_slide to (slide number of current slide of slideshow 1)
		-- this is a bit too automated but works
		repeat with next_Slide in every slide of slideshow 1
			if slide number of next_Slide is less than start_slide then
				-- skip
				-- do normally		
				tell slideshow 1
					show next_Slide
					set narration to the notes of current slide
					say narration using "Alex"
					-- we halt the processing until we click on the mouse
					-- to allow for us to programmatically pause the show
					tell application "Extra Suites"
						repeat until (ES command down)
						end repeat
					end tell
				end tell
			end if
		end repeat
	end tell
on error
end try

Personal tools