index.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>wavesurfer.js | Split Wave Point Plot Example</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="screenshot" itemprop="screenshot" href="https://katspaugh.github.io/wavesurfer.js/example/screenshot.png" />
  12. <!-- wavesurfer.js -->
  13. <script src="../../dist/wavesurfer.min.js"></script>
  14. <script src="../../plugin/wavesurfer.regions.js"></script>
  15. <!-- Demo -->
  16. <script src="app.js"></script>
  17. </head>
  18. <body itemscope itemtype="http://schema.org/WebApplication">
  19. <div class="container">
  20. <div class="header">
  21. <ul class="nav nav-pills pull-right">
  22. <li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
  23. </ul>
  24. <h1 itemprop="name">Split Wave / Point Plot </h1>
  25. </div>
  26. <div>
  27. <p>
  28. The Split Wave Point Plot drawer splits the graphic in two, with the upper half being a plot of
  29. points defined by time and a range of values. The following example shows the calculated pitch
  30. at each point in time.
  31. </p>
  32. </div>
  33. <div id="demo">
  34. <div id="waveform">
  35. <!-- Here be the waveform -->
  36. </div>
  37. <div class="controls">
  38. <button class="btn btn-primary" data-action="play">
  39. <i class="glyphicon glyphicon-play"></i>
  40. Play
  41. /
  42. <i class="glyphicon glyphicon-pause"></i>
  43. Pause
  44. </button>
  45. </div>
  46. </div>
  47. <div class="row marketing">
  48. <h3>How to Enable Split Wave/Point Plot</h3>
  49. <p>
  50. Set the <code>renderer</code> option to <code>SplitWavePointPlot</code> and the <code>plotFileUrl</code> to the file containing the time aligned data.
  51. </p>
  52. <p>
  53. <pre><code>var wavesurfer = WaveSurfer.create({
  54. container: document.querySelector('#wave'),
  55. renderer: 'SplitWavePointPlot',
  56. plotFileUrl: 'data.txt'
  57. });
  58. </code></pre>
  59. </p>
  60. <h3>Providing Point Data</h3>
  61. <p>The data to be graphed can be provided by either providing a file defined in the <code>plotFileUrl</code> or by passing in an array of data in the <code>plotArray</code> option. The time data does not need to be continous and can have gaps.</p>
  62. <strong>Note: if the timing of your data does not span the duration of the sound file you should set <code>plotTimeEnd</code> to the total duration of the sound file or the points may not be aligned correctly</strong></li>
  63. <h4>Data File Format</h4>
  64. <p>If providing data by loading a file, each line of the file must contain two elements: the time and the value of the point separated by a delimiter (defaults to tab). E.g.</p>
  65. <pre><code>0.01 123
  66. 0.02 121
  67. 0.03 127
  68. 0.22 120
  69. 0.23 119</code></pre>
  70. <h4>Data Array Format</h4>
  71. <p>If providing data by a javascript array via the <code>plotArray</code> option the array should have the following form:</p>
  72. <pre><code>[
  73. {time: 0.02, value: 121},
  74. {time: 0.03, value: 127},
  75. {time: 0.22, value: 120},
  76. {time: 0.03, value: 119}
  77. ]</code></pre>
  78. <h3>Options</h3>
  79. <p>The following additional options can be set when initializing wavesurfer to control the waveform</p>
  80. <ul>
  81. <li><code>plotArray:</code> array of objects with time and plot (required unless plotFileUrl is set)</li>
  82. <li><code>plotFileUrl:</code> url of the file that contains the plot information (required unless plotArray is set)</li>
  83. <li><code>plotNormalizeTo:</code> [whole/segment/none/values] - what value to normalize the plot to (defaults to "whole")</li>
  84. <li><code>plotMin:</code> the minimum value to normalize points to. Any value below this will be ignored (defaults to 0)</li>
  85. <li><code>plotMax:</code> the maximum value to normalize points to. Any value above this will be ignored (defaults to 1)</li>
  86. <li><code>plotTimeStart:</code> the time included in the plot file which corresponds with the start of the displayed wave (defaults to 0)</li>
  87. <li><code>plotTimeEnd:</code> the time included in the plot file which corresponds with the end of the displayed wave (defaults maximum plot time)</li>
  88. <li><code>plotColor:</code> the color of the plot (defaults to #f63)</li>
  89. <li><code>plotProgressColor:</code> the color of the progress plot (defaults to '#F00')</li>
  90. <li><code>plotFileDelimiter:</code> the delimiter which separates the time from the value in the plot file (defaults to tab characater = "\t")</li>
  91. <li><code>plotPointHeight:</code> the canvas height of each plot point (defaults to 2)</li>
  92. <li><code>plotPointWidth:</code> the canvas width of each plot point (defaults to 2)</li>
  93. <li><code>plotSeparator:</code> boolean indicating a separator should be included between the wave and point plot</li>
  94. <li><code>plotRangeDisplay:</code> boolean indicating if the min and max range should be displayed (defaults to false)</li>
  95. <li><code>plotRangePrecision:</code> integer determining the precision of the displayed plot range</li>
  96. <li><code>plotRangeUnits:</code> units appended to the range</li>
  97. <li><code>plotRangeFontSize:</code> the font for displaying the range - defaults to 20</li>
  98. <li><code>plotRangeFontType:</code> the font type for displaying range - defaults to Ariel</li>
  99. <li><code>plotRangeIgnoreOutliers:</code> boolean indicating if values outside of range should be ignored or plotted at min/max</li>
  100. </ul>
  101. </div>
  102. <div class="footer row">
  103. <div class="col-sm-12">
  104. <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>
  105. </div>
  106. <div class="col-sm-7">
  107. <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&nbsp;<a style="white-space: nowrap" rel="license" href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>.
  108. </div>
  109. <div class="col-sm-5">
  110. <noindex>
  111. Demo is selection of from The Hobbit by J.R.R. Tolkien
  112. </noindex>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="github-fork-ribbon-wrapper right">
  117. <div class="github-fork-ribbon">
  118. <a itemprop="isBasedOnUrl" href="https://github.com/katspaugh/wavesurfer.js">Fork me on GitHub</a>
  119. </div>
  120. </div>
  121. <script>
  122. /*
  123. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  124. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  125. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  126. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  127. ga('create', 'UA-50026819-1', 'wavesurfer.fm');
  128. ga('send', 'pageview');
  129. */
  130. </script>
  131. </body>
  132. </html>