Synchronization in musical ensamble
Model was written in NetLogo 5.0.5
•
Viewed 350 times
•
Downloaded 38 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Click to Run Model
globals [tempo_medio media_quadratica scarto_n varianza min-size max-size tempi a array] breed [bandisti bandista] breed [directors director] turtles-own[tempo sigma ] to setup clear-all ifelse director? [schieramento2][schieramento] ask patches [set pcolor 8] attacco reset-ticks set-current-plot "distribuzione-velocità" set min-size time - 2 set max-size time + 2 ;set-plot-x-range min-size max-size set-plot-x-range precision (min [tempo] of turtles) 1 precision (max [tempo] of turtles + 1) 1 set-plot-y-range 0 1;num_bandisti histogram [tempo] of turtles end to schieramento ; schiera la banda nel caso in cui NON ci sia il director set-default-shape turtles "person" create-bandisti num_bandisti [set color scale-color red tempo (min [tempo] of turtles) (max [tempo] of turtles + 1) ] let j 0 let i 0 let k 0 loop [ set j 0; while [j < column] [ ask turtle k [setxy (min-pxcor + j + 1) (max-pycor - i - 1) ] set j j + 1 set k k + 1 if k >= num_bandisti [stop] ] set i i + 1 ] end to schieramento2 ; schiera la banda nel caso in cui ci sia il director set-default-shape turtles "person" create-directors 1 [set color gray] create-bandisti num_bandisti [set color scale-color red tempo (min [tempo] of turtles) (max [tempo] of turtles + 1) ] let j 0 let i 0 let k 1 ask director 0 [setxy 0 max-pycor] loop [ set j 0; while [j < column] [ ask bandista k [setxy (min-pxcor + j + 1) (max-pycor - i - 1) ] ;show k set j j + 1 set k k + 1 if k > num_bandisti [stop] ] set i i + 1 ] end to attacco ask turtles [set tempo time ] ; sia il maestro che i bandisti sono sincronizzati end to playing wait 0.05 set tempo_medio mean [tempo] of turtles ; media ifelse (director?) [sincronizziamo2 fuori_tempo2] [sincronizziamo fuori_tempo] ;clear-drawing ifelse (analize_behaviour_from: = "initial_tempo") [colora_t_iniziale] [colora_t_locale] calcoli_statistici istogramma if (all? bandisti [color = green]) [stop] ; if ticks >= 500 [stop] tick end to sincronizziamo ;senza director let j 0 let media_classe 0 ask bandisti [ let lista-tempi [tempo] of bandisti in-radius raggio while[j < num_classi][ set media_classe mean [tempo] of bandisti with [ who < (j + 1) * ceiling ( num_bandisti / num_classi) and who > j * ceiling( num_bandisti / num_classi) ] set lista-tempi lput media_classe lista-tempi set j j + 1 ] set tempo mean lista-tempi ] set tempo_medio mean [tempo] of turtles ; media end to sincronizziamo2 ;con director let j 0 let media_classe 0 ask bandisti [ let lista-tempi [tempo] of bandisti in-radius raggio set lista-tempi lput ([tempo] of turtle 0) lista-tempi ; con lput aggiungo alla lista di tempi dei bandisti nel raggio il tempo del director while[j < num_classi][ set media_classe mean [tempo] of bandisti with [ who < (j + 1) * ceiling ( num_bandisti / num_classi) and who > j * ceiling( num_bandisti / num_classi) ] set lista-tempi lput media_classe lista-tempi set j j + 1 ] set tempo mean lista-tempi ] end to fuori_tempo ;out of time without director let k 0 calcola_sigma ask bandisti [ set tempo random-normal tempo sigma set label-color blue set label precision tempo 1] end to fuori_tempo2 ; out of time with director let k 0 calcola_sigma ask bandisti [ set tempo random-normal tempo sigma set label-color blue set label precision tempo 1] ask directors [ set tempo random-normal time sigma set label-color blue set label precision tempo 1] ;I admit director set always his tempo to original time end to calcola_sigma ask turtles [set sigma (errore * tempo / 100 ) ] end to colora_t_iniziale ;green color for bandisti whose tempo differ more then 10% from original time ask bandisti[ ifelse (abs(time - tempo) / time > 0.1) [ set color green ][set color scale-color red tempo (min [tempo] of turtles) (max [tempo] of turtles + 1) ]] end to colora_t_locale ;green color for bandisti whose tempo differ more then 10% from his neighbor ask bandisti [ ifelse ( abs(mean [tempo] of turtles in-radius raggio - tempo) / time > 0.1) [ set color green ][set color scale-color red tempo (min [tempo] of turtles) (max [tempo] of turtles + 1) ]] end to calcoli_statistici let somma_quadrati 0 let k 0 while [k < num_bandisti ] [ ask turtle k [ set somma_quadrati somma_quadrati + ( tempo ) ^ 2 ] set k k + 1 ] ;media quadratica set somma_quadrati sqrt( somma_quadrati / num_bandisti ) set media_quadratica somma_quadrati set varianza variance [tempo] of turtles ;varianza ;type "varianza * 100 / tempo_medio = " print varianza * 100 / tempo_medio set scarto_n 0 let j 0 while [j < num_bandisti ] [ ask turtle j [ set scarto_n scarto_n + ( tempo - tempo_medio ) ^ Ordine_momento_rispetto_media ] set j j + 1 ] ;media di ordine dato da Ordine_momento_rispetto_media set scarto_n ((sign scarto_n) ^ (Ordine_momento_rispetto_media)) * (( abs (scarto_n / num_bandisti )) ^ ( 1 / Ordine_momento_rispetto_media )) ;show scarto_n end to istogramma set-current-plot "distribuzione-velocità" if min-size > min [tempo] of turtles [set min-size round min [tempo] of turtles - 1] if max-size < max [tempo] of turtles [set max-size ceiling max [tempo] of turtles] ;set-plot-x-range min-size max-size set-plot-x-range precision (min [tempo] of turtles) 1 precision (max [tempo] of turtles + 1) 1 set-plot-y-range 0 1;num_bandisti histogram [tempo] of turtles end to-report sign [ number ] ; it return float -1.0, 0.0, 1.0 ifelse number = 0 [ report ( number * 0 ) ] [ report ( number / (abs number ) ) ] end
There are 3 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
main.pdf | Presentazione del modello | about 10 years ago, by giuseppe torrisi | Download | |
Synchronization in musical ensamble .png | preview | Preview for 'Synchronization in musical ensamble ' | over 10 years ago, by giuseppe torrisi | Download |
This model does not have any ancestors.
This model does not have any descendants.
giuseppe torrisi
out of time of each musician
In that model each musician is out of time according to a normal distribution. Variance has been calculate as a percentage error of time of esecution. Propose how to improve this calculation
Posted over 10 years ago