TEMPO: play a sound in animated GIF/PDF/SVGHow to include audio file in PDFHow to define the default vertical distance between nodes?Play animated graphic when “next slide” is clickedbeamer: How to play movies in their original size?Numerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?standalone mode=image with animated pdfLine up nested tikz enviroments or how to get rid of themHow to animate SVG paths as an animated PDF with animate?

Is this n-speak?

Not going forward with internship interview process

How to create events observer that only call when REST api dispatch events?

Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?

If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?

Can sampling rate be a floating point number?

Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?

is this F 6'9 chord a figured bass or a chord extension?

Why command hierarchy, if the chain of command is standing next to each other?

When does Tiana, Ship's Caretaker check card type?

Is God unknowable?

How to take the beginning and end parts of a list with simpler syntax?

Can anybody explain why using multicolumn changes the width of the four-column tabular environment?

The cat ate your input again!

Why did Gandalf use a sword against the Balrog?

TEMPO: play a sound in animated GIF/PDF/SVG

How does "Te vas a cansar" mean "You're going to get tired"?

Is it feasible to get a hash collision for CRC32, MD-5 and SHA-1 on one file?

How to describe accents?

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

Enigma between Collegues (Part1)

Why is there a large performance impact when looping over an array over 240 elements?

On math looking obvious in retrospect

Are differences between uniformly distributed numbers uniformly distributed?



TEMPO: play a sound in animated GIF/PDF/SVG


How to include audio file in PDFHow to define the default vertical distance between nodes?Play animated graphic when “next slide” is clickedbeamer: How to play movies in their original size?Numerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?standalone mode=image with animated pdfLine up nested tikz enviroments or how to get rid of themHow to animate SVG paths as an animated PDF with animate?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








6















When practicing piano, TEMPO (an app on iOS, CHplay) is a metronome that often be used to beat on time.



I can make animated GIF/PDF/SVG/frame (in beamer) for TEMPO, but don't know how to play a sound (for example beep 8, mp3 or wav in here) at each beat.



Can anyone help (with full code and clear explanation)? Thank you!



enter image description here



The following code are my MWEs. (these are good examples on animated things)



% TEMPO for piano tempo.tex
% for animated GIF, run on command line (require ImageMagick installed)
% magick -density 200 -delay 100 tempo.pdf tempo.gif
% -delay 100 >>> each frame is 100/100 = 1 second
documentclass[tikz]standalone
begindocument
foreach n in 1,...,4
pagecolorwhite
begintikzpicture
path (0,-1) rectangle (5,1);
shade[inner color=green,outer color=green!10]
(n,0) circle(.5);
foreach i in 1,...,4
fill[cyan] (i,0) circle(.3);
endtikzpicture

enddocument


With minor changes, we can get animated PDF (open in Acrobat Reader).



% animated PDF standalone tempopdf.tex
% multiframe4n=1+1 >>> starting frame is with n=1,
% then plus 1 each frame, so we have 4 frames
% [loop,controls]1 >>> number 1 means 1 second each frame
documentclassstandalone
usepackagetikz
usepackageanimate
begindocument
beginanimateinline[loop,controls]1
multiframe4n=1+1

begintikzpicture
path (0,-1) rectangle (5,1);
shade[inner color=green,outer color=green!10]
(n,0) circle(.6);
foreach i in 1,...,4
fill[cyan] (i,0) circle(.3);
endtikzpicture

endanimateinline
enddocument


Animated PDF frame in beamer (open with Acrobat Reader)



% animated PDF frame in beamer (open with Acrobat Reader)
documentclassbeamer
usepackagetikz
usepackageanimate
usepackagemultimedia
begindocument
beginframeTEMPO for piano
begincenter
beginanimateinline[loop,controls]1
multiframe4n=1+1

begintikzpicture
path (0,-1) rectangle (5,1);
shade[inner color=green,outer color=green!10] (n,0) circle(.6);
foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
endtikzpicture

