AV
COMPUTERS
-2023-

Set Tempo MediaMonkey 5 Addon

sets tempo from BPM

Links

MediaMonkey Addons page

Github link


Code

// A simple script that sets tempo according to BPM

actions.SetTempo = {
    title: _('SetTempo'),
    hotkeyAble: true,
    icon: 'synchronize',
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    execute: async function () {
        var list = await uitools.getSelectedTracklist().whenLoaded();
        if (list.count === 0) {
            return;
        }

        var msg = sprintf(_('Are you sure that you want to modify %d files ?'), list.count);
        messageDlg(msg, 'Confirmation', ['btnYes', 'btnNo'], {
            defaultButton: 'btnNo',
            title: _('Set Tempo'),
        }, function (result) {
            if (result.btnID === 'btnYes') {
                list.forEach(function(itm) {
                    itm.beginUpdate();
                    if(itm.bpm <= 60) {
                        itm.tempo = "Largo";
                    } else if (itm.bpm <= 66) {
                        itm.tempo = "Larghetto";
                    } else if (itm.bpm <= 76) {
                        itm.tempo = "Adagio";
                    } else if (itm.bpm <= 108) {
                        itm.tempo = "Andante";
                    } else if (itm.bpm <= 120) {
                        itm.tempo = "Moderato";
                    } else if (itm.bpm <= 168) {
                        itm.tempo = "Allegro";
                    } else if (itm.bpm <= 200) {
                        itm.tempo = "Presto";
                    } else {
                        itm.tempo = "Prestissimo";
                    };
                    itm.endUpdate();
                });
                list.commitAsync();  
            }
        });                      
    }
}

window._menuItems.editTags.action.submenu.push({
        action: actions.SetTempo,
        order: 20,
        grouporder: 10
});
-Published 6 pm Thu, Mar 23 2023-