Changeset 37673
- Timestamp:
- 2023-04-18T10:36:19+12:00 (12 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
r37541 r37673 976 976 <div style="font-style: italic; min-height: 3.5rem;"> 977 977 <div style="float:right;"> 978 <span style="display: inline-block; margin-bottomXXXX: 10px;;" class="display-view-modes" onclick="return showAVChartLabelled();">Labelled AV Chart</span> 978 <span style="display: inline-block; margin-bottomXXXX: 5px;" class="display-view-modes" onclick="return loginToRecord()"> 979 <img width="16" height="16" src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/crosshair-cursor-red32.png"/> 980 Show your AV Feelings 981 </span> 979 982 <br /> 980 <span style="display: inline-block; margin-bottomXXXX: 5px;" class="display-view-modes" onclick="return loginToRecord()">Customise AV Experience </span> 983 <span style="display: inline-block; margin-bottomXXXX: 10px;;" class="display-view-modes" onclick="return showAVChartLabelled();"> 984 <canvas id="choose-within-av-chart-legend" width="16" height="16" style="width: 16px; height: 16px;"> 985 Your browser does not support the canvas element 986 </canvas> 987 <gsf:script> 988 $(document).ready(function() { 989 var cwav_chart_legend = document.getElementById('choose-within-av-chart-legend'); 990 991 var ctx = cwav_chart_legend.getContext("2d"); 992 ctx.clearRect(0, 0, cwav_chart_legend.width, cwav_chart_legend.height); 993 ctx.beginPath(); 994 ctx.arc(8, 8, 4.5, 0, 2*Math.PI, false); 995 ctx.fillStyle = 'rgba(50,50,128,0.5)'; 996 ctx.fill(); 997 ctx.lineWidth = 1; 998 ctx.strokeStyle = 'rgba(0,0,160,0.5)'; 999 ctx.stroke(); 1000 }); 1001 </gsf:script> 1002 Choose within AV Chart 1003 </span> 981 1004 </div> 982 1005 … … 984 1007 Based on the start of this musical/sound art work: 985 1008 </span> 986 <input onclick="return preSubmit(this.form);" type="submit" value="Make Arousal-Valence Recommendation"/>1009 <input onclick="return preSubmit(this.form);" type="submit" styleXXXX="font-size: 1.2rem;" value="Make Arousal-Valence Recommendation"/> 987 1010 <div id="makeRecommendationFrom-AV" style="font-style: italics; font-size: 90%; display: none;"> <!-- **** --> 988 1011 <xsl:text> </xsl:text> -
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js
r37542 r37673 115 115 //$('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`); 116 116 117 return submitAVRecommendation(form, arousal_val,valence_val, clamped_current_time); 118 } 117 return submitAVRecommendation(form, arousal_val,valence_val, clamped_current_time, true); 118 } 119 120 121 function preSubmitDiff() 122 { 123 var form = $('#av-query-form')[0]; 124 125 // Note, the Arousal and Valence feature window values used is: 126 // 6 secs + 50% overlap 127 // So the Weka computed AV values are spaced out: 128 // 6s, 9s, 12s, ... 129 130 // clamp to ensure >= 6.0 secs 131 //var current_time = Math.max(6.0,wavesurfer.getCurrentTime()); 132 //var current_time_1dp = current_time.toFixed(1); 133 134 var clamped_current_time = displayClampedCurrentTimeAndAV(); 135 136 AVEnsurePaused(); 137 138 weka_segment = Math.round(clamped_current_time/3) * 3; 139 form.elements["s1.offset"].value = weka_segment; 140 141 var arousal_val = parseFloat($('#arousal-val').text()); 142 var valence_val = parseFloat($('#valence-val').text()); 143 144 145 // Now to come up with something that's different 146 147 var num_choices = 3; 148 var mix_up_choice = Math.floor(Math.random() * (num_choices)) 149 150 if ((mix_up_choice == 0) || (mix_up_choice == 1)) { 151 arousal_val = -1 * arousal_val; 152 } 153 if ((mix_up_choice == 0) || (mix_up_choice == 2)) { 154 valence_val = -1 * valence_val; 155 } 156 157 var av_magnitude = Math.sqrt(arousal_val*arousal_val + valence_val*valence_val); 158 159 if (av_magnitude < 0.1) { 160 arousal_val *= 9.0; 161 valence_val *= 9.0; 162 } 163 else if (av_magnitude < 0.25) { 164 arousal_val *= 3.0; 165 valence_val *= 3.0; 166 } 167 else if (av_magnitude < 0.5) { 168 arousal_val *= 1.5; 169 valence_val *= 1.5; 170 } 171 172 var mix_up_boost = 1.0 + Math.random() * 0.1; // additive 10% boost 173 arousal_val *= mix_up_boost; 174 valence_val *= mix_up_boost; 175 176 //$('#arousal-val').text(arousal_val.toFixed(3)); 177 //$('#valence-val').text(valence_val.toFixed(3)); 178 179 //$('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`); 180 181 return submitAVRecommendation(form, arousal_val,valence_val, clamped_current_time, false); 182 } 183 119 184 120 185 function AVPlotRecommendations() … … 283 348 } 284 349 285 function submitAVRecommendation(form, arousal_val,valence_val, current_time )350 function submitAVRecommendation(form, arousal_val,valence_val, current_time, update_av_vals) 286 351 { 287 352 var adjusted_arousal_val = arousal_val; … … 303 368 adjusted_valence_val = Math.max(-1.0,Math.min(1.0,adjusted_valence_val)); 304 369 } 305 306 form.elements["s1.arousal"].value = adjusted_arousal_val; 307 form.elements["s1.valence"].value = adjusted_valence_val; 370 371 if (update_av_vals) { 372 form.elements["s1.arousal"].value = adjusted_arousal_val; 373 form.elements["s1.valence"].value = adjusted_valence_val; 374 } 308 375 309 376 var args = { … … 325 392 }; 326 393 327 394 // ***** !!!! ***** 328 395 var url = "https://mars.so-we-must-think.space/greenstone3/library"; 329 396 … … 344 411 }) 345 412 .done(function(html_result) { 346 $('#resultsAreaDiv').html("<div>Recommendations:</div>"+html_result); 413 414 var make_diff_recommend_html = '<div style="padding-top: 20px;">Or <input onclick="return preSubmitDiff();" styleXXXX="font-size: 1.2rem;" type="submit" value="Recommend Something Different" valueXX="Make Arousal-Valence Recommendation"/></div>'; 415 416 $('#resultsAreaDiv').html("<div>Recommendations:</div>"+html_result + make_diff_recommend_html); 347 417 $('#av-chart-div').show(); 348 418 349 AVPlotRecommendations(); 419 if (update_av_vals) { 420 AVPlotRecommendations(); 421 } 350 422 351 423 if (current_time) { … … 389 461 { 390 462 console.log("postInitWavesurfer called with wavesufer = " + wavesurfer); 391 463 464 //$('#waveform').css('cusor','wait'); 465 //console.log("***** ##### !!!!! Away to load audio MP3 file => set cursor to 'wait'"); 466 467 // wavesurfer.on('waveform-ready', function () { 468 // console.log("**** #### !!!! wavesurfer Event 'waveform-ready': MP3 loaded and wavesurfer rendered => reverting cursor"); 469 // $('#waveform').css('cusor','revert'); 470 // }); 471 472 392 473 wavesurfer.load(gs.variables.mp3url); 393 474 … … 415 496 av_chart_record_finish(); 416 497 }); 498 417 499 418 500 wavesurfer.on('ready', function () { 419 501 502 //$('#waveform').css('cusor','revert'); 503 420 504 console.log("**** wavesurfer ready()"); 505 //console.log("**** wavesurfer waveform-ready()"); 421 506 //wavesurfer.drawer.setWidth(958); 422 507 … … 440 525 } 441 526 442 // The following draw blank visuals443 //wavesurfer.drawBuffer();444 //wavesurfer.zoom();445 446 527 }); 447 528 … … 563 644 form.elements["s1.offset"].value = weka_segment; 564 645 565 submitAVRecommendation(form, capped_av_x, capped_av_y, null );646 submitAVRecommendation(form, capped_av_x, capped_av_y, null, true); 566 647 567 648 } … … 916 997 var renderWave = doc_url.searchParams.get('renderWave'); 917 998 918 if (renderWave && (renderWave == 1)) { 919 // showing the waveform => offer link to spectrogram 920 const sts_url = new URL(window.location); 921 sts_url.searchParams.set('renderWave', 0); 922 $('#switch-to-spectrogram').attr("href",sts_url); 923 $('#switch-to-waveform').hide(); 924 925 $('#av-timelinebar-help').hide(); 926 } 927 else { 999 if (renderWave && (renderWave == 0)) { 928 1000 // show the spectrogram => offer link to waveform 929 1001 … … 933 1005 $('#switch-to-spectrogram').hide(); 934 1006 935 $('#av-timelinebar-help').show(); 1007 $('#av-timelinebar-help').show(); 1008 } 1009 else { 1010 // showing the waveform => offer link to spectrogram 1011 const sts_url = new URL(window.location); 1012 sts_url.searchParams.set('renderWave', 0); 1013 sts_url.searchParams.set('showRecordAV', 0); // **** 1014 $('#switch-to-spectrogram').attr("href",sts_url); 1015 $('#switch-to-waveform').hide(); 1016 1017 $('#av-timelinebar-help').hide(); 936 1018 } 937 1019 } … … 1075 1157 $av_labels.css("display","none"); 1076 1158 */ 1159 1160 1161 var this_url = new URL(window.location) 1162 var renderWave = this_url.searchParams.get('renderWave'); 1163 if (renderWave != 1) { 1164 // Force to be waveForm Display 1165 this_url.searchParams.set('renderWave', '1'); 1166 this_url.searchParams.set('showRecordAV', '1'); 1167 window.location.href = this_url.toString(); 1168 } 1077 1169 1078 1170 //console.log("Away to hide standard av-chart-img and show av-chart-img-unlabeled");
Note:
See TracChangeset
for help on using the changeset viewer.