endanimateinline
endcenter
endframe
enddocument









share|improve this question
































    6















    When practicing piano, TEMPO (an app on iOS, CHplay) is a metronome that often be used to beat on time.



    I can make animated GIF/PDF/SVG/frame (in beamer) for TEMPO, but don't know how to play a sound (for example beep 8, mp3 or wav in here) at each beat.



    Can anyone help (with full code and clear explanation)? Thank you!



    enter image description here



    The following code are my MWEs. (these are good examples on animated things)



    % TEMPO for piano tempo.tex
    % for animated GIF, run on command line (require ImageMagick installed)
    % magick -density 200 -delay 100 tempo.pdf tempo.gif
    % -delay 100 >>> each frame is 100/100 = 1 second
    documentclass[tikz]standalone
    begindocument
    foreach n in 1,...,4
    pagecolorwhite
    begintikzpicture
    path (0,-1) rectangle (5,1);
    shade[inner color=green,outer color=green!10]
    (n,0) circle(.5);
    foreach i in 1,...,4
    fill[cyan] (i,0) circle(.3);
    endtikzpicture

    enddocument


    With minor changes, we can get animated PDF (open in Acrobat Reader).



    % animated PDF standalone tempopdf.tex
    % multiframe4n=1+1 >>> starting frame is with n=1,
    % then plus 1 each frame, so we have 4 frames
    % [loop,controls]1 >>> number 1 means 1 second each frame
    documentclassstandalone
    usepackagetikz
    usepackageanimate
    begindocument
    beginanimateinline[loop,controls]1
    multiframe4n=1+1

    begintikzpicture
    path (0,-1) rectangle (5,1);
    shade[inner color=green,outer color=green!10]
    (n,0) circle(.6);
    foreach i in 1,...,4
    fill[cyan] (i,0) circle(.3);
    endtikzpicture

    endanimateinline
    enddocument


    Animated PDF frame in beamer (open with Acrobat Reader)



    % animated PDF frame in beamer (open with Acrobat Reader)
    documentclassbeamer
    usepackagetikz
    usepackageanimate
    usepackagemultimedia
    begindocument
    beginframeTEMPO for piano
    begincenter
    beginanimateinline[loop,controls]1
    multiframe4n=1+1

    begintikzpicture
    path (0,-1) rectangle (5,1);
    shade[inner color=green,outer color=green!10] (n,0) circle(.6);
    foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
    endtikzpicture

    endanimateinline
    endcenter
    endframe
    enddocument









    share|improve this question




























      6












      6








      6


      2






      When practicing piano, TEMPO (an app on iOS, CHplay) is a metronome that often be used to beat on time.



      I can make animated GIF/PDF/SVG/frame (in beamer) for TEMPO, but don't know how to play a sound (for example beep 8, mp3 or wav in here) at each beat.



      Can anyone help (with full code and clear explanation)? Thank you!



      enter image description here



      The following code are my MWEs. (these are good examples on animated things)



      % TEMPO for piano tempo.tex
      % for animated GIF, run on command line (require ImageMagick installed)
      % magick -density 200 -delay 100 tempo.pdf tempo.gif
      % -delay 100 >>> each frame is 100/100 = 1 second
      documentclass[tikz]standalone
      begindocument
      foreach n in 1,...,4
      pagecolorwhite
      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10]
      (n,0) circle(.5);
      foreach i in 1,...,4
      fill[cyan] (i,0) circle(.3);
      endtikzpicture

      enddocument


      With minor changes, we can get animated PDF (open in Acrobat Reader).



      % animated PDF standalone tempopdf.tex
      % multiframe4n=1+1 >>> starting frame is with n=1,
      % then plus 1 each frame, so we have 4 frames
      % [loop,controls]1 >>> number 1 means 1 second each frame
      documentclassstandalone
      usepackagetikz
      usepackageanimate
      begindocument
      beginanimateinline[loop,controls]1
      multiframe4n=1+1

      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10]
      (n,0) circle(.6);
      foreach i in 1,...,4
      fill[cyan] (i,0) circle(.3);
      endtikzpicture

      endanimateinline
      enddocument


      Animated PDF frame in beamer (open with Acrobat Reader)



      % animated PDF frame in beamer (open with Acrobat Reader)
      documentclassbeamer
      usepackagetikz
      usepackageanimate
      usepackagemultimedia
      begindocument
      beginframeTEMPO for piano
      begincenter
      beginanimateinline[loop,controls]1
      multiframe4n=1+1

      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10] (n,0) circle(.6);
      foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
      endtikzpicture

      endanimateinline
      endcenter
      endframe
      enddocument









      share|improve this question
















      When practicing piano, TEMPO (an app on iOS, CHplay) is a metronome that often be used to beat on time.



      I can make animated GIF/PDF/SVG/frame (in beamer) for TEMPO, but don't know how to play a sound (for example beep 8, mp3 or wav in here) at each beat.



      Can anyone help (with full code and clear explanation)? Thank you!



      enter image description here



      The following code are my MWEs. (these are good examples on animated things)



      % TEMPO for piano tempo.tex
      % for animated GIF, run on command line (require ImageMagick installed)
      % magick -density 200 -delay 100 tempo.pdf tempo.gif
      % -delay 100 >>> each frame is 100/100 = 1 second
      documentclass[tikz]standalone
      begindocument
      foreach n in 1,...,4
      pagecolorwhite
      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10]
      (n,0) circle(.5);
      foreach i in 1,...,4
      fill[cyan] (i,0) circle(.3);
      endtikzpicture

      enddocument


      With minor changes, we can get animated PDF (open in Acrobat Reader).



      % animated PDF standalone tempopdf.tex
      % multiframe4n=1+1 >>> starting frame is with n=1,
      % then plus 1 each frame, so we have 4 frames
      % [loop,controls]1 >>> number 1 means 1 second each frame
      documentclassstandalone
      usepackagetikz
      usepackageanimate
      begindocument
      beginanimateinline[loop,controls]1
      multiframe4n=1+1

      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10]
      (n,0) circle(.6);
      foreach i in 1,...,4
      fill[cyan] (i,0) circle(.3);
      endtikzpicture

      endanimateinline
      enddocument


      Animated PDF frame in beamer (open with Acrobat Reader)



      % animated PDF frame in beamer (open with Acrobat Reader)
      documentclassbeamer
      usepackagetikz
      usepackageanimate
      usepackagemultimedia
      begindocument
      beginframeTEMPO for piano
      begincenter
      beginanimateinline[loop,controls]1
      multiframe4n=1+1

      begintikzpicture
      path (0,-1) rectangle (5,1);
      shade[inner color=green,outer color=green!10] (n,0) circle(.6);
      foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
      endtikzpicture

      endanimateinline
      endcenter
      endframe
      enddocument






      tikz-pgf asymptote animate media9 multimedia






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago







      Black Mild

















      asked 12 hours ago









      Black MildBlack Mild

      1,7748 silver badges14 bronze badges




      1,7748 silver badges14 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          10














          Click on the image below to see the ticking metronome (SVG version) in action:





          The animate-based example comes in two versions.



          The PDF version requires Acrobat Reader and is thus restricted to Windows and OSX platforms for desktop PCs. (Mobile devices are not supported.)
          The PDF version uses media9 for playing the embedded sound file click.mp3, taken from the animate package which already provides a ticking metronome example in its manual.



          The standalone SVG version runs in most contemporary Web browsers (Firefox, Chrome, Opera ...), even on mobile devices. Here the sound is "embedded" using the <audio> tag, but the sound file itself is separate, not physically embedded, and must be bundled with the SVG file.



          In either case, playback of the sound is started by JavaScript on every frame change of the running animation. The "timeline" feature of animate is used to associate the JS code with each frame.



          PDF version, to be compiled with pdflatex, latex+dvips+ps2pdf, or xelatex:



          documentclassbeamer
          usepackagetikz
          usepackageanimate
          usepackagemedia9

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: annotRM['click'].callAS('play');
          ::1: annotRM['click'].callAS('play');
          ::2: annotRM['click'].callAS('play');
          ::3: annotRM['click'].callAS('play');
          endfilecontents*

          begindocument
          beginframeTEMPO for piano
          begincenter
          %the sound player
          makebox[0pt][r]includemedia[
          width=1ex,height=1ex,
          label=click,
          addresource=click.mp3,
          activate=pageopen,transparent,noplaybutton,
          flashvars=source=click.mp3&hideBar=true
          ]APlayer.swf%
          % animation provided by OP
          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          endcenter
          endframe
          enddocument


          SVG version, to be compiled with



          latex tempoForWeb.tex
          latex tempoForWeb.tex
          dvisvgm --font-format=woff --exact --zoom=-1 tempoForWeb.dvi


          The SVG can be viewed standalone in a Web browser, or embedded by means of the <object> HTML tag.



          documentclass[dvisvgm,preview]standalone

          usepackagetikz
          usepackageanimate

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: myClick.play();
          ::1: myClick.play();
          ::2: myClick.play();
          ::3: myClick.play();
          endfilecontents*

          begindocument
          specialdvisvgm:rawdef
          <audio xmlns="http://www.w3.org/1999/xhtml" id='click'>
          <source src="click.mp3" type="audio/mpeg"/>
          </audio>
          <script type="text/javascript">
          <![CDATA[
          var myClick = document.getElementById('click');
          function playClick ()
          try myClick.play(); catch (e) console.log(e);

          ]]>
          </script>

          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          enddocument


          Standalone, animated GIF is dumb and deaf, afaik, and there does not seem to exist an easily accessible method to synchronize an embedded Gif (in a Web page) with a sound. But SVG is much superior, since it is vectorial and thus freely scalable.






          share|improve this answer






















          • 1





            Wow, it is very beautiful. :-) +1

            – Sebastiano
            9 hours ago






          • 2





            @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

            – AlexG
            8 hours ago












          • Done now for all the users :-)

            – Sebastiano
            8 hours ago












          • @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

            – Black Mild
            7 hours ago











          • You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

            – AlexG
            7 hours ago


















          1














          You can alternatively do the animation elsewhere with sound and add that to the Beamer Files. Beamer seems to have an multimedia package. Also movie15 seems to be promising.



          Look at this thread about Multimedia/sound How to include audio file in PDF, maybe thats a valid startingpoint.






          share|improve this answer








          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • Could you provide full code with some explanation?

            – Black Mild
            12 hours ago











          • Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

            – Sango
            11 hours ago













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f503886%2ftempo-play-a-sound-in-animated-gif-pdf-svg%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          10














          Click on the image below to see the ticking metronome (SVG version) in action:





          The animate-based example comes in two versions.



          The PDF version requires Acrobat Reader and is thus restricted to Windows and OSX platforms for desktop PCs. (Mobile devices are not supported.)
          The PDF version uses media9 for playing the embedded sound file click.mp3, taken from the animate package which already provides a ticking metronome example in its manual.



          The standalone SVG version runs in most contemporary Web browsers (Firefox, Chrome, Opera ...), even on mobile devices. Here the sound is "embedded" using the <audio> tag, but the sound file itself is separate, not physically embedded, and must be bundled with the SVG file.



          In either case, playback of the sound is started by JavaScript on every frame change of the running animation. The "timeline" feature of animate is used to associate the JS code with each frame.



          PDF version, to be compiled with pdflatex, latex+dvips+ps2pdf, or xelatex:



          documentclassbeamer
          usepackagetikz
          usepackageanimate
          usepackagemedia9

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: annotRM['click'].callAS('play');
          ::1: annotRM['click'].callAS('play');
          ::2: annotRM['click'].callAS('play');
          ::3: annotRM['click'].callAS('play');
          endfilecontents*

          begindocument
          beginframeTEMPO for piano
          begincenter
          %the sound player
          makebox[0pt][r]includemedia[
          width=1ex,height=1ex,
          label=click,
          addresource=click.mp3,
          activate=pageopen,transparent,noplaybutton,
          flashvars=source=click.mp3&hideBar=true
          ]APlayer.swf%
          % animation provided by OP
          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          endcenter
          endframe
          enddocument


          SVG version, to be compiled with



          latex tempoForWeb.tex
          latex tempoForWeb.tex
          dvisvgm --font-format=woff --exact --zoom=-1 tempoForWeb.dvi


          The SVG can be viewed standalone in a Web browser, or embedded by means of the <object> HTML tag.



          documentclass[dvisvgm,preview]standalone

          usepackagetikz
          usepackageanimate

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: myClick.play();
          ::1: myClick.play();
          ::2: myClick.play();
          ::3: myClick.play();
          endfilecontents*

          begindocument
          specialdvisvgm:rawdef
          <audio xmlns="http://www.w3.org/1999/xhtml" id='click'>
          <source src="click.mp3" type="audio/mpeg"/>
          </audio>
          <script type="text/javascript">
          <![CDATA[
          var myClick = document.getElementById('click');
          function playClick ()
          try myClick.play(); catch (e) console.log(e);

          ]]>
          </script>

          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          enddocument


          Standalone, animated GIF is dumb and deaf, afaik, and there does not seem to exist an easily accessible method to synchronize an embedded Gif (in a Web page) with a sound. But SVG is much superior, since it is vectorial and thus freely scalable.






          share|improve this answer






















          • 1





            Wow, it is very beautiful. :-) +1

            – Sebastiano
            9 hours ago






          • 2





            @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

            – AlexG
            8 hours ago












          • Done now for all the users :-)

            – Sebastiano
            8 hours ago












          • @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

            – Black Mild
            7 hours ago











          • You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

            – AlexG
            7 hours ago















          10














          Click on the image below to see the ticking metronome (SVG version) in action:





          The animate-based example comes in two versions.



          The PDF version requires Acrobat Reader and is thus restricted to Windows and OSX platforms for desktop PCs. (Mobile devices are not supported.)
          The PDF version uses media9 for playing the embedded sound file click.mp3, taken from the animate package which already provides a ticking metronome example in its manual.



          The standalone SVG version runs in most contemporary Web browsers (Firefox, Chrome, Opera ...), even on mobile devices. Here the sound is "embedded" using the <audio> tag, but the sound file itself is separate, not physically embedded, and must be bundled with the SVG file.



          In either case, playback of the sound is started by JavaScript on every frame change of the running animation. The "timeline" feature of animate is used to associate the JS code with each frame.



          PDF version, to be compiled with pdflatex, latex+dvips+ps2pdf, or xelatex:



          documentclassbeamer
          usepackagetikz
          usepackageanimate
          usepackagemedia9

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: annotRM['click'].callAS('play');
          ::1: annotRM['click'].callAS('play');
          ::2: annotRM['click'].callAS('play');
          ::3: annotRM['click'].callAS('play');
          endfilecontents*

          begindocument
          beginframeTEMPO for piano
          begincenter
          %the sound player
          makebox[0pt][r]includemedia[
          width=1ex,height=1ex,
          label=click,
          addresource=click.mp3,
          activate=pageopen,transparent,noplaybutton,
          flashvars=source=click.mp3&hideBar=true
          ]APlayer.swf%
          % animation provided by OP
          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          endcenter
          endframe
          enddocument


          SVG version, to be compiled with



          latex tempoForWeb.tex
          latex tempoForWeb.tex
          dvisvgm --font-format=woff --exact --zoom=-1 tempoForWeb.dvi


          The SVG can be viewed standalone in a Web browser, or embedded by means of the <object> HTML tag.



          documentclass[dvisvgm,preview]standalone

          usepackagetikz
          usepackageanimate

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: myClick.play();
          ::1: myClick.play();
          ::2: myClick.play();
          ::3: myClick.play();
          endfilecontents*

          begindocument
          specialdvisvgm:rawdef
          <audio xmlns="http://www.w3.org/1999/xhtml" id='click'>
          <source src="click.mp3" type="audio/mpeg"/>
          </audio>
          <script type="text/javascript">
          <![CDATA[
          var myClick = document.getElementById('click');
          function playClick ()
          try myClick.play(); catch (e) console.log(e);

          ]]>
          </script>

          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          enddocument


          Standalone, animated GIF is dumb and deaf, afaik, and there does not seem to exist an easily accessible method to synchronize an embedded Gif (in a Web page) with a sound. But SVG is much superior, since it is vectorial and thus freely scalable.






          share|improve this answer






















          • 1





            Wow, it is very beautiful. :-) +1

            – Sebastiano
            9 hours ago






          • 2





            @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

            – AlexG
            8 hours ago












          • Done now for all the users :-)

            – Sebastiano
            8 hours ago












          • @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

            – Black Mild
            7 hours ago











          • You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

            – AlexG
            7 hours ago













          10












          10








          10







          Click on the image below to see the ticking metronome (SVG version) in action:





          The animate-based example comes in two versions.



          The PDF version requires Acrobat Reader and is thus restricted to Windows and OSX platforms for desktop PCs. (Mobile devices are not supported.)
          The PDF version uses media9 for playing the embedded sound file click.mp3, taken from the animate package which already provides a ticking metronome example in its manual.



          The standalone SVG version runs in most contemporary Web browsers (Firefox, Chrome, Opera ...), even on mobile devices. Here the sound is "embedded" using the <audio> tag, but the sound file itself is separate, not physically embedded, and must be bundled with the SVG file.



          In either case, playback of the sound is started by JavaScript on every frame change of the running animation. The "timeline" feature of animate is used to associate the JS code with each frame.



          PDF version, to be compiled with pdflatex, latex+dvips+ps2pdf, or xelatex:



          documentclassbeamer
          usepackagetikz
          usepackageanimate
          usepackagemedia9

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: annotRM['click'].callAS('play');
          ::1: annotRM['click'].callAS('play');
          ::2: annotRM['click'].callAS('play');
          ::3: annotRM['click'].callAS('play');
          endfilecontents*

          begindocument
          beginframeTEMPO for piano
          begincenter
          %the sound player
          makebox[0pt][r]includemedia[
          width=1ex,height=1ex,
          label=click,
          addresource=click.mp3,
          activate=pageopen,transparent,noplaybutton,
          flashvars=source=click.mp3&hideBar=true
          ]APlayer.swf%
          % animation provided by OP
          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          endcenter
          endframe
          enddocument


          SVG version, to be compiled with



          latex tempoForWeb.tex
          latex tempoForWeb.tex
          dvisvgm --font-format=woff --exact --zoom=-1 tempoForWeb.dvi


          The SVG can be viewed standalone in a Web browser, or embedded by means of the <object> HTML tag.



          documentclass[dvisvgm,preview]standalone

          usepackagetikz
          usepackageanimate

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: myClick.play();
          ::1: myClick.play();
          ::2: myClick.play();
          ::3: myClick.play();
          endfilecontents*

          begindocument
          specialdvisvgm:rawdef
          <audio xmlns="http://www.w3.org/1999/xhtml" id='click'>
          <source src="click.mp3" type="audio/mpeg"/>
          </audio>
          <script type="text/javascript">
          <![CDATA[
          var myClick = document.getElementById('click');
          function playClick ()
          try myClick.play(); catch (e) console.log(e);

          ]]>
          </script>

          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          enddocument


          Standalone, animated GIF is dumb and deaf, afaik, and there does not seem to exist an easily accessible method to synchronize an embedded Gif (in a Web page) with a sound. But SVG is much superior, since it is vectorial and thus freely scalable.






          share|improve this answer















          Click on the image below to see the ticking metronome (SVG version) in action:





          The animate-based example comes in two versions.



          The PDF version requires Acrobat Reader and is thus restricted to Windows and OSX platforms for desktop PCs. (Mobile devices are not supported.)
          The PDF version uses media9 for playing the embedded sound file click.mp3, taken from the animate package which already provides a ticking metronome example in its manual.



          The standalone SVG version runs in most contemporary Web browsers (Firefox, Chrome, Opera ...), even on mobile devices. Here the sound is "embedded" using the <audio> tag, but the sound file itself is separate, not physically embedded, and must be bundled with the SVG file.



          In either case, playback of the sound is started by JavaScript on every frame change of the running animation. The "timeline" feature of animate is used to associate the JS code with each frame.



          PDF version, to be compiled with pdflatex, latex+dvips+ps2pdf, or xelatex:



          documentclassbeamer
          usepackagetikz
          usepackageanimate
          usepackagemedia9

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: annotRM['click'].callAS('play');
          ::1: annotRM['click'].callAS('play');
          ::2: annotRM['click'].callAS('play');
          ::3: annotRM['click'].callAS('play');
          endfilecontents*

          begindocument
          beginframeTEMPO for piano
          begincenter
          %the sound player
          makebox[0pt][r]includemedia[
          width=1ex,height=1ex,
          label=click,
          addresource=click.mp3,
          activate=pageopen,transparent,noplaybutton,
          flashvars=source=click.mp3&hideBar=true
          ]APlayer.swf%
          % animation provided by OP
          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          endcenter
          endframe
          enddocument


          SVG version, to be compiled with



          latex tempoForWeb.tex
          latex tempoForWeb.tex
          dvisvgm --font-format=woff --exact --zoom=-1 tempoForWeb.dvi


          The SVG can be viewed standalone in a Web browser, or embedded by means of the <object> HTML tag.



          documentclass[dvisvgm,preview]standalone

          usepackagetikz
          usepackageanimate

          usepackagefilecontents
          beginfilecontents*frames.txt
          ::0: myClick.play();
          ::1: myClick.play();
          ::2: myClick.play();
          ::3: myClick.play();
          endfilecontents*

          begindocument
          specialdvisvgm:rawdef
          <audio xmlns="http://www.w3.org/1999/xhtml" id='click'>
          <source src="click.mp3" type="audio/mpeg"/>
          </audio>
          <script type="text/javascript">
          <![CDATA[
          var myClick = document.getElementById('click');
          function playClick ()
          try myClick.play(); catch (e) console.log(e);

          ]]>
          </script>

          beginanimateinline[loop,controls,timeline=frames.txt]1
          multiframe4n=1+1
          begintikzpicture
          path (0,-1) rectangle (5,1);
          shade[inner color=green,outer color=green!10] (n,0) circle(.6);
          foreach i in 1,...,4 fill[cyan] (i,0) circle(.3);
          endtikzpicture

          endanimateinline
          enddocument


          Standalone, animated GIF is dumb and deaf, afaik, and there does not seem to exist an easily accessible method to synchronize an embedded Gif (in a Web page) with a sound. But SVG is much superior, since it is vectorial and thus freely scalable.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 9 hours ago

























          answered 12 hours ago









          AlexGAlexG

          36.4k4 gold badges86 silver badges155 bronze badges




          36.4k4 gold badges86 silver badges155 bronze badges










          • 1





            Wow, it is very beautiful. :-) +1

            – Sebastiano
            9 hours ago






          • 2





            @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

            – AlexG
            8 hours ago












          • Done now for all the users :-)

            – Sebastiano
            8 hours ago












          • @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

            – Black Mild
            7 hours ago











          • You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

            – AlexG
            7 hours ago












          • 1





            Wow, it is very beautiful. :-) +1

            – Sebastiano
            9 hours ago






          • 2





            @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

            – AlexG
            8 hours ago












          • Done now for all the users :-)

            – Sebastiano
            8 hours ago












          • @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

            – Black Mild
            7 hours ago











          • You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

            – AlexG
            7 hours ago







          1




          1





          Wow, it is very beautiful. :-) +1

          – Sebastiano
          9 hours ago





          Wow, it is very beautiful. :-) +1

          – Sebastiano
          9 hours ago




          2




          2





          @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

          – AlexG
          8 hours ago






          @Sebastiano Oh, thank you! As for beauty, all credits go to Black Mild :-). Upvote his question too, please.

          – AlexG
          8 hours ago














          Done now for all the users :-)

          – Sebastiano
          8 hours ago






          Done now for all the users :-)

          – Sebastiano
          8 hours ago














          @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

          – Black Mild
          7 hours ago





          @AlexG: When I open animated PDF in Acrobat Reader, it requires Flash Player. I have just installed Flash Player, but still can not hear the sound

          – Black Mild
          7 hours ago













          You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

          – AlexG
          7 hours ago





          You need the version for Firefox , not the one for IExplorer (ActiveX component), @BlackMild.

          – AlexG
          7 hours ago













          1














          You can alternatively do the animation elsewhere with sound and add that to the Beamer Files. Beamer seems to have an multimedia package. Also movie15 seems to be promising.



          Look at this thread about Multimedia/sound How to include audio file in PDF, maybe thats a valid startingpoint.






          share|improve this answer








          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • Could you provide full code with some explanation?

            – Black Mild
            12 hours ago











          • Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

            – Sango
            11 hours ago















          1














          You can alternatively do the animation elsewhere with sound and add that to the Beamer Files. Beamer seems to have an multimedia package. Also movie15 seems to be promising.



          Look at this thread about Multimedia/sound How to include audio file in PDF, maybe thats a valid startingpoint.






          share|improve this answer








          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • Could you provide full code with some explanation?

            – Black Mild
            12 hours ago











          • Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

            – Sango
            11 hours ago













          1












          1








          1







          You can alternatively do the animation elsewhere with sound and add that to the Beamer Files. Beamer seems to have an multimedia package. Also movie15 seems to be promising.



          Look at this thread about Multimedia/sound How to include audio file in PDF, maybe thats a valid startingpoint.






          share|improve this answer








          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          You can alternatively do the animation elsewhere with sound and add that to the Beamer Files. Beamer seems to have an multimedia package. Also movie15 seems to be promising.



          Look at this thread about Multimedia/sound How to include audio file in PDF, maybe thats a valid startingpoint.







          share|improve this answer








          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          share|improve this answer



          share|improve this answer






          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          answered 12 hours ago









          SangoSango

          815 bronze badges




          815 bronze badges




          New contributor



          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




          New contributor




          Sango is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Could you provide full code with some explanation?

            – Black Mild
            12 hours ago











          • Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

            – Sango
            11 hours ago

















          • Could you provide full code with some explanation?

            – Black Mild
            12 hours ago











          • Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

            – Sango
            11 hours ago
















          Could you provide full code with some explanation?

          – Black Mild
          12 hours ago





          Could you provide full code with some explanation?

          – Black Mild
          12 hours ago













          Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

          – Sango
          11 hours ago





          Sorry, can't do that right now. But the movie15 package has it online. I can't open it as it is not allowed by my company network. ctan.org/tex-archive/macros/latex/contrib/movie15/doc

          – Sango
          11 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f503886%2ftempo-play-a-sound-in-animated-gif-pdf-svg%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367