Changeset 36865
- Timestamp:
- 2022-10-24T08:34:28+13:00 (18 months ago)
- Location:
- gs3-installations/mars/trunk/sites/mars/collect/amc-essentia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/etc/collectionConfig.xml
r36862 r36865 9 9 <displayItem assigned="true" lang="en" name="name">AMC-Essentia</displayItem> 10 10 <displayItem assigned="true" lang="en" name="description"> 11 <h4>Overview</h4> 11 12 <p> 12 13 This conent analysis enhanced digital library collection is 13 based around9960 audio files from14 comprised of 9960 audio files from 14 15 <a href="https://www.australianmusiccentre.com.au/"> 15 Australian Muisc Centre </a>, which exhibits the country's 16 best contemporary classical, improvisatory and experimental 17 music and sound art. 16 Australian Music Centre</a>, an organisation 17 which hosts music and sound art from the country's 18 leading contemporary classical, improvisatory and experimental 19 composers. 20 Through this digital library you can use traditional text-based 21 searching and browsing to locate content. You can also try 22 out our experimental arousal-valence based music recommender. 18 23 </p> 19 24 25 <h4>Background</h4> 20 26 <p> 21 27 Using the <a href="https://essentia.upf.edu/documentation/">Essentia</a> … … 110 116 <format> 111 117 <gsf:template match="documentNode"> 112 <td valign="top">113 <gsf:link type="document">114 <gsf:icon type="document"/>115 </gsf:link>116 </td>117 <td>118 118 119 119 <xsl:choose> 120 120 <xsl:when test="/page/pageResponse/service/@name = 'AudioQuery'"> 121 121 122 <gsf:variable name="frameOffset"> 122 123 <xsl:value-of select="@frameOffset"/> … … 125 126 <xsl:value-of select="@rank"/> 126 127 </gsf:variable> 128 129 <td valign="top"> 130 <gsf:icon type="document"/> 131 </td> 132 <td> 127 133 128 134 <a> … … 143 149 </span> 144 150 145 151 </td> 146 152 </xsl:when> 147 153 <xsl:otherwise> 148 <gsf:link type="document"> 149 <gsf:metadata name="amc.title"/> 150 by <gsf:metadata name="amc.artist"/> 151 </gsf:link> 154 <td valign="top"> 155 <gsf:link type="document"> 156 <gsf:icon type="document"/> 157 </gsf:link> 158 </td> 159 <td> 160 161 <gsf:link type="document"> 162 <gsf:metadata name="amc.title"/> 163 by <gsf:metadata name="amc.artist"/> 164 </gsf:link> 152 165 <!-- 153 166 <gsf:switch> … … 161 174 </gsf:link> 162 175 --> 176 </td> 163 177 </xsl:otherwise> 164 178 </xsl:choose> … … 184 198 185 199 --> 186 187 </td>188 200 </gsf:template> 189 201 </format> … … 323 335 </td> 324 336 <td valign="top"> 337 <gsf:link type="document"> 325 338 <gsf:choose-metadata> 326 339 <gsf:metadata name="dc.Title"/> … … 331 344 </gsf:choose-metadata> 332 345 <gsf:space /> 333 346 </gsf:link> 347 348 <!-- 334 349 <gsf:link type="document">[Experimental Spectral Frequency]</gsf:link> 335 350 336 351 <gsf:space /> 352 --> 353 337 354 <!-- 338 355 <gsf:variable name="AssocEssentiaJSON"><gsf:OID/>-AssocEssentia.json</gsf:variable> 339 356 <a download="{$AssocEssentiaJSON}" href="{$httpCollection}/index/assoc/{$assocFilePath}/{$AssocEssentiaJSON}">Download Audio Features</a> 340 357 --> 341 358 <!-- 342 359 <xsl:call-template name="gsf-link-render-wave"/> 343 360 --> 344 361 <!-- 345 362 <span id="renderWave"> … … 529 546 <gsf:script src="{$httpCollection}/js/av_document.js"/> 530 547 531 <div class="documenttext" style="padding-bottom: 20px; width:100%;"> 548 <div class="documenttext" style="padding-bottom: 20px; width:100%;"> 532 549 <style> 533 550 .doc-metadata td { padding: 7px; } … … 564 581 565 582 566 <div class="documenttext" >583 <div class="documenttext" style="position: relative;"> 567 584 585 <div style="position: absolute; right: 24px; top: -18px; z-index: 1000; font-size: 90%; font-style:italic"> 586 <a id="switch-to-waveform" stylexx="display: none;" href="">Switch to Waveform</a> 587 <a id="switch-to-spectrogram" stylexx="display: none;" href="">Switch to Spectrogram</a> 588 </div> 589 568 590 <style> 569 591 #wave-timeline { … … 602 624 <div class="controls"> 603 625 <button class="btn btn-primary" onclick="AVSeekTo(0)"> 626 <i id="ws-return-to-start-icon" class="fa-solid fa-backward-fast" ><xsl:text> </xsl:text></i> 604 627 Return to Start 605 628 </button> 606 607 629 608 630 <button class="btn btn-primary" data-action="play" style="display: none;"> 609 <i class="glyphicon glyphicon-play">< /i>631 <i class="glyphicon glyphicon-play"><xsl:text> </xsl:text></i> 610 632 Play / 611 <i class="glyphicon glyphicon-pause">< /i>633 <i class="glyphicon glyphicon-pause"><xsl:text> </xsl:text></i> 612 634 Pause 613 635 </button> 614 636 615 637 616 <button class="btn btn-primary" onclick="AVPlayPause()"> 617 Play 638 <button id="ws-playpause" class="btn btn-primary" onclick="AVPlayPause()"> 639 <span id="ws-playpause-label" style="display: inline-block; width: 3rem;">Play</span> 640 <span style="display: inline-block; width: 1rem;"> 641 <i id="ws-play-icon" class="fa-solid fa-play" ><xsl:text> </xsl:text></i> 642 <i id="ws-pause-icon" class="fa-solid fa-pause" style="display:none"><xsl:text> </xsl:text></i> 643 </span> 618 644 </button> 619 645 … … 634 660 635 661 document.addEventListener('DOMContentLoaded', function() { 636 //postInitWavesurfer(wavesurfer);637 662 postInitWavesurfer(wavesurfer); 663 /* 638 664 // Load audio from URL 639 665 wavesurfer.load(gs.variables.mp3url); … … 656 682 } 657 683 }); 658 684 */ 659 685 }); 660 686 </gsf:script> 661 687 662 </div> 663 664 665 666 <gsf:variable name="docID"><xsl:value-of select="@nodeID"/></gsf:variable> 667 668 <hr/> 688 </div> 689 690 691 692 <gsf:variable name="docID"><xsl:value-of select="@nodeID"/></gsf:variable> 693 694 <hr/> 695 <div id="recommendationArea"> 696 669 697 <form action="{$library_name}" method="get" name="QueryForm"> 670 698 <input name="a" type="hidden" value="q"/> … … 717 745 <input name="s1.valence" type="hidden" value="0"/> 718 746 719 <div style="font-style: italic s;">747 <div style="font-style: italic;"> 720 748 <span id="makeRecommendationFrom"> 721 749 Based on the start of this musical/sound art work: 722 750 </span> 723 <input onclick="return preSubmit(this.form);" type="submit" value="Make Arousal-Valence Recommendations"/> 751 <input onclick="return preSubmit(this.form);" type="submit" value="Make Arousal-Valence Recommendation"/> 752 <div id="makeRecommendationFrom-AV" style="font-style: italics; font-size: 90%;"> 753 <xsl:text> </xsl:text> 754 </div> 724 755 </div> 725 756 … … 732 763 </div> 733 764 </form> 734 <div id="resultsAreaDiv"> 735 765 <div id="resultsAreaDiv" style="padding-top: 1rem;"> 736 766 <xsl:text> </xsl:text> 737 767 </div> 738 <hr/> 768 </div> 769 <hr/> 739 770 <!-- 740 771 <script> -
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js
r36862 r36865 1 var AMC_SONG_DURATION = 30; 2 3 var currentPosIsZero = true; 4 var currentPosRunup = 0; 5 6 7 function AVEnsurePaused() 8 { 9 if (!wavesurfer.backend.isPaused()) { 10 $('#ws-pause-icon').hide(); 11 $('#ws-play-icon' ).show(); 12 $('#ws-playpause-label').html("Play"); 13 } 14 15 wavesurfer.pause(); 16 } 17 18 function AVPlay() 19 { 20 $('#ws-play-icon' ).hide(); 21 $('#ws-pause-icon').show(); 22 $('#ws-playpause-label').html("Pause"); 23 24 if (currentPosRunup>0) { 25 var skip_amount = -1 * currentPosRunup; 26 wavesurfer.skip(skip_amount); 27 currentPosRunup = 0; 28 } 29 30 wavesurfer.play(); 31 32 } 33 1 34 function AVPlayPause() 2 35 { 3 return wavesurfer.backend.isPaused() ? wavesurfer.play() : wavesurfer.pause(); 36 if (wavesurfer.backend.isPaused()) { 37 AVPlay(); 38 } 39 else { 40 AVEnsurePaused(); 41 } 42 43 //return wavesurfer.backend.isPaused() ? wavesurfer.play() : wavesurfer.pause(); 4 44 } 5 45 … … 36 76 // clamp to ensure >= 6.0 secs 37 77 var current_time = Math.max(6.0,wavesurfer.getCurrentTime()); 38 39 wavesurfer.pause();78 var current_time_1dp = current_time.toFixed(1); 79 AVEnsurePaused(); 40 80 41 81 weka_segment = Math.round(current_time/3) * 3; … … 47 87 form.elements["s1.arousal"].value = arousal_val; 48 88 form.elements["s1.valence"].value = valence_val; 89 90 $('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`); 49 91 50 92 … … 83 125 }; 84 126 85 127 /* 86 128 var argsFixed = { 87 129 "a": "q", … … 101 143 "excerptid" : "resultsArea" 102 144 }; 145 */ 103 146 104 147 var url = "https://mars.so-we-must-think.space/greenstone3/library"; 148 149 $('#recommendationArea').css("cursor","wait"); 150 $('#resultsAreaDiv').html("Retrieving recommendation ..."); 105 151 106 152 $.ajax({ … … 109 155 data: args 110 156 }) 111 .done(function( msg ) { 112 $('#resultsAreaDiv').html(msg); 113 //alert( "Data Saved: " + msg ); 114 }); 115 157 .always(function() { 158 $('#recommendationArea').css("cursor","revert"); 159 }) 160 .fail(function(jqXHR,textStatus) { 161 console.error( "Request failed: " + textStatus); 162 }) 163 .done(function(html_result) { 164 $('#resultsAreaDiv').html(html_result); 165 166 const updated_url = new URL(window.location); 167 updated_url.searchParams.set('p.frameOffset', current_time); 168 //window.history.pushState({}, '', url + "?p.frameOffset=" + current_time); 169 //window.history.pushState({}, '', updated_url); 170 window.history.replaceState({}, '', updated_url); 171 172 173 }); 174 116 175 // stop submit 117 176 return false; 118 177 178 // force GET method request to go ahead 119 179 //return true; 120 180 } 121 181 122 182 123 var currentPosIsZero = true;124 183 125 184 function recommendFromStart() … … 140 199 function postInitWavesurfer(wavesurfer) 141 200 { 201 console.log("postInitWavesurfer called with wavesufer = " + wavesurfer); 202 142 203 wavesurfer.load(gs.variables.mp3url); 143 204 … … 157 218 158 219 wavesurfer.on('ready', function () { 220 221 console.log("**** wavesurfer ready()"); 159 222 160 223 if ('p_frameOffset' in gs.cgiParams) { … … 162 225 //console.log("**** starting play @ " + frameOffset); 163 226 //wavesurfer.play(frameOffset); 164 wavesurfer.seekTo(frameOffset/30.0); 227 //console.log("**** setting play seek @ " + frameOffset); 228 wavesurfer.seekTo(frameOffset/AMC_SONG_DURATION); 229 230 if (frameOffset>1.0) { 231 currentPosRunup = 1.0; // 1 second 232 } 165 233 } 166 234 }); 167 235 168 236 } 237 238 $(document).ready(function() { 239 240 const doc_url = new URL(window.location); 241 var renderWave = doc_url.searchParams.get('renderWave'); 242 243 if (renderWave && (renderWave == 1)) { 244 // showing the waveform => offer link to spectrogram 245 const sts_url = new URL(window.location); 246 sts_url.searchParams.set('renderWave', 0); 247 $('#switch-to-spectrogram').attr("href",sts_url); 248 $('#switch-to-waveform').hide(); 249 } 250 else { 251 // show the spectrogram => offer link to waveform 252 253 const stw_url = new URL(window.location); 254 stw_url.searchParams.set('renderWave', 1); 255 $('#switch-to-waveform').attr("href",stw_url); 256 $('#switch-to-spectrogram').hide(); 257 } 258 259 }); 260
Note:
See TracChangeset
for help on using the changeset viewer.