exemples/MUSICWORKS.JLOGO

POUR HLIGNE :y 
SOIT "w DIFF :width2 15
SOIT "old POS
LC FPOS PH MINUS :w :y BC FPOS PH :w :y LC FPOS :old
FIN

POUR PORTEE :y :cle
FCC 0
REPETE 5 [ HLIGNE :y SOIT "y :y + 6]
EXEC PH :cle PH DIFF 20 :width2 :y
FIN

POUR Noire :x :y
LC FPOS PH :x :y BC FCAP 0
ESECTEUR 5 4 0 360 TD 90 AV 4 TG 90 AV 27
FIN

POUR CLESOL :x :y
FIN

POUR CLEFA :x :y
FIN

POUR JoueSouris :pos
SOIT "x ITEM 1 :pos SOIT "y ITEM 2 :pos
SI :x < :_xNotes [STOP]
SI OU :y < 24 :y > 102 [STOP]
FOCTAVE 2
SI :y > 37 [FOCTAVE 3]
SI :y > 58 [FOCTAVE 4]
SI :y > 79 [FOCTAVE 5]
SOIT "y (:y - 24) / 3 - OCTAVE * 7
SOIT "y ARRONDIS :y + 17
SOIT "duree DUREE SOIT "tempo TEMPO
SOIT "note ITEM :y :nomNotes
FTEMPO 60 FDUREE 0.5 JOUE :note
FTEMPO :tempo FDUREE :duree
AjouteNote :note ATTENDSMUSIQUE
SOIT "y 24 + 3 * (OCTAVE * 7 + :y - 17)
DessineNoteA :_xNotes :y
DONNE "_xNotes SOMME :_xNotes (28 * DUREE)
FIN

POUR MUSICWORKS
VE CT FCFG 214 FTAILLEG 14 FPOLICEG "Serif
SOIT "width2 DIV ITEM 1 TGRAPH 2
SOIT "height2 DIV ITEM 2 TGRAPH 2
SOIT "nomNotes [DO RE MI FA SOL LA SI]
SOIT "nomDuree [DoubleCroche Croche Noire NoirePointee Blanche BlanchePointee Ronde]
SOIT "nbreDuree [0.25 0.5 1 1.5 2 2.5 4]
PORTEE 66 "CLESOL
PORTEE 30 "CLEFA
BOUTON 0 -50 "Quitter 23 BOUTON 110 -50 "Jouer 28 BOUTON 0 -80 "Instrument... 5 BOUTON 110 -80 "Tempo 24
SOIT "etat -110
SOIT "info -50
INFO
DONNE "notes [] DONNE "_xNotes DIFF 50 :width2
BoucleEvent
ETAT [Tu peux relire tes notes, elles sont dans :notes. Pour les jouer, ecris JoueNotes :notes]
FIN

POUR BOUTON :x :y :t :d
LC FPOS PH :x :y BC
FCC 50 FCAP 90 REPETE 2 [ AV 90 REPETE 10 [AV 1 TD 9] AV 14 REPETE 10 [AV 1 TD 9 ]]
SOIT "rect PH PH PH PH :x + 2 :y - 4 PH :x + 87 :y - 4 PH :x + 87 :y - 23 PH :x + 2 :y - 23
FCC 215 REMPLISPOLY :rect FCC 2 LC FPOS PH :x + :d :y - 17 BC ECG :t
FIN

POUR DessineNote :n
SOIT "y POSITION ITEM 1 :n :nomNotes
SI ET EGAL? :y 1 EGAL? OCTAVE 4 [SOIT "trait VRAI][SOIT "trait FAUX]
SOIT "y 24 + 3 * (OCTAVE * 7 + :y - 17)
DessineNoteA :_xNotes :y
SI :trait [LC FPOS :_xNotes - 2 BC FCAP -90 AV 8]
DONNE "_xNotes SOMME :_xNotes (28 * DUREE)
FIN

POUR DessineNoteA :x :y
EXEC PH ITEM POSITION DUREE :nbreDuree :nomDuree PH :x :y
FIN

POUR POSITION :c :l
SOIT "i 1
REPETE COMPTE :l [SI EGAL? :c ITEM :i :l [RENDS :i] SOIT "i :i + 1]
RENDS 1 ; je ferais mieux de rendre -1
FIN

POUR INFO
SOIT "rect PH PH PH PH MINUS :width2 :info + 20 PH DIFF 200 :width2 :info + 20 PH DIFF 200 :width2 :info - 50 PH MINUS :width2 :info - 50
FCC CF REMPLISPOLY :rect
SOIT "x DIFF 30 :width2 FCC 108 SOIT "y :info
LC FPOS PH :x :y - 40 BC ECG PH "Instr: INSTRUMENT
LC FPOS PH :x :y - 20 BC ECG PH "Tempo: TEMPO
LC FPOS PH :x :y BC ECG "Note: DessineNoteA :x + 50 :y - 1
FIN

POUR ETAT :st
SOIT "rect PH PH PH PH MINUS :width2 :etat PH :width2 :etat PH :width2 :etat - 20 PH MINUS :width2 :etat - 20
FCC 210 REMPLISPOLY :rect FCC 180 LC FPOS PH DIFF 20 :width2 :etat - 16 BC ECG :st
FIN

POUR DansBouton :r :pt
SOIT "X ITEM 1 :pt SOIT "Y ITEM 2 :pt
SOIT "x ITEM 1 :r SOIT "y ITEM 2 :r
SI OU :X < :x :X > :x + 92 [RENDS FAUX]
SI OU :Y > :y :Y < :y - 25 [RENDS FAUX]
RENDS VRAI
FIN

POUR BoucleEvent
ETAT [Attente de la souris...]
SOIT "pos LISSOURIS
SI DansBouton [0 -50] :pos [STOP]
SI DansBouton [110 -50] :pos [Joue BoucleEvent]
SI DansBouton [0 -80] :pos [Instrument BoucleEvent]
SI DansBouton [110 -80] :pos [Tempo BoucleEvent]
JoueSouris :pos
BoucleEvent
FIN

POUR AjouteNote :n
SOIT "note LISTE " PH PH :n OCTAVE DUREE
DONNE "notes PH :notes :note
DessineNote :n
FIN

POUR JoueUneNote :n
EC :n
FOCTAVE ITEM 2 :n
FDUREE ITEM 3 :n
JOUE ITEM 1 :n
FIN

POUR Joue
ETAT [Je joue la musique...]
JoueNotes :notes ATTENDSMUSIQUE
FIN

POUR JoueNotes :notes
SOIT "i 1
REPETE COMPTE :notes [ JoueUneNote ITEM :i :notes SOIT "i :i + 1]
FIN

POUR Instrument
ETAT [Ecris le nom ou le numero d'un instrument]
SOIT "instr LL
ATTRAPEERREUR [FINSTRUMENT :instr] [ ATTRAPEERREUR [FINSTRUMENT ITEM 1 :instr] [ETAT PH PH [Je ne connais pas cet instrument] :instr [. Recommence] ATTENDS 2 Instrument]]
SOIT "tempo TEMPO SOIT "duree DUREE SOIT "octave OCTAVE
FTEMPO 120 FDUREE 1 FOCTAVE 4 JOUE "DO JOUE "DO FDUREE .5 JOUE "RE JOUE "MI
FTEMPO :tempo FDUREE :duree FOCTAVE :octave INFO ATTENDSMUSIQUE
FIN

POUR Tempo
ETAT [Ecris le tempo d?sir?]
SOIT "tempo LISMOT
ATTRAPEERREUR [FTEMPO :tempo] [ETAT PH PH [Je ne peux pas faire ce tempo] :tempo [. Recommence] ATTENDS 2 Tempo]
INFO
FIN

MUSICWORKS

 
Me faire un don