# mp3 encoding 160kbit average (Audacity chain)
form getName
   comment Please enter your name
   sentence name firstname lastname
   comment Please enter your age
   sentence age age
   comment Please list all the languages you speak (without commas), in order of proficiency
   sentence languages language1 language2 language3
   comment Please enter your gender
   sentence gender gender
   comment Where did you grow up?
   sentence growup place country
   comment Were your parents or grandparents born in India or South Asia?
   optionmenu ancestry: 3
      option No
      option Yes, at least one of my (grand)parents
   comment How often do you have contact with people of Indian/South Asian origin living in Britain?
   optionmenu contact: 4
      option Never
      option Sometimes
      option Often
   comment This task is best done with headphones. Are you using headphones?
   optionmenu headphones: 3
      option Yes
      option Don't have any
comment Have you every received medical treatment for hearing loss or hearing problems?
   optionmenu hearing: 3
      option Yes
      option No
comment How much time would you like to spend on this listening task?
  optionmenu time: 3
     option Short form (10-13 min from here)
	 option Long form (20-24 min from here)
endform


num = randomInteger(1,10)
num2 = randomInteger(1,2)

b = Read from file... experiments/training.mfc
if (time$ == "Long form (20-24 min from here)")


if (num == 1)
  a = Read from file... experiments/experiment.mfc
  text$ = "CMR2_group1"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==2)
  a = Read from file... experiments/experiment2.mfc
  text$ = "CMR2_group2"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==3)
  a = Read from file... experiments/experiment3.mfc
  text$ = "CMR2_group3"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==4)
  a = Read from file... experiments/experiment4.mfc
  text$ = "CMR2_group4"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==5)
  a = Read from file... experiments/experiment5.mfc
  text$ = "CMR2_group5"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==6)
  a = Read from file... experiments/experiment6.mfc
  text$ = "CMR2_group6"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==7)
  a = Read from file... experiments/experiment7.mfc
  text$ = "CMR2_group7"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==8)
  a = Read from file... experiments/experiment8.mfc
  text$ = "CMR2_group8"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==9)
  a = Read from file... experiments/experiment9.mfc
  text$ = "CMR2_group9"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
elsif (num==10)
  a = Read from file... experiments/experiment10.mfc
  text$ = "CMR2_group10"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$
endif

else
if (num2==1)
if (num == 1)
  a = Read from file... experiments/experiments1.mfc
  text$ = "CMR2_group1"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==2)
  a = Read from file... experiments/experiment2s1.mfc
  text$ = "CMR2_group2"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==3)
  a = Read from file... experiments/experiment3s1.mfc
  text$ = "CMR2_group3"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==4)
  a = Read from file... experiments/experiment4s1.mfc
  text$ = "CMR2_group4"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==5)
  a = Read from file... experiments/experiment5s1.mfc
  text$ = "CMR2_group5"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==6)
  a = Read from file... experiments/experiment6s1.mfc
  text$ = "CMR2_group6"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==7)
  a = Read from file... experiments/experiment7s1.mfc
  text$ = "CMR2_group7"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==8)
  a = Read from file... experiments/experiment8s1.mfc
  text$ = "CMR2_group8"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==9)
  a = Read from file... experiments/experiment9s1.mfc
  text$ = "CMR2_group9"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
elsif (num==10)
  a = Read from file... experiments/experiment10s1.mfc
  text$ = "CMR2_group10"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s1"
endif

else

if (num == 1)
  a = Read from file... experiments/experiments2.mfc
  text$ = "CMR2_group1"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==2)
  a = Read from file... experiments/experiment2s2.mfc
  text$ = "CMR2_group2"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==3)
  a = Read from file... experiments/experiment3s2.mfc
  text$ = "CMR2_group3"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==4)
  a = Read from file... experiments/experiment4s2.mfc
  text$ = "CMR2_group4"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==5)
  a = Read from file... experiments/experiment5s2.mfc
  text$ = "CMR2_group5"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==6)
  a = Read from file... experiments/experiment6s2.mfc
  text$ = "CMR2_group6"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==7)
  a = Read from file... experiments/experiment7s2.mfc
  text$ = "CMR2_group7"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==8)
  a = Read from file... experiments/experiment8s2.mfc
  text$ = "CMR2_group8"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==9)
  a = Read from file... experiments/experiment9s2.mfc
  text$ = "CMR2_group9"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
elsif (num==10)
  a = Read from file... experiments/experiment10s2.mfc
  text$ = "CMR2_group10"+"_"+name$+"_"+age$+"_"+languages$+"_" + gender$ + "_" + growup$ + "_" + ancestry$ + "_" + contact$ + "_" + hearing$+"_s2"
endif

endif


endif  
Rename... 'text$'


demo select a
demo plus b
demo Run
demo Black
demo Times
demo 24
demo Select inner viewport... 0 100 0 100
demo Axes... 0 100 0 100
demo Paint rectangle... white 0 100 0 100
demo Black
demo Text... 50 centre 50 half You have completed the listening task. Press any key to save results.
while demoWaitForInput ( )
    if demoKeyPressed ( )
	  demo select a
      demo Extract results
      demo Collect to Table
      demo Save as tab-separated file... results/'text$'.Table
	  demo Erase all
	  demo Text... 50 centre 80 half Thank you for taking part in this listening task.
	  demo Text... 50 centre 70 half The results are now saved in the 'results' subfolder
	  demo Text... 50 centre 60 half of the folder you saved the downloaded files in.
	  demo Text... 50 centre 50 half If you did the listening task on your own 
	  demo Text... 50 centre 40 half please send this file to robert.fuchs.dd@gmail.com.
	  demo Text... 50 centre 30 half Otherwise let your supervisor know that you have finished.
	  demo Text... 50 centre 20 half Press any key to close this program.
	  while demoWaitForInput ( )
        if demoKeyPressed ( )
           demo Quit
        endif
	  endwhile
    endif
endwhile
label END