<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>301824</bug_id>
          
          <creation_ts>2025-11-02 08:39:38 -0800</creation_ts>
          <short_desc>Cannot synchronise createMediaElementSource nodes</short_desc>
          <delta_ts>2026-01-05 03:56:37 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Media</component>
          <version>Safari 26</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="steve lee">steve</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>chrisguttandin</cc>
    
    <cc>jer.noble</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2155815</commentid>
    <comment_count>0</comment_count>
      <attachid>477256</attachid>
    <who name="steve lee">steve</who>
    <bug_when>2025-11-02 08:39:38 -0800</bug_when>
    <thetext>Created attachment 477256
Test web page (required .wavs are at the link in description)

Playing two audio elements via webAudio alows audio files to be merged as well as played / paused. This is the basis of a simple mixer app using web audio (https://mixer.vision-score.com/)

To reproduce please  see the hosted example at https://mixer.vision-score.com/test-sync/ which also show the minimal source code (also attached here).

In Chrome the two audio files play in perfect sync. In Firefox they&apos;re very slightly blurred but in Safari webkit (macOS and iOS) they are particularly out, making the mixer unusable.

This is a serious problem as users will be on iPadOS and as far as I know real chrome is STILL not available there (despite EU mumblings).

I&apos;ve wracked my brains but cannot find anoteher way to do this. Using audio buffer nodes suffer from needing to be in memory and they have no pause / resume.

Is there a solution? Other than say use Chrome on Mac only!? It seems a weakness of the webAudio spec to be honest.

Thanks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2156163</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-11-03 20:39:26 -0800</bug_when>
    <thetext>steve,
thanks for the reports. 
https://mixer.vision-score.com/test-sync/

What am I supposed to hear?
I have different results. 

On Firefox I have consistently, be after pause or from the beginning.
1 2 3 A 1 2 3 A

On Chrome it depends on the moments.
Most of the time I have Firefox case, but sometimes I got a non aligned sound. 

On Safari, I have different paces. Such as quick pace. 
Something which sounds like pi-ti pi-ti pi-ti pa-ta
Sometimes almost aligned. 

Are the two soundwaves the same? 
https://mixer.vision-score.com/test-sync/click.wav
https://mixer.vision-score.com/test-sync/click2.wav

 ha yes. There are both the same. 


Did you try createBufferSource() instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2156216</commentid>
    <comment_count>2</comment_count>
    <who name="steve lee">steve</who>
    <bug_when>2025-11-04 02:14:58 -0800</bug_when>
    <thetext>My appologies Karl for not making expectations clearer.

- Yes the two audio waveform files are identical (I thought safer not to share a sigle instance)
- should be A 1 2 3 ....
- With perfect sync you should hear a clear single track identical to playing one (should have add a play one option, though could download to play) The waveforms / samples will add and be mixed in the audioContext destination (or another node)
- With slightly out timing you&apos;ll hear a fuzzing or flanging effect - the clicks lose clarity
- WIth larger discrepency you hear multiple clicks - the problem I hear on iOS 

So I found the opposite to you on Windows: 
- Chrome - perfect however often I hit play / pause
- Firefox - blurred from start or after mashing play/pause
- Edge - As Chrome but louder (?)

on iPadOS 
- Safari - always multiple clicks
- &quot;Chrome&quot; - good first time but mutiple clicks after pause

on Mac Safari
 - as iPadOS

Looking at the spec there seems no clear requirement for Media nodes to remain in sync - oops. Also, there&apos;s little about levels when mixing multiple inputs - which may be why Edge seems to double the volume (though I understand it uses same chromium engine as Chrome?)

As I previously hinted I had concerns about using Buffer nodes because:
- need to fully load audio into memory (30 stereo channels for 5 mins is a lot of samples and could not find any browser limits) . Though for all I know media nodes do this, esp when loaded with a blob as my main mixer app does) 
- no obvious way to pause and resume

I now see I could probably simulate play after pause by using a start() offset time. But have to recreate all the nodes each time (not source buffer fortunately). Plus just spotted that AudioContext has a pause() method.

So I will now try Buffer Nodes and see how that goes.

But this might be a bug - or not - as the spec is silent on the matter. I think that Chrome on WIndows behaviour is ideal - ie keep all nodes always in sync despite pause.

Thanks for your time</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2156238</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-11-04 03:29:28 -0800</bug_when>
    <thetext>If there is a missing feature for the spec, that could be a good opportunity to open an issue on the spec itself. 
https://github.com/WebAudio/web-audio-api/issues/

I&apos;m not an expert in this area. Probably Jer will have better recommendations than me.

