diff --git a/templates/opera2an.xslt b/templates/opera2an.xslt
index 023fae88392aa93082108ae600028f10419f2e53..a2a73f0357232abb204aac80375594d737a838f0 100644
--- a/templates/opera2an.xslt
+++ b/templates/opera2an.xslt
@@ -11,7 +11,12 @@
     xmlns:tei="http://www.tei-c.org/ns/1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.akomantoso.org/2.0 ./akomantoso20.xsd"
-    xmlns="http://www.akomantoso.org/2.0">
+    xmlns="http://www.akomantoso.org/2.0"
+    xmlns:date="http://exslt.org/dates-and-times"
+    extension-element-prefixes="date">
+
+<xsl:param name="START-TIME" />
+<xsl:param name="PERFORMANCE" />
 
 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
 
@@ -62,23 +67,100 @@
   </debateBody>
 </xsl:template>
 
+<xsl:template name="sum-preceding-performance-time">
+  <!-- FIXME The startTimes that you calculate here are actually out
+       by one cue: you're actually logging the startTime *including*
+       the time that elapses during the track. -->
+  <xsl:param name="ptr" />
+  <xsl:param name="acc" select="number(0)" />
+
+  <xsl:choose>
+    <xsl:when test="$ptr/preceding::tei:ptr[contains(@cRef,$PERFORMANCE)]">
+      <xsl:variable name="audio-cue-id"><xsl:value-of select="substring-after($ptr/@target,'#')" /></xsl:variable>
+      <xsl:variable name="track" select="document('../der-ring-des-nibelungen/audio-cues.xml')//cue[@id=$audio-cue-id]" />
+    
+      <xsl:call-template name="sum-preceding-performance-time">
+        <xsl:with-param name="ptr" select="$ptr/preceding::tei:ptr[contains(@cRef,$PERFORMANCE)][1]" />
+        <xsl:with-param name="acc" select="number($acc) + number($track/seconds)" />
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$acc" />
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template match="tei:sg[not(tei:stage)]">
-  <speech by="#{translate(tei:singer[1]/@who,' ','-')}">
-    <xsl:apply-templates/>
-  </speech>
+  <xsl:choose>
+    <xsl:when test=".//tei:ptr[contains(@cRef,$PERFORMANCE)]">
+      <xsl:variable name="audio-cue" select=".//tei:ptr[contains(@cRef,$PERFORMANCE)][1]" />
+      <!--
+      <xsl:variable name="audio-cue-id"><xsl:value-of select="substring-after($audio-cue/@target,'#')" /></xsl:variable>
+      <xsl:variable name="track" select="document('../der-ring-des-nibelungen/audio-cues.xml')//cue[@id=$audio-cue-id]" />
+      <xsl:message>[no stage] Found track: <xsl:value-of select="$track/performance" />: <xsl:value-of select="$track/tracksort" /></xsl:message>
+      -->
+      <xsl:variable name="elapsed-time"><xsl:call-template name="sum-preceding-performance-time"><xsl:with-param name="ptr" select="$audio-cue" /></xsl:call-template></xsl:variable>
+      <xsl:variable name="start-time"><xsl:value-of select="date:add(date:date($START-TIME), date:duration($elapsed-time))" /></xsl:variable>
+      <!--
+      <xsl:message>[no stage] Elapsed time: "<xsl:value-of select="$elapsed-time" />"; start-time: "<xsl:value-of select="$start-time" />"</xsl:message>
+      -->
+      <speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="{$start-time}">
+        <xsl:apply-templates/>
+      </speech>
+    </xsl:when>
+    <xsl:when test="position()=1">
+      <speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="$START-TIME">
+        <xsl:apply-templates/>
+      </speech>
+    </xsl:when>
+    <xsl:otherwise>
+      <speech by="#{translate(tei:singer[1]/@who,' ','-')}">
+        <xsl:apply-templates/>
+      </speech>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:key name="stageKey" match="tei:sg/*[not(self::tei:singer|self::tei:stage)]"
          use="concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1]))" />
 
 <xsl:template match="tei:sg[tei:stage]">
