Similarity 2.0.1 build 2055 (Updated 2015.07.05)Download (32/64-bit Windows)Main feature of new 2.0 version will be support of Javascript scripting. We already added some support in this beta version, you can try it.Many users ask very specific features that don't suitable as main feature of program, to not overload program interface most of this request will be implemented via scripting. You can write almost all you need to compare/analyse/tag your collection with Similarity.
Similarity JavaScript API referenceAny comments and suggestions are welcomed.Known limitations:
No yet support for multithreading (JavaScript engine singlethreaded) (Added 2015.02.17)- No I/O functions (file streaming)
- No include
- No image comparing (added soon after audio api stabilizing)
Example of analysis script with user defined rating:
// after preparing analysis data (asynchronous)
function onprepare(file, result) {
// skip all not audio files
if (!result) return;
// add to results list
results.analysis.add(file, 'rating', myrating(file.analysis));
}
// file processing callback (asynchronous)
function onfile(file) {
// just try to receive analyse data, if it has such data this is audio file
analysis.prepare(file, onprepare)
}
// folder processing callback (asynchronous)
function onfolder(folder) {
// recursively process subdir with same callbacks
process(folder, onfile, onfolder);
}
function myrating(data) {
var score = 1.0;
// sample rate
score *= 0.5 + 0.5 * (Math.min(44100, Math.max(22050, data.samplerate)) - 22050) / 22050;
// bitrate
if (data.bitrate > 0) score *= 0.5 + 0.5 * (Math.min(128000, Math.max(64000, data.bitrate)) - 64000) / 64000;
// max.freq
score *= 0.5 + 0.5 * (Math.min(18500, Math.max(12000, data.maxFreq)) - 12000) / 6500;
// stereo/mono
if (data.channels == "mono") score *= 0.5;
// clipping
score *= 0.7 + 0.3 / (0.01 * data.clips + 1.0);
// dynamic range
if (data.absMax < 0.75) score *= 0.7 + 0.3 * (Math.max(0.25, data.absMax) - 0.25) * 2.0;
// dc offset
if (data.absMean >= 0.05) score *= 0.7 + 0.3 * (0.1 - Math.max(0.1, data.absMean)) * 20.0;
if (data.minStep >= 0.00004) score *= 0.5;
return score;
}
// clear all results in program
results.analysis.clear();
// start processing files via callbacks
var folders = settings.folders;
for (var idx = 0; idx < folders.length; ++idx) {
process(folders[idx], onfile, onfolder);
}
Changes 2015.02.17:- Introducing asynchronous callbacks, speed difference between native algorithms of Similarity and Javascript scripts between 2% (without OpenCL)
- Removed isaudio, file tested in prepare, queue functions automatically
- audio.prepare, audio.queue rewrited and they can be asynchronous
- Added analysis.prepare
- process, audio.compare always asynchronous
Changes 2015.07.05: