# HG changeset patch # User cavaliet # Date 1414048576 -7200 # Node ID 31cea001a29827847d0a77415be3a22d8b2dd920 # Parent 7e3156578f287b0bf75bf657fdc4b59de659ae2e various channels diff -r 7e3156578f28 -r 31cea001a298 annot-server/static/js/pianoroll.js --- a/annot-server/static/js/pianoroll.js Wed Oct 22 09:18:15 2014 +0200 +++ b/annot-server/static/js/pianoroll.js Thu Oct 23 09:16:16 2014 +0200 @@ -14,10 +14,31 @@ var lineInterval = 5000; // means line every 5 seconds var nbLines = -1; var noteHeight = 110; -var noteColor = 0xB74141; +var noteColor = [0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141, + 0x2222FF, 0xB74141]; //var speed = 1; // container -x position at each frame. Speed = 1 ~ 100px for 2 seconds //var zeroTime = new Date("2014-10-06T12:16:43.000000Z").getTime(); -var noteDict = {}; +var noteDict = [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]; var pianoNotes = [1,0,1,0,1,1,0,1,0,1,0,1];//Do, Do#, Ré, Ré#, Mi, Fa, Fa#, Sol, Sol#, La, La#, Si // Visual config var drawPianoNotes = false; @@ -121,13 +142,13 @@ renderer.render(stage); } -function addNoteInContainer(note, startTime, duration, velocity, pixelsPerSecond, container, prHeight){ +function addNoteInContainer(note, startTime, duration, velocity, pixelsPerSecond, container, prHeight, canal){ //console.log("coucou 1", note, timeFromZero, ts, velocity, pixelsPerSecond, container, prHeight); var beginX = (offsetMusic + startTime) * pixelsPerSecond / 1000; var width = duration * pixelsPerSecond / 1000; // We draw the rectangle var graphics = new PIXI.Graphics(); - graphics.beginFill(noteColor, (velocity / 128)); + graphics.beginFill(noteColor[canal], (velocity / 128)); var y = (128-note) * prHeight / 128; // (128-note) because y = 0 is for note = 128 and y = 128 for note = 0 graphics.drawRect(beginX, Math.floor(y - (noteHeight/2) + ((prHeight / 128)/2)), width, noteHeight); graphics.endFill(); @@ -146,18 +167,21 @@ var note = data.content[3]; var velocity = data.content[4]; if(velocity===0){ - if(note in noteDict){ + if(typeof noteDict[data.content[2]][note]!=='undefined'){ // We close the note in container one //console.log("coucou 2", data); - var duration = data.content[1] - noteDict[note].ts; - addNoteInContainer(note, noteDict[note].ts, duration, noteDict[note].velocity, pixelsPerSecond1, container1, prHeight1); - addNoteInContainer(note, noteDict[note].ts, duration, noteDict[note].velocity, pixelsPerSecond2, container2, prHeight2); + var duration = data.content[1] - noteDict[data.content[2]][note].ts; + addNoteInContainer(note, noteDict[data.content[2]][note].ts, duration, noteDict[data.content[2]][note].velocity, pixelsPerSecond1, container1, prHeight1, data.content[2]); + addNoteInContainer(note, noteDict[data.content[2]][note].ts, duration, noteDict[data.content[2]][note].velocity, pixelsPerSecond2, container2, prHeight2, data.content[2]); // delete entry - delete noteDict[note]; + delete noteDict[data.content[2]][note]; } } else{ - noteDict[note] = {ts: data.content[1], velocity:velocity}; + if(typeof noteDict[data.content[2]]==='undefined'){ + noteDict[data.content[2]] = {}; + } + noteDict[data.content[2]][note] = {ts: data.content[1], velocity:velocity}; } } diff -r 7e3156578f28 -r 31cea001a298 client/data/categories.json --- a/client/data/categories.json Wed Oct 22 09:18:15 2014 +0200 +++ b/client/data/categories.json Thu Oct 23 09:16:16 2014 +0200 @@ -246,51 +246,27 @@ ] }, { - "label": "Je voudrais répondre", + "label": "À Rejouer", "prelabel": "", "color": "rgb(212,212,212)", "subcategories": [ { - "label": "Bon", - "prelabel": "Je voudrais répondre", + "label": "Plus vite", + "prelabel": "À Rejouer", "color": "rgb(0,143,30)", - "code": "je-voudrais-repondre-bon" - }, - { - "label": "Mauvais", - "prelabel": "Je voudrais répondre", - "color": "rgb(220,0,0)", - "code": "je-voudrais-repondre-mauvais" - }, - { - "label": "Trop", - "prelabel": "Je voudrais répondre", - "color": "rgb(162,59,59)", - "code": "je-voudrais-repondre-trop" + "code": "a-rejouer-bon" }, { - "label": "Trop peu", - "prelabel": "Je voudrais répondre", - "color": "rgb(255,234,0)", - "code": "je-voudrais-repondre-trop-peu" + "label": "Plus lentement", + "prelabel": "À Rejouer", + "color": "rgb(220,0,0)", + "code": "a-rejouer-mauvais" }, { - "label": "Dommage", - "prelabel": "Je voudrais répondre", - "color": "rgb(107,188,124)", - "code": "je-voudrais-repondre-dommage" - }, - { - "label": "C'est bienvenu", - "prelabel": "Je voudrais répondre", - "color": "rgb(255,186,0)", - "code": "je-voudrais-repondre-c-est-bienvenu" - }, - { - "label": "Intriguant", - "prelabel": "Je voudrais répondre", - "color": "rgb(52,105,169)", - "code": "je-voudrais-repondre-intriguant" + "label": "Avec un autre instrument", + "prelabel": "À Rejouer", + "color": "rgb(162,59,59)", + "code": "a-rejouer-trop" } ] } diff -r 7e3156578f28 -r 31cea001a298 utils/pianoroll-client.py --- a/utils/pianoroll-client.py Wed Oct 22 09:18:15 2014 +0200 +++ b/utils/pianoroll-client.py Thu Oct 23 09:16:16 2014 +0200 @@ -48,6 +48,6 @@ with open(sys.argv[1], 'rU') as datafile: reader = csv.reader(datafile, delimiter=' ') - app = UDPSenderApplication(9090, "127.0.0.1", '/pianoroll/test_1/', list(reader)) + app = UDPSenderApplication(9090, "127.0.0.1", '/pianoroll/test_mercredi22/', list(reader)) reactor.run()