-  <xsl:for-each select="*[generate-id() = generate-id(key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))[1])]">
-    <xsl:apply-templates select="preceding-sibling::tei:stage[1]" />
-    <speech by="#{translate(../tei:singer[1]/@who,' ','-')}">
-      <xsl:apply-templates select="../tei:singer[1]" />
-      <xsl:apply-templates select="key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))" />
-    </speech>
-  </xsl:for-each>
+  <xsl:choose>
+    <xsl:when test=".//tei:ptr[contains(@cRef,$PERFORMANCE)]">
+      <xsl:variable name="audio-cue" select=".//tei:ptr[contains(@cRef,$PERFORMANCE)][1]" />
+      <!--
+      <xsl:variable name="audio-cue-id"><xsl:value-of select="substring-after($audio-cue/@target,'#')" /></xsl:variable>
+      <xsl:variable name="track" select="document('../der-ring-des-nibelungen/audio-cues.xml')//cue[@id=$audio-cue-id]" />
+      <xsl:message>[stage] Found track: <xsl:value-of select="$track/performance" />: <xsl:value-of select="$track/tracksort" /></xsl:message>
+      -->
+      <xsl:variable name="elapsed-time"><xsl:call-template name="sum-preceding-performance-time"><xsl:with-param name="ptr" select="$audio-cue" /></xsl:call-template></xsl:variable>
+      <xsl:variable name="start-time"><xsl:value-of select="date:add(date:date($START-TIME), date:duration($elapsed-time))" /></xsl:variable>
+      <!--
+      <xsl:message>[stage] Elapsed time: "<xsl:value-of select="$elapsed-time" />"; start-time: "<xsl:value-of select="$start-time" />"</xsl:message>
+      -->
+      <xsl:for-each select="*[generate-id() = generate-id(key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))[1])]">
+        <xsl:apply-templates select="preceding-sibling::tei:stage[1]" />
+        <xsl:element name="speech">
+          <xsl:attribute name="by">#<xsl:value-of select="translate(../tei:singer[1]/@who,' ','-')" /></xsl:attribute>
+          <xsl:if test="position()=1"><xsl:attribute name="startTime"><xsl:value-of select="$start-time" /></xsl:attribute></xsl:if>
+          <xsl:apply-templates select="../tei:singer[1]" />
+          <xsl:apply-templates select="key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))" />
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="first" select="position()=1" />
+      <xsl:for-each select="*[generate-id() = generate-id(key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))[1])]">
+        <xsl:apply-templates select="preceding-sibling::tei:stage[1]" />
+        <xsl:element name="speech">
+          <xsl:if test="$first"><xsl:attribute name="startTime"><xsl:value-of select="$START-TIME" /></xsl:attribute></xsl:if>
+          <xsl:attribute name="by">#<xsl:value-of select="translate(../tei:singer[1]/@who,' ','-')" /></xsl:attribute>
+          <xsl:apply-templates select="../tei:singer[1]" />
+          <xsl:apply-templates select="key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))" />
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="tei:stage">
@@ -117,6 +199,50 @@
   </subHeading>
 </xsl:template>
 
+<xsl:template match="tei:ptr[contains(@target,'audio-cues')]">
+<!-- FIXME How will we get the Toma.HK JavaScript source into the HTML <head>? -->
+  <xsl:variable name="audio-cue-id"><xsl:value-of select="substring-after(@target,'#')" /></xsl:variable>
+  <xsl:variable name="track" select="document('../der-ring-des-nibelungen/audio-cues.xml')//cue[@id=$audio-cue-id]" />
+  <!--
+  <xsl:message>[ptr] Found track: <xsl:value-of select="$track/performance" /> <xsl:value-of select="$track/tracksort" /></xsl:message>
+  -->
+  <script>
+var track;
+<!-- FIXME What arguments should we send to this Track function? Do we actually have anything that will retrieve what we want? -->
+track = window.tomahkAPI.Track("<xsl:value-of select="$track/track" />","<xsl:value-of select="substring-before($track/performance, '19')" />", {
+    width:,
+    height:,
+    disabledResolvers: [
+        "",
+        ""
+        // options: "SoundCloud", "Officialfm", "Lastfm", "Jamendo", "Youtube", "Rdio", "SpotifyMetadata", "Deezer", "Exfm"
+    ],
+    handlers: {
+        onloaded: function() {
+            log(track.connection+":\n  api loaded");
+        },
+        onended: function() {
+            log(track.connection+":\n  Song ended: "+track.artist+" - "+track.title);
+        },
+        onplayable: function() {
+            log(track.connection+":\n  playable");
+        },
+        onresolved: function(resolver, result) {
+            log(track.connection+":\n  Track found: "+resolver+" - "+ result.track + " by "+result.artist);
+        },
+        ontimeupdate: function(timeupdate) {
+            var currentTime = timeupdate.currentTime;
+            var duration = timeupdate.duration;
+            currentTime = parseInt(currentTime);
+            duration = parseInt(duration);
+
+            log(track.connection+":\n  Time update: "+currentTime + " "+duration);
+        }
+    }
+});
+</script>
+</xsl:template>
+
 <xsl:template match="tei:role"/>
 <xsl:template match="tei:voice"/>
 <xsl:template match="tei:roleDesc"/>