index.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>wavesurfer.js | ELAN Wave Segment player</title>
  6. <link href="data:image/gif;" rel="icon" type="image/x-icon" />
  7. <!-- Bootstrap -->
  8. <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
  9. <link rel="stylesheet" href="../css/style.css" />
  10. <link rel="stylesheet" href="../css/ribbon.css" />
  11. <link rel="stylesheet" href="css/elan.css" />
  12. <link rel="screenshot" itemprop="screenshot" href="https://katspaugh.github.io/wavesurfer.js/example/screenshot.png" />
  13. <!-- wavesurfer.js -->
  14. <script src="../../dist/wavesurfer.min.js"></script>
  15. <!-- regions plugin -->
  16. <script src="../../dist/plugin/wavesurfer.regions.min.js"></script>
  17. <!-- ELAN format renderer -->
  18. <script src="../../dist/plugin/wavesurfer.elan.min.js"></script>
  19. <!-- ELAN wave segment renderer -->
  20. <script src="../../plugin/wavesurfer.elan-wave-segment.js"></script>
  21. <!-- App -->
  22. <script src="app.js"></script>
  23. <script src="../trivia.js"></script>
  24. </head>
  25. <body itemscope itemtype="http://schema.org/WebApplication">
  26. <div class="container">
  27. <div class="header">
  28. <noindex>
  29. <ul class="nav nav-pills pull-right">
  30. <li><a href="?fill">Fill</a></li>
  31. <li><a href="?scroll">Scroll</a></li>
  32. </ul>
  33. </noindex>
  34. <h1 itemprop="name"><a href="http://wavesurfer-js.org">wavesurfer.js</a><noindex> + <a rel="nofollow" href="http://spokencorpora.ru/showelan.py">ELAN</a> + Wave Segment</noindex></h1>
  35. </div>
  36. <div><p>The Elan Wave Segment Plugin uses the table and the time values created by the
  37. <a href="../elan/index.html">ELAN plugin</a> to insert a wave form column for each row.
  38. </p></div>
  39. <div id="demo">
  40. <div id="waveform">
  41. <div class="progress progress-striped active" id="progress-bar">
  42. <div class="progress-bar progress-bar-info"></div>
  43. </div>
  44. <!-- Here be waveform -->
  45. </div>
  46. <div class="controls">
  47. <button class="btn btn-primary" data-action="play">
  48. <i class="glyphicon glyphicon-play"></i>
  49. Play
  50. /
  51. <i class="glyphicon glyphicon-pause"></i>
  52. Pause
  53. </button>
  54. </div>
  55. </div>
  56. <div id="annotations" class="table-responsive">
  57. <!-- Here be transcript -->
  58. </div>
  59. <h2>How to Enable Elan Wave Segment</h2>
  60. <h3>Javascript Dependencies</h3>
  61. <ul>
  62. <li>Wavesufer <code></code></li>
  63. <li>Region Plugin <code></code></li></li>
  64. <li>ElAN Plugin <code></code></li></li>
  65. <li>ELAN Wave Segment</li>
  66. <pre><code>&lt;script src="[path_to]/wavesurfer.min.js"&gt;&lt;/script&gt;
  67. &lt;script src="[path_to]/plugin/wavesurfer.region.min.js"&gt;&lt;/script&gt;
  68. &lt;script src="[path_to]/plugin/wavesurfer.elan.min.js"&gt;&lt;/script&gt;
  69. &lt;script src="[path_to]/plugin/wavesurfer.elan-wave-segment.min.js"&gt;&lt;/script&gt; </code></pre>
  70. </ul>
  71. <h2>Javascript Initialization</h2>
  72. <pre><code>// Create the wave surfer instance
  73. var wavesurfer = Object.create(WaveSurfer);
  74. // Create elan instance
  75. var elan = Object.create(WaveSurfer.ELAN);
  76. // Create Elan Wave Segment instance
  77. var elanWaveSegment = Object.create(WaveSurfer.ELANWaveSegment);
  78. document.addEventListener('DOMContentLoaded', function () {
  79. var options = {
  80. container : '#waveform',
  81. };
  82. //################## set up some listeners ####################
  83. //set up listener for when elan is done
  84. elan.on('ready', function (data) {
  85. wavesurfer.load('../elan/transcripts/001z.mp3');
  86. });
  87. //set up listener for playing when clicked on
  88. elan.on('select', function (start, end) {
  89. wavesurfer.backend.play(start, end);
  90. });
  91. //############################## initialize wavesurfer and related plugins###############
  92. // Init wavesurfer
  93. wavesurfer.init(options);
  94. //init elan
  95. elan.init({
  96. url: '../elan/transcripts/001z.xml',
  97. container: '#annotations',
  98. tiers: {
  99. Text: true,
  100. Comments: true
  101. }
  102. });
  103. //int elanWaveSegment when wavesurfer is done loading the sound file
  104. wavesurfer.on('ready', function() {
  105. options.plotTimeEnd = wavesurfer.backend.getDuration();
  106. options.wavesurfer = wavesurfer;
  107. options.ELAN = elan;
  108. elanWaveSegment.init(options);
  109. });
  110. //update waveSegments when time advances
  111. var onProgress = function (time) {
  112. elanWaveSegment.onProgress(time);
  113. //code for scrolling Elan goes here
  114. };
  115. wavesurfer.on('audioprocess', onProgress);
  116. }); </code></pre>
  117. <h2>Options</h2>
  118. <ul>
  119. <li><code>ELAN:</code> required - The ELAN instance used to parse the elan data</li>
  120. <li><code>wafesurver:</code> required - The wavesurfer instance used to draw the original waveform</li>
  121. <li><code>waveSegmentWidth:</code> optional - The width of each wave segment (defaults to 200)</li>
  122. <li><code>waveSegmentPeaksPerSegment:</code> optional - The number of peaks that should be drawn (defaults to 400)</li>
  123. <li><code>waveSegmentHeight:</code> optional - The height of each wave segment (defaults to 30)</li>
  124. <li><code>waveSegmentRenderer:</code> optional - The renderer (drawer) to be used for the wave segments</li>
  125. <li><code>waveSegmentNormalizeTo:</code> optional - What to normalize each wave segment to [whole, segment,none]</li>
  126. <li><code>waveSegmentBorderWidth:</code> optional - The width of the border of the container element</li>
  127. <li><code>waveSegmentBarHeight:</code> optional - the height of the peaks/bars (defaults to 1)</li>
  128. </ul>
  129. <div class="footer row">
  130. <div class="col-sm-12">
  131. <a rel="license" href="https://opensource.org/licenses/BSD-3-Clause"><img alt="BSD-3-Clause License" style="border-width:0" src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg" /></a>
  132. </div>
  133. <div class="col-sm-8">
  134. <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">wavesurfer.js</span> by <a href="https://github.com/katspaugh/wavesurfer.js">katspaugh</a> is licensed under a <a rel="license" href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>.
  135. </div>
  136. <div class="col-sm-4">
  137. <p>
  138. The ELAN program and format were developed by <a href="http://tla.mpi.nl/tools/tla-tools/elan/">Max Planck Institute</a>.
  139. </p>
  140. <p>
  141. The sample ELAN file and audio are from <a rel="nofollow" href="http://spokencorpora.ru/">spokencorpora.ru</a>, used with permission.
  142. </p>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="github-fork-ribbon-wrapper right">
  147. <div class="github-fork-ribbon">
  148. <a itemprop="isBasedOnUrl" href="https://github.com/katspaugh/wavesurfer.js">Fork me on GitHub</a>
  149. </div>
  150. </div>
  151. <script>
  152. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  153. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  154. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  155. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  156. ga('create', 'UA-50026819-1', 'wavesurfer.fm');
  157. ga('send', 'pageview');
  158. </script>
  159. </body>
  160. </html>