Online Sequencer Make music online
  • Sequences
  • Members
  • Import MIDI
  • Forum

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

Online Sequencer Forums › Off Topic › General Discussion
« Previous 1 … 34 35 36 37 38 … 42 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
392 Posts:
 
#7
07-14-2018, 06:57 AM
Code:
Frank
Frank
Jacob_
Suggestion: instead of parsing a BMP file, just draw the image onto a canvas and read the pixel data from it. Then it will work with any file format. https://stackoverflow.com/questions/8751020/how-to-get-a-pixels-x-y-coordinate-color-from-an-image

1. Thanks for the bombshell. I think I will cry myself to sleep now.
2. I think my next version will
a. incorporate the above and
b. output a string that can be interpreted as OS data for cross-origin convenience.

I guess this is version 1.0!
function nearestInstrument(color) {
   RGBColor = color.slice(0, 3).map(x => x * color[3] / 255);
   var result;
   var smallest = Infinity;
   for (i = 0; i < settings.numInstruments; 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;
}
SequencerView.fastGraphics = true;
var canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
var img = document.getElementById('sidebar').children[0].children[0].children[0];
var total = ':'
for (var h = img.height - 1; h > -1; h--) {
   for (var w = 0; w < img.width; w++) {
       total += [h, piano[w], 1, nearestInstrument(canvas.getContext('2d').getImageData(h, w, 1, 1).data)].join(' ') + ';';
   }
}
$.each(audioSystem.instrumentVolume, x => audioSystem.setInstrumentVolume(x, 0))
canvas.getContext('2d').getImageData(h, w, 1, 1).data;
loadData(total);

[i]

Version 1.1, Version 1.0 was rushed cuz I need [i]sleep
.[/i]
[/i]
Code:
function nearestInstrument(color) {
   RGBColor = color.slice(0, 3).map(x => x * color[3] / 255);
   var result;
   var smallest = Infinity;
   for (i = 0; i < settings.numInstruments; 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;
}
SequencerView.fastGraphics = true;
var canvas = document.createElement('canvas');
var img = document.getElementById('sidebar').children[0].children[0].children[0];
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
var total = ':'
for (var h = img.height - 1; h > -1; h--) {
   for (var w = 0; w < img.width; w++) {
       total += [h, piano[w], 1, nearestInstrument(canvas.getContext('2d').getImageData(h, w, 1, 1).data)].join(' ') + ';';
   }
}
loadData(total);
$.each(audioSystem.instrumentVolume, x => audioSystem.setInstrumentVolume(x, 0));



Kim Wrote: + 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 - by zapmek - 07-13-2018, 06:51 PM
RE: Pointless Program: BMOS v0.1 - by Frank - 07-13-2018, 08:17 PM
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-2022 MyBB Group.
Linear Mode
Threaded Mode
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend