Changeset 36958


Ignore:
Timestamp:
2022-11-29T22:55:42+13:00 (17 months ago)
Author:
davidb
Message:

Document view now shows an AV diagram; this commit is just prior to some code tidy up

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

    r36865 r36958  
    1111      <h4>Overview</h4>     
    1212      <p>
    13     This conent analysis enhanced digital library collection is
    14     comprised of 9960 audio files from
     13    This content analysis enhanced digital library collection is
     14    comprised of 9960 audio files from the
    1515    <a href="https://www.australianmusiccentre.com.au/">
    1616      Australian Music Centre</a>, an organisation
     
    3333    and valence that a section of music evokes.  We have chosen
    3434    REPTree for the predictive modeling, a fast decision tree
    35     learner that explots gain/variance and pruning (with
    36     backfitting) to build a regression tree.
     35    learner that exploits gain/variance and pruning (with
     36    back-fitting) to build a regression tree.
    3737      </p> 
    3838
     
    4444    features, which are then used to predict arousal and valence
    4545    features throughout each audio file, currently set to using
    46     a window of 6 seconds and an overal of 50%.  This is stored
     46    a window of 6 seconds and an overlap of 50%.  This is stored
    4747    as metadata within the built digital library, alongside
    4848    the more regular metadata values for title and artist.
     
    5353      service-based architecture</a> we have enriched the user's experience
    5454      of listening to a work in the digital library collection.  The most prominent
    55       feature is a frequency specogram of the work, with a timeline bar that
    56       moves through the work as it is play.  The timeline bar visually shows the
    57       computed level of arousal by broadening the width the timeline bar as the
     55      feature is a frequency spectrogram of the work, with a timeline bar that
     56      moves through the work as it is played.  The timeline bar visually shows the
     57      computed level of arousal by broadening the width of the timeline bar as the
    5858      level of arousal rises.  The timeline bar is rendered in white, varying
    5959      the brightness used to reflect the computed level of valence.       
     
    6161
    6262      <p>
    63     Below the AV frequecy visualizer, is a <i>Recommend</i>
    64     button.  If a user clicks on this, then—again leveraging
    65     the service-based architecture to the digital library
    66     software—for the passage of work being played its values
    67     of arousal and valence are used to select other works
    68     in the digital library collection that
    69     share similar features.  This are added at the bottom of
     63    Below the AV frequency visualizer, is a <i>Recommend</i>
     64    button.  If a user clicks on this, then—again leveraging the
     65    service-based architecture to the digital library software—the
     66    values of arousal and valence for the passage of work being
     67    played are used to select other works in the digital library
     68    collection that share similar features.
     69    These are added at the bottom of
    7070    the page as recommendations that the user might also like
    7171    to listen to.         
     
    619619          </div>
    620620        </div>
    621        
     621
     622
    622623        <div>
    623        
    624           <div class="controls">
     624          <style>
     625        .controls .btn {
     626          margin-bottom: 25px;
     627        }
     628          </style>
     629
     630          <div id="av-timelinebar-help" style="display: none; background-color: rgb(255,255,255); padding: 6px; position: absolute; right: 4px; font-style: italic; font-size: 90%; padding-top: 0.5rem;">
     631        Audio player Arousal-Valence timeline bar:
     632        <ul style="margin: 0.2rem;">
     633          <li>Width corresponds to valence</li>
     634          <li>Intensity of white corresponds to arousal</li>
     635        </ul>
     636          </div>
     637
     638          <div class="controls" style="padding-bottom: 0px;">
    625639        <button class="btn btn-primary" onclick="AVSeekTo(0)">
    626640          <i id="ws-return-to-start-icon"  class="fa-solid fa-backward-fast" ><xsl:text> </xsl:text></i>
     
    644658        </button>
    645659       
    646               </div>
     660              </div>         
     661         
    647662        </div>
     663       
    648664        </div>
    649                        
     665   
    650666    <gsf:variable name="mp3url"><xsl:value-of select="$httpCollection"/>/index/assoc/<xsl:value-of select="$assocFilePath"/>/audio.mp3</gsf:variable>
    651667
     
    763779                </div>
    764780              </form>
    765               <div id="resultsAreaDiv" style="padding-top: 1rem;">             
    766                 <xsl:text> </xsl:text>
     781              <div>
     782                <div id="av-chart-div" style="height: 265px; width: 250px; float: right; display: none;">
     783                  <img id="av-chart-img" width="250" src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw.svg" />
     784                  <div>
     785                <i>Or click inside the Arousal-Valence visualisation above to initiate a new AV-based recommendation.</i>
     786                  </div>
     787
     788                </div>
     789                <div id="resultsAreaDiv" style="padding-top: 1rem; min-height: 265px; display: none;">
     790                  <xsl:text> </xsl:text>
     791                </div>
    767792              </div>
     793             
    768794            </div>
    769795            <hr/>
  • gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js

    r36865 r36958  
    148148
    149149    $('#recommendationArea').css("cursor","wait");
     150    $('#resultsAreaDiv').slideDown();
    150151    $('#resultsAreaDiv').html("Retrieving recommendation ...");
    151152   
     
    162163    })
    163164    .done(function(html_result) {
    164         $('#resultsAreaDiv').html(html_result);
    165 
     165        $('#resultsAreaDiv').html("<div>Recommendations:</div>"+html_result);
     166        $('#av-chart-div').show();
     167       
    166168        const updated_url = new URL(window.location);
    167169        updated_url.searchParams.set('p.frameOffset', current_time);
     
    228230        wavesurfer.seekTo(frameOffset/AMC_SONG_DURATION);
    229231
    230         if (frameOffset>1.0) {
     232        console.log("av_document.js keeping 'currentPosRunup' at 0");
     233        /*if (frameOffset>1.0) {
    231234        currentPosRunup = 1.0; // 1 second
    232         }
     235        }*/
    233236    }
    234237    });
    235238
     239}
     240
     241/*
     242
     243y-top: 146
     244
     245Centre: 412,443
     246
     247y-bot:735
     248
     249x-left: 120
     250
     251x-right 710
     252
     253
     254Full image:
     255  911 x 825 pxs
     256
     257
     258
     259  AV centre: 412,443
     260 
     261delta x/y: from centre: 292 <-> 298
     262-1 <-> 0 <-> +1
     263   295   295
     264
     265
     266SVG:
     267
     268  241 x 248
     269    scaled
     270    0.26458
     271
     272*/
     273
     274var av_chart_orig_r = 295;
     275
     276var av_chart_orig_x_org = 412;
     277var av_chart_orig_y_org = 443;
     278
     279var av_chart_orig_x_dim = 911;
     280var av_chart_orig_y_dim = 825;
     281
     282var av_chart_disp_x_dim = 250;
     283var av_chart_disp_x_mid = av_chart_disp_x_dim/2.0;
     284
     285var av_chart_scale = av_chart_orig_x_dim / av_chart_disp_x_dim;
     286
     287function av_chart_click(elem,e)
     288{
     289    var offset = $(elem).offset();
     290
     291    var elem_x_org = offset.left;
     292    var elem_y_org = offset.top;
     293
     294    var disp_x = e.pageX - elem_x_org;
     295    var disp_y = e.pageY - elem_y_org;
     296
     297    var scaled_disp_x = disp_x * av_chart_scale;
     298    var scaled_disp_y = disp_y * av_chart_scale;
     299
     300    var orig_av_x = scaled_disp_x - av_chart_orig_x_org;
     301    var orig_av_y = -1 * (scaled_disp_y - av_chart_orig_y_org); // flip y axis
     302
     303    var av_x = orig_av_x / av_chart_orig_r;
     304    var av_y = orig_av_y / av_chart_orig_r;
     305   
     306    var capped_av_x = Math.max(Math.min(av_x,1.0),-1.0);
     307    var capped_av_y = Math.max(Math.min(av_y,1.0),-1.0);
     308   
     309
     310    console.log(`av x,y: (${capped_av_x},${capped_av_y})`);
     311   
    236312}
    237313
     
    247323    $('#switch-to-spectrogram').attr("href",sts_url);
    248324    $('#switch-to-waveform').hide();
     325
     326    $('#av-timelinebar-help').hide();
    249327    }
    250328    else {
     
    255333    $('#switch-to-waveform').attr("href",stw_url);
    256334    $('#switch-to-spectrogram').hide();
    257     }
    258    
     335
     336    $('#av-timelinebar-help').show();   
     337    }
     338
     339    $('#av-chart-img').on("click",function(e) { av_chart_click(this,e) } );
    259340});
    260341         
Note: See TracChangeset for help on using the changeset viewer.