I wonder if it relates to 
https://github.com/WebAudio/web-audio-api/issues/257
which links to https://github.com/w3c/webcodecs?tab=readme-ov-file</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2156255</commentid>
    <comment_count>4</comment_count>
    <who name="steve lee">steve</who>
    <bug_when>2025-11-04 04:54:45 -0800</bug_when>
    <thetext>Yes, I thought I&apos;d review the spec carefully. It&apos;ll be lime being back at the W3C!

I&apos;ll check thos bugs, thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2156272</commentid>
    <comment_count>5</comment_count>
    <who name="steve lee">steve</who>
    <bug_when>2025-11-04 06:21:18 -0800</bug_when>
    <thetext>Let&apos;s see - https://github.com/WebAudio/web-audio-api/issues/2652</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2157271</commentid>
    <comment_count>6</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2025-11-07 09:19:38 -0800</bug_when>
    <thetext>There&apos;s no requirement that two &lt;audio&gt; elements remain in sync with each other; networking issues, decoder hiccups, sample rate drift all might cause timebases to get desynchronized. 

There _used_ to be a web API that explicitly tied together the timebases of multiple media elements, but Chrome removed it, then removed the API from HTML: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/controller

If you want sample accurate playback, you really need a BufferSource, not a HTMLMediaElement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2157282</commentid>
    <comment_count>7</comment_count>
    <who name="steve lee">steve</who>
    <bug_when>2025-11-07 10:08:34 -0800</bug_when>
    <thetext>@jer Thanks for the background.

It seems a big hole in the spec not to unify but now I&apos;ve discovered I can pause the context,  using buffer nodes is less of an issue as don&apos;t have to recreate all the nodes to resume after pause. Not sure about loop yet.

As my waveforms are blobs loaded from local files there&apos;s no network issues, but without master time track we&apos;re vunerable to those other issues. Have to figure looping though.

Thanks again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2157497</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-11-09 08:40:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/164352153&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2169265</commentid>
    <comment_count>9</comment_count>
    <who name="steve lee">steve</who>
    <bug_when>2026-01-05 03:56:37 -0800</bug_when>
    <thetext>Sibi switched to using buffers, despite MDN stating only suitable for small files (spec doesn&apos;t, but could find no details on browser memory constraints).

It works perfectly, even on iOS Safari. 30 odd channels each with two CSS based peak meters, no problem. (https://mixer.vision-score.com/?demo=true)

Only problem is needing to fetch() if online files means a load delay and now hits CORs errors not experienced with MediaElement. Oh well. That&apos;s life.

Thanks.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>477256</attachid>
            <date>2025-11-02 08:39:38 -0800</date>
            <delta_ts>2025-11-02 08:39:38 -0800</delta_ts>
            <desc>Test web page (required .wavs are at the link in description)</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>1539</size>
            <attacher name="steve lee">steve</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDx0aXRsZT5UZXN0
IGF1ZGlvIHN5bmNgPC90aXRsZT4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04IiAvPgogIDwvaGVh
ZD4KCiAgPHN0eWxlPjwvc3R5bGU+CgogIDxib2R5PgogICAgPGgxPlRlc3QgYXVkaW8gc3luYzwv
aDE+CiAgICA8YnV0dG9uIG9uY2xpY2s9InBsYXlBdWRpbygpIj5QbGF5IC8gUGF1c2U8L2J1dHRv
bj4KICA8L2JvZHk+CgogIDxzY3JpcHQ+CiAgICBsZXQgYXVkaW9Db250ZXh0CiAgICBsZXQgYXVk
aW8xLCBhdWRpbzIKCiAgICBmdW5jdGlvbiBwbGF5QXVkaW8oKSB7CiAgICAgIGlmICghYXVkaW9D
b250ZXh0KSB7CiAgICAgICAgYXVkaW9Db250ZXh0ID0gbmV3IEF1ZGlvQ29udGV4dCgpCgogICAg
ICAgIGF1ZGlvMSA9IG5ldyBBdWRpbygnLi9jbGljay53YXYnKQogICAgICAgIGNvbnN0IGExID0g
YXVkaW9Db250ZXh0LmNyZWF0ZU1lZGlhRWxlbWVudFNvdXJjZShhdWRpbzEpCiAgICAgICAgYXVk
aW8yID0gbmV3IEF1ZGlvKCcuL2NsaWNrMi53YXYnKSAvLyBjbG9uZSBvZiBjbGljawogICAgICAg
IGNvbnN0IGEyID0gYXVkaW9Db250ZXh0LmNyZWF0ZU1lZGlhRWxlbWVudFNvdXJjZShhdWRpbzIp
CgogICAgICAgIGExLmNvbm5lY3QoYXVkaW9Db250ZXh0LmRlc3RpbmF0aW9uKQogICAgICAgIGEy
LmNvbm5lY3QoYXVkaW9Db250ZXh0LmRlc3RpbmF0aW9uKQogICAgICB9CgogICAgICBmdW5jdGlv
biB0b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

</bugzilla>