Hi,
As this may be useful for annotating audio files, I am trying to integrate the wavesurfer spectrogram on my prodigy recipe.
I had to load the wavesurfer package (as prodigy only gives access to the instance created via window.prodigy) and the spectrogram plugin package into my JS script, with something like this :
var createSpectro = function(){
window.wavesurfer.addPlugin(WaveSurfer.spectrogram.create({
wavesurfer: window.wavesurfer,
container: window.wavesurfer.container,
labels: true
})).initPlugin('spectrogram');
}
function loadScript(url, callback){
var head = document.head;
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = callback;
script.onload = callback;
head.appendChild(script);
}
loadScript("https://unpkg.com/wavesurfer.js/dist/plugin/wavesurfer.spectrogram.js",createSpectro);
And then, I had to modify the css with the global_css parameter (".prodigy-content{ text-align : left}"), but I finally got something working.
This way of doing things has several problems, the versions of wavesurfer between the one I get for the plugin and the one from Prodigy can change and be incompatible, and the change in css can affect other things later on.
Do you think there is a better way?
(Otherwise I'm interested in a future version of Prodigy with the wavesurfer spectrogram plugin )
Thanks a lot,
Jim