Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(narration): make embedded audio marker visible

hugohe30b686a272ecd
diff --git a/skills/ppt-master/scripts/native_narration_pptx.py b/skills/ppt-master/scripts/native_narration_pptx.py
index f9169934..047030e6 100644
--- a/skills/ppt-master/scripts/native_narration_pptx.py
+++ b/skills/ppt-master/scripts/native_narration_pptx.py
@@ -50,11 +50,11 @@ from svg_to_pptx.pptx_builder import ( # noqa: E402
)
from svg_to_pptx.pptx_narration import ( # noqa: E402
AUDIO_CONTENT_TYPES,
+ AUDIO_MARKER_PNG_BYTES,
AUDIO_REL_TYPE,
IMAGE_REL_TYPE,
MEDIA_REL_TYPE,
NARRATION_EXTENSIONS,
- TRANSPARENT_PNG_BYTES,
apply_recorded_timing,
inject_narration,
next_shape_id,
@@ -360,7 +360,7 @@ def _apply_audio(
poster_name = "native_enhance_audio_poster.png"
poster_path = media_dir / poster_name
if not poster_path.exists():
- poster_path.write_bytes(TRANSPARENT_PNG_BYTES)
+ poster_path.write_bytes(AUDIO_MARKER_PNG_BYTES)
slide_rels = _relationship_file_for_part(extract_dir, slide.part_name)
_ensure_rels_file(slide_rels)
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
index 0920a9c4..68b90130 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py
@@ -43,9 +43,9 @@ from .pptx_notes import (
from .pptx_narration import (
AUDIO_CONTENT_TYPES,
AUDIO_REL_TYPE,
+ AUDIO_MARKER_PNG_BYTES,
IMAGE_REL_TYPE,
MEDIA_REL_TYPE,
- TRANSPARENT_PNG_BYTES,
apply_recorded_timing,
inject_narration,
next_shape_id,
@@ -1081,7 +1081,7 @@ def create_pptx_with_native_svg(
poster_name = 'narration_poster.png'
poster_path = media_dir / poster_name
if not poster_path.exists():
- poster_path.write_bytes(TRANSPARENT_PNG_BYTES)
+ poster_path.write_bytes(AUDIO_MARKER_PNG_BYTES)
has_any_image = True
image_exts_used.add('png')
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_narration.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_narration.py
index c85efb29..b43422b9 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_narration.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_narration.py
@@ -21,9 +21,18 @@ AUDIO_CONTENT_TYPES = {
NARRATION_EXTENSIONS = tuple(AUDIO_CONTENT_TYPES.keys())
-TRANSPARENT_PNG_BYTES = base64.b64decode(
- "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAFgwJ/"
- "lBf7WQAAAABJRU5ErkJggg=="
+AUDIO_MARKER_SIZE_EMU = 457200 # 48 SVG px
+AUDIO_MARKER_PNG_BYTES = base64.b64decode(
+ "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABsUlEQVR4nO2aQZaDIAyG"
+ "cd4cQRdzgHqxeiy9mB5gFvUO7Qon0gAhJEDf+G/a92rJ9ycEqNaYS3XVSQ94uz+esWu"
+ "2ZRCLKzIQBdqnXDPsL+dA+8Qx88UJpAHPHTfJsRY4Jmo1yBUoCZ8Sj2SgNHxK3KiBWv"
+ "DU+EEDteGtQhxeA63AW/l4WMuolNa5zx4DNaCd/XXuWfAY15sBTXguOJTL9501GlG50"
+ "Ovc/xpjzDjtP+5nqj0gkXEL7763OhmQmj4S4FZY1iGnaAUkwQMxTlWouoz65CYBq4LV"
+ "0cTU6VMgw8frOO3e6273x3Nbhq7JCmCCVYDTqDkDMOuUajdnIFWXgdq6DEgLNm5oGbV"
+ "qzoBPcOmES+qxkW3L0FE2s1BWJDa5cdqjm5gxf7ddmqyAC4+dQq1EDYzTTpq3mTFO56"
+ "KTAam7xpJGsOxDTtUpJGEEZhw7lRb5SWlNcJs8dJx+q4DkwwcEJLsiLh86hTRNGMM3g"
+ "nFVXUYlGt1rQLsKqfLxBCvQiokQR3QK1TYRi0/qgVomKHHJTVzaBDUeC0rzBnBqoljL"
+ "qFY1OOP+3yf1PpX+r8TH6wW14c3/7xdFRAAAAABJRU5ErkJggg=="
)
@@ -104,7 +113,7 @@ def create_audio_pic_xml(
media_rid: str,
poster_rid: str,
) -> str:
- """Create a tiny audio picture shape carrying narration media."""
+ """Create a visible audio picture shape carrying narration media."""
return f'''<p:pic>
<p:nvPicPr>
<p:cNvPr id="{shape_id}" name="{shape_name}">
@@ -129,7 +138,7 @@ def create_audio_pic_xml(
<p:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
- <a:ext cx="1" cy="1"/>
+ <a:ext cx="{AUDIO_MARKER_SIZE_EMU}" cy="{AUDIO_MARKER_SIZE_EMU}"/>
</a:xfrm>
<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>
</p:spPr>