Online Sequencer Make music online
  • Sequences
  • Members
  • Chat
  • Forum
  • Wiki

Existing user? Sign In Create account
Login at Online Sequencer Forums

Online Sequencer Forums › Off Topic › General Discussion
« Previous 1 … 48 49 50 51 52 … 56 Next »

Pointless Program: BMOS v0.1 (CURRENT v1.3)

Thread tools
Pointless Program: BMOS v0.1 (CURRENT v1.3)
Frank Offline
Grey Hat Script Kiddie who can Compose Music
388 Posts:
 
#8
12-07-2018, 03:39 PM (This post was last modified: 12-07-2018, 03:41 PM by Frank.)
v1.3, just stick it in an image and copy the output, then paste back into loadData(``)
Code:
function nearestInstrument(color) {
    RGBColor = color.slice(0, 3).map(x => x * color[3] / 255);
    var result;
    var smallest = Infinity;
    for (i = 0; i < 40; i++) {
        var difference = 0;
        for (j = 0; j < 3; j++) {
            difference += (settings.instrumentColors[i][j] - RGBColor[j]) ** 2;
        }
        if (smallest > difference) {
            smallest = difference;
            result = i;
        }
    }
    return result;
}

function drawImg(source) {
    var img = new Image();
    img.src = source;
    img.onload = function() {
        canvas.width = 100;
        canvas.height = 50;
        canvas.getContext('2d').drawImage(img, 0, 0, canvas.width, canvas.height);
        var total = ':';
        for (var h = canvas.height - 1; h > -1; h--) {
            for (var w = 0; w < canvas.width; w++) {
                var instrument = nearestInstrument(canvas.getContext('2d').getImageData(w, h, 1, 1).data);
                if (instrument != 37) total += [w, piano50[h], 1, instrument].join(' ') + ';';
            }
        }
        if (window.SequencerView) {
            SequencerView.fastGraphics = true;
            loadData(total);
            $.each(audioSystem.instrumentVolume, x => audioSystem.setInstrumentVolume(x, 0));
        } else {
            console.log(total);
        }
    }
}

var piano50 = ["A6", "G#6", "G6", "F#6", "F6", "E6", "D#6", "D6", "C#6", "C6", "B5", "A#5", "A5", "G#5", "G5", "F#5", "F5", "E5", "D#5", "D5", "C#5", "C5", "B4", "A#4", "A4", "G#4", "G4", "F#4", "F4", "E4", "D#4", "D4", "C#4", "C4", "B3", "A#3", "A3", "G#3", "G3", "F#3", "F3", "E3", "D#3", "D3", "C#3", "C3", "B2", "A#2", "A2", "G#2"];
var settings = {instrumentColors: [[3,169,244],[255,152,0],[183,28,28],[233,30,99],[76,175,80],[33,33,33],[63,81,181],[205,220,57],[21,101,192],[130,119,23],[255,234,0],[141,110,99],[78,52,46],[255,99,99],[117,255,99],[99,224,255],[253,99,255],[255,87,34],[27,94,32],[244,67,54],[255,224,178],[117,117,117],[224,173,0],[233,249,189],[168,200,83],[13,71,161],[29,157,157],[30,197,122],[21,33,79],[5,16,47],[108,243,183],[255,112,112],[161,166,53],[234,121,0],[85,202,202],[0,128,64],[127,32,15],[0,0,0],[0,69,31],[159,15,34]]}
var canvas = document.createElement('canvas');
drawImg(document.URL);
##994311


Kim Wrote:##878337 + https://js-game.glitch.me + Doesnt take peopel serious if their has badly speling gramer puntuatin
Reply

Messages In This Thread
Pointless Program: BMOS v0.1 (CURRENT v1.3) - by Frank - 07-13-2018, 09:54 AM
RE: Pointless Program: BMOS v0.1 - by Jacob_ - 07-13-2018, 05:53 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 06:16 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 08:49 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-14-2018, 06:57 AM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-23-2018, 08:52 AM
RE: Pointless Program: BMOS v0.1 (CURRENT v1.2) - by Frank - 12-07-2018, 03:39 PM



Users browsing this thread:   1 Guest(s)


  •  Return to Top
  •  Contact Us
  •   Home
  •  Lite mode
© Rush Crafted with ❤ by iAndrew
Powered By MyBB, © 2002-2025 MyBB Group.
Linear Mode
Threaded Mode
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend