OSCR

Words and Meters: Neural Evidence for a Connection Between Individual Differences in Statistical Learning and Rhythmic Ability in Infancy.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 1,203 lines · 45 KB · no license

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Mon May 23 10:28:36 2022
  4. @author: 4295609
  5. Script for 2AFC task pho files and RT task pho files
  6. """
  7. #%%
  8. #testing the range
  9. c = range(1,37)
  10. #for item in c:
  11. # print(item)
  12. print(len(c))
  13. #%%
  14. # RT order files first, 36 files of random orders where each word appears 4 times
  15. # This script generates streams of 16 words
  16. # and makes sure each word occurs 4 times
  17. # and do this 36 times
  18. import random
  19. c = range(1,37)
  20. for o in c:
  21. itemz = str(o)
  22. count1 = 0 #so each word occurs 4 times
  23. count2 = 0
  24. count3 = 0
  25. count4 = 0
  26. values = [1, 2, 3, 4] # options to choose from: 4 words
  27. count_total = list(range(1,16)) # we want 16 words total
  28. numbers = [random.choice(values)] # ya gotta start somewhere
  29. saveit = 0 # variable to store double item and then place it back
  30. last_value = numbers[0] # last value in numbers
  31. for n in count_total:
  32. #print("the last value from the previous round was: " + str(last_value))
  33. if last_value == 1:
  34. count1 += 1
  35. if count1 == 4:
  36. values.remove(1)
  37. count1 += 1
  38. print("I'm all out of 1!")
  39. if last_value == 2:
  40. count2 += 1
  41. if count2 == 4:
  42. values.remove(2)
  43. count2 += 1
  44. print("I'm all out of 2!")
  45. if last_value == 3:
  46. count3 += 1
  47. if count3 == 4:
  48. values.remove(3)
  49. count3 += 1
  50. print("I'm all out of 3!")
  51. if last_value == 4:
  52. count4 += 1
  53. if count4 == 4:
  54. values.remove(4)
  55. count4 += 1
  56. print("I'm all out of 4!")
  57. first_choice = random.choice(values)
  58. #print("I chose on first try: " + str(first_choice))
  59. if first_choice == last_value:
  60. if len(values) == 1: # this is important for the end
  61. second_choice = values[0]
  62. numbers.append(second_choice)
  63. break
  64. else:
  65. saveit = first_choice
  66. #print("saveit: " + str(first_choice))
  67. values.remove(saveit)
  68. #print("new possible values: " + str(values))
  69. second_choice = random.choice(values)
  70. #print("I chose on second try: " + str(second_choice))
  71. values.append(saveit)
  72. #print("new possible values: " + str(values))
  73. numbers.append(second_choice)
  74. last_value = second_choice
  75. #print(numbers)
  76. else:
  77. numbers.append(first_choice)
  78. #print(numbers)
  79. last_value = first_choice
  80. print("the length of the numbers set = " + str(len(numbers)))
  81. print(numbers)
  82. print(values) # there is always one left
  83. # it can happen that the end is 1 2 1 2 1 2 etc. but we can exchange them manually then
  84. # Make sure that each word occurs 4 times!
  85. count_for_sure1 = 0
  86. count_for_sure2 = 0
  87. count_for_sure3 = 0
  88. count_for_sure4 = 0
  89. for i in numbers:
  90. if i == 1:
  91. count_for_sure1 += 1
  92. if i == 2:
  93. count_for_sure2 += 1
  94. if i == 3:
  95. count_for_sure3 += 1
  96. if i == 4:
  97. count_for_sure4 += 1
  98. print("ones: " + str(count_for_sure1))
  99. print("twos: " + str(count_for_sure1))
  100. print("threes: " + str(count_for_sure1))
  101. print("fours: " + str(count_for_sure1))
  102. # write to a file so we don't lose anything. (first)
  103. Order1_liststr = [str(x) for x in numbers]
  104. #print(Order1_liststr)
  105. Order1_str = " "
  106. Order1_str = Order1_str.join(Order1_liststr)
  107. print(Order1_str)
  108. # write it to a .txt file
  109. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "w") as f:
  110. f.write(Order1_str)
  111. # manually made some changes to the file so it doesn't end in 1 2 1 2 etc.
  112. # so I'm going to open it again
  113. #%%
  114. # A1
  115. c = range(1,37)
  116. for o in c:
  117. itemz = str(o)
  118. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  119. #print(Order_def.read())
  120. Order_str = Order_def.read()
  121. print(Order_str)
  122. Order_def.close()
  123. Order_l = Order_str.split(" ")
  124. print(Order_l)
  125. print(len(Order_l))
  126. '''
  127. Now let's substitute the numbers for the things we need in the .pho file
  128. '''
  129. A1_RT = []
  130. for n in Order_l:
  131. if n == "1":
  132. A1_RT.append("\ns 100\nu 200 100 100\nG 100\ni 200 100 100\nt 100\na 200 100 100")
  133. elif n == "2":
  134. A1_RT.append("\nt 100\no 200 100 100\nb 100\na 200 100 100\nm 100\n2 200 100 100")
  135. elif n == "3":
  136. A1_RT.append("\ns 100\ny 200 100 100\nt 100\n2 200 100 100\nb 100\no 200 100 100")
  137. elif n == "4":
  138. A1_RT.append("\nG 100\n2 200 100 100\nb 100\ny 200 100 100\nt 100\ni 200 100 100")
  139. A1_RT.insert(0, "_ 5 100 100")
  140. A1_RT.append("\n_ 5 100 100")
  141. #for h in A1_RT:
  142. # print(h)
  143. # write to a file so we don't lose anything. (A1 Block 1)
  144. A1_Block1_str = " "
  145. A1_Block1_str = A1_Block1_str.join(A1_RT)
  146. print(A1_Block1_str)
  147. # write it to a .txt file
  148. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A1\pho_A1_RT" + itemz + ".txt", "w") as f:
  149. f.write(A1_Block1_str)
  150. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/A1/pho_A1_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/A1_RT"+itemz+".wav"
  151. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  152. g.write(mbrola_command)
  153. print("DONE")
  154. #%%
  155. #A2
  156. c = range(1,37)
  157. for o in c:
  158. itemz = str(o)
  159. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  160. #print(Order_def.read())
  161. Order_str = Order_def.read()
  162. print(Order_str)
  163. Order_def.close()
  164. Order_l = Order_str.split(" ")
  165. print(Order_l)
  166. print(len(Order_l))
  167. '''
  168. Now let's substitute the numbers for the things we need in the .pho file
  169. '''
  170. A2_RT = []
  171. for n in Order_l:
  172. if n == "1":
  173. A2_RT.append("\nt 100\na 200 100 100\ns 100\nu 200 100 100\nG 100\ni 200 100 100")
  174. elif n == "2":
  175. A2_RT.append("\nm 100\n2 200 100 100\nt 100\no 200 100 100\nb 100\na 200 100 100")
  176. elif n == "3":
  177. A2_RT.append("\nb 100\no 200 100 100\ns 100\ny 200 100 100\nt 100\n2 200 100 100")
  178. elif n == "4":
  179. A2_RT.append("\nt 100\ni 200 100 100\nG 100\n2 200 100 100\nb 100\ny 200 100 100")
  180. A2_RT.insert(0, "_ 5 100 100")
  181. A2_RT.append("\n_ 5 100 100")
  182. #for h in A2_RT:
  183. # print(h)
  184. # write to a file so we don't lose anything. (A2 Block 1)
  185. A2_Block1_str = " "
  186. A2_Block1_str = A2_Block1_str.join(A2_RT)
  187. print(A2_Block1_str)
  188. # write it to a .txt file
  189. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A2\pho_A2_RT" + itemz + ".txt", "w") as f:
  190. f.write(A2_Block1_str)
  191. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/A2/pho_A2_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/A2_RT"+itemz+".wav"
  192. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  193. g.write(mbrola_command)
  194. print("DONE")
  195. #%%
  196. #A3
  197. c = range(1,37)
  198. for o in c:
  199. itemz = str(o)
  200. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  201. #print(Order_def.read())
  202. Order_str = Order_def.read()
  203. print(Order_str)
  204. Order_def.close()
  205. Order_l = Order_str.split(" ")
  206. print(Order_l)
  207. print(len(Order_l))
  208. '''
  209. Now let's substitute the numbers for the things we need in the .pho file
  210. '''
  211. A3_RT = []
  212. for n in Order_l:
  213. if n == "1":
  214. A3_RT.append("\nG 100\ni 200 100 100\nt 100\na 200 100 100\ns 100\nu 200 100 100")
  215. elif n == "2":
  216. A3_RT.append("\nb 100\na 200 100 100\nm 100\n2 200 100 100\nt 100\no 200 100 100")
  217. elif n == "3":
  218. A3_RT.append("\nt 100\n2 200 100 100\nb 100\no 200 100 100\ns 100\ny 200 100 100")
  219. elif n == "4":
  220. A3_RT.append("\nb 100\ny 200 100 100\nt 100\ni 200 100 100\nG 100\n2 200 100 100")
  221. A3_RT.insert(0, "_ 5 100 100")
  222. A3_RT.append("\n_ 5 100 100")
  223. #for h in A3_RT:
  224. # print(h)
  225. # write to a file so we don't lose anything. (A3 Block 1)
  226. A3_Block1_str = " "
  227. A3_Block1_str = A3_Block1_str.join(A3_RT)
  228. print(A3_Block1_str)
  229. # write it to a .txt file
  230. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A3\pho_A3_RT" + itemz + ".txt", "w") as f:
  231. f.write(A3_Block1_str)
  232. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/A3/pho_A3_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/A3_RT"+itemz+".wav"
  233. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  234. g.write(mbrola_command)
  235. print("DONE")
  236. #%%
  237. # B1
  238. c = range(1,37)
  239. for o in c:
  240. itemz = str(o)
  241. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  242. #print(Order_def.read())
  243. Order_str = Order_def.read()
  244. print(Order_str)
  245. Order_def.close()
  246. Order_l = Order_str.split(" ")
  247. print(Order_l)
  248. print(len(Order_l))
  249. '''
  250. Now let's substitute the numbers for the things we need in the .pho file
  251. '''
  252. B1_RT = []
  253. for n in Order_l:
  254. if n == "1":
  255. B1_RT.append("\nd 100\na 200 100 100\np 100\n2 200 100 100\nn 100\nu 200 100 100")
  256. elif n == "2":
  257. B1_RT.append("\nd 100\n2 200 100 100\nG 100\no 200 100 100\np 100\ny 200 100 100")
  258. elif n == "3":
  259. B1_RT.append("\nr 100\no 200 100 100\nd 100\ny 200 100 100\ns 100\na 200 100 100")
  260. elif n == "4":
  261. B1_RT.append("\nG 100\ny 200 100 100\nr 100\ni 200 100 100\ns 100\n2 200 100 100")
  262. B1_RT.insert(0, "_ 5 100 100")
  263. B1_RT.append("\n_ 5 100 100")
  264. #for h in B1_RT:
  265. # print(h)
  266. # write to a file so we don't lose anything. (B1 Block 1)
  267. B1_RT_str = " "
  268. B1_RT_str = B1_RT_str.join(B1_RT)
  269. print(B1_RT_str)
  270. # write it to a .txt file
  271. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B1\pho_B1_RT" + itemz + ".txt", "w") as f:
  272. f.write(B1_RT_str)
  273. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/B1/pho_B1_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/B1_RT"+itemz+".wav"
  274. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  275. g.write(mbrola_command)
  276. print("DONE")
  277. #%%
  278. # B2
  279. c = range(1,37)
  280. for o in c:
  281. itemz = str(o)
  282. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  283. #print(Order_def.read())
  284. Order_str = Order_def.read()
  285. print(Order_str)
  286. Order_def.close()
  287. Order_l = Order_str.split(" ")
  288. print(Order_l)
  289. print(len(Order_l))
  290. '''
  291. Now let's substitute the numbers for the things we need in the .pho file
  292. '''
  293. B2_RT = []
  294. for n in Order_l:
  295. if n == "1":
  296. B2_RT.append("\nn 100\nu 200 100 100\nd 100\na 200 100 100\np 100\n2 200 100 100")
  297. elif n == "2":
  298. B2_RT.append("\np 100\ny 200 100 100\nd 100\n2 200 100 100\nG 100\no 200 100 100")
  299. elif n == "3":
  300. B2_RT.append("\ns 100\na 200 100 100\nr 100\no 200 100 100\nd 100\ny 200 100 100")
  301. elif n == "4":
  302. B2_RT.append("\ns 100\n2 200 100 100\nG 100\ny 200 100 100\nr 100\ni 200 100 100")
  303. B2_RT.insert(0, "_ 5 100 100")
  304. B2_RT.append("\n_ 5 100 100")
  305. #for h in B2_RT:
  306. # print(h)
  307. # write to a file so we don't lose anything. (B2 Block 1)
  308. B2_RT_str = " "
  309. B2_RT_str = B2_RT_str.join(B2_RT)
  310. print(B2_RT_str)
  311. # write it to a .txt file
  312. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B2\pho_B2_RT" + itemz + ".txt", "w") as f:
  313. f.write(B2_RT_str)
  314. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/B2/pho_B2_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/B2_RT"+itemz+".wav"
  315. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  316. g.write(mbrola_command)
  317. print("DONE")
  318. #%%
  319. # B3
  320. c = range(1,37)
  321. for o in c:
  322. itemz = str(o)
  323. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  324. #print(Order_def.read())
  325. Order_str = Order_def.read()
  326. print(Order_str)
  327. Order_def.close()
  328. Order_l = Order_str.split(" ")
  329. print(Order_l)
  330. print(len(Order_l))
  331. '''
  332. Now let's substitute the numbers for the things we need in the .pho file
  333. '''
  334. B3_RT = []
  335. for n in Order_l:
  336. if n == "1":
  337. B3_RT.append("\np 100\n2 200 100 100\nn 100\nu 200 100 100\nd 100\na 200 100 100")
  338. elif n == "2":
  339. B3_RT.append("\nG 100\no 200 100 100\np 100\ny 200 100 100\nd 100\n2 200 100 100")
  340. elif n == "3":
  341. B3_RT.append("\nd 100\ny 200 100 100\ns 100\na 200 100 100\nr 100\no 200 100 100")
  342. elif n == "4":
  343. B3_RT.append("\nr 100\ni 200 100 100\ns 100\n2 200 100 100\nG 100\ny 200 100 100")
  344. B3_RT.insert(0, "_ 5 100 100")
  345. B3_RT.append("\n_ 5 100 100")
  346. #for h in B3_RT:
  347. # print(h)
  348. # write to a file so we don't lose anything. (B3 Block 1)
  349. B3_RT_str = " "
  350. B3_RT_str = B3_RT_str.join(B3_RT)
  351. print(B3_RT_str)
  352. # write it to a .txt file
  353. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B3\pho_B3_RT" + itemz + ".txt", "w") as f:
  354. f.write(B3_RT_str)
  355. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/RTtaskfiles/B3/pho_B3_RT" + itemz + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_RT_23-05-2022/B3_RT"+itemz+".wav"
  356. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_RT_23-05-2022\mbrola_commands.txt", "a") as g:
  357. g.write(mbrola_command)
  358. print("DONE")
  359. #%%
  360. # A1
  361. c = range(1,37)
  362. for o in c:
  363. itemz = str(o)
  364. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  365. #print(Order_def.read())
  366. Order_str = Order_def.read()
  367. print(Order_str)
  368. Order_def.close()
  369. Order_l = Order_str.split(" ")
  370. print(Order_l)
  371. print(len(Order_l))
  372. '''
  373. Now let's substitute the numbers for the things we need in the .pho file
  374. '''
  375. A1_RT = []
  376. for n in Order_l:
  377. if n == "1":
  378. A1_RT.append("soe gie taa")
  379. elif n == "2":
  380. A1_RT.append("too baa meu")
  381. elif n == "3":
  382. A1_RT.append("suu teu boo")
  383. elif n == "4":
  384. A1_RT.append("geu buu tie")
  385. #for h in A1_RT:
  386. # print(h)
  387. # write to a file so we don't lose anything. (A1 Block 1)
  388. A1_RT_str = " "
  389. A1_RT_str = A1_RT_str.join(A1_RT)
  390. print(A1_RT_str)
  391. # write it to a .txt file
  392. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A1_RT_words" + itemz + ".txt", "w") as f:
  393. f.write(A1_RT_str)
  394. print("DONE")
  395. #%%
  396. # A2
  397. c = range(1,37)
  398. for o in c:
  399. itemz = str(o)
  400. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  401. #print(Order_def.read())
  402. Order_str = Order_def.read()
  403. print(Order_str)
  404. Order_def.close()
  405. Order_l = Order_str.split(" ")
  406. print(Order_l)
  407. print(len(Order_l))
  408. '''
  409. Now let's substitute the numbers for the things we need in the .pho file
  410. '''
  411. A2_RT = []
  412. for n in Order_l:
  413. if n == "1":
  414. A2_RT.append("taa soe gie")
  415. elif n == "2":
  416. A2_RT.append("meu too baa")
  417. elif n == "3":
  418. A2_RT.append("boo suu teu")
  419. elif n == "4":
  420. A2_RT.append("tie geu buu")
  421. #for h in A2_RT:
  422. # print(h)
  423. # write to a file so we don't lose anything. (A2 Block 1)
  424. A2_RT_str = " "
  425. A2_RT_str = A2_RT_str.join(A2_RT)
  426. print(A2_RT_str)
  427. # write it to a .txt file
  428. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A2_RT_words" + itemz + ".txt", "w") as f:
  429. f.write(A2_RT_str)
  430. print("DONE")
  431. #%%
  432. # A3
  433. c = range(1,37)
  434. for o in c:
  435. itemz = str(o)
  436. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  437. #print(Order_def.read())
  438. Order_str = Order_def.read()
  439. print(Order_str)
  440. Order_def.close()
  441. Order_l = Order_str.split(" ")
  442. print(Order_l)
  443. print(len(Order_l))
  444. '''
  445. Now let's substitute the numbers for the things we need in the .pho file
  446. '''
  447. A3_RT = []
  448. for n in Order_l:
  449. if n == "1":
  450. A3_RT.append("gie taa soe")
  451. elif n == "2":
  452. A3_RT.append("baa meu too")
  453. elif n == "3":
  454. A3_RT.append("teu boo suu")
  455. elif n == "4":
  456. A3_RT.append("buu tie geu")
  457. #for h in A3_RT:
  458. # print(h)
  459. # write to a file so we don't lose anything. (A3 Block 1)
  460. A3_RT_str = " "
  461. A3_RT_str = A3_RT_str.join(A3_RT)
  462. print(A3_RT_str)
  463. # write it to a .txt file
  464. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\A3_RT_words" + itemz + ".txt", "w") as f:
  465. f.write(A3_RT_str)
  466. print("DONE")
  467. #%%
  468. # B1
  469. c = range(1,37)
  470. for o in c:
  471. itemz = str(o)
  472. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  473. #print(Order_def.read())
  474. Order_str = Order_def.read()
  475. print(Order_str)
  476. Order_def.close()
  477. Order_l = Order_str.split(" ")
  478. print(Order_l)
  479. print(len(Order_l))
  480. '''
  481. Now let's substitute the numbers for the things we need in the .pho file
  482. '''
  483. B1_RT = []
  484. for n in Order_l:
  485. if n == "1":
  486. B1_RT.append("daa peu noe")
  487. elif n == "2":
  488. B1_RT.append("deu goo puu")
  489. elif n == "3":
  490. B1_RT.append("roo duu saa")
  491. elif n == "4":
  492. B1_RT.append("guu rie seu")
  493. #for h in B1_RT:
  494. # print(h)
  495. # write to a file so we don't lose anything. (B1 Block 1)
  496. B1_RT_str = " "
  497. B1_RT_str = B1_RT_str.join(B1_RT)
  498. print(B1_RT_str)
  499. # write it to a .txt file
  500. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B1_RT_words" + itemz + ".txt", "w") as f:
  501. f.write(B1_RT_str)
  502. print("DONE")
  503. #%%
  504. # B2
  505. c = range(1,37)
  506. for o in c:
  507. itemz = str(o)
  508. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  509. #print(Order_def.read())
  510. Order_str = Order_def.read()
  511. print(Order_str)
  512. Order_def.close()
  513. Order_l = Order_str.split(" ")
  514. print(Order_l)
  515. print(len(Order_l))
  516. '''
  517. Now let's substitute the numbers for the things we need in the .pho file
  518. '''
  519. B2_RT = []
  520. for n in Order_l:
  521. if n == "1":
  522. B2_RT.append("noe daa peu")
  523. elif n == "2":
  524. B2_RT.append("puu deu goo")
  525. elif n == "3":
  526. B2_RT.append("saa roo duu")
  527. elif n == "4":
  528. B2_RT.append("seu guu rie")
  529. #for h in B2_RT:
  530. # print(h)
  531. # write to a file so we don't lose anything. (B2 Block 1)
  532. B2_RT_str = " "
  533. B2_RT_str = B2_RT_str.join(B2_RT)
  534. print(B2_RT_str)
  535. # write it to a .txt file
  536. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B2_RT_words" + itemz + ".txt", "w") as f:
  537. f.write(B2_RT_str)
  538. print("DONE")
  539. #%%
  540. # B3
  541. c = range(1,37)
  542. for o in c:
  543. itemz = str(o)
  544. Order_def = open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\RT" + itemz + ".txt", "r")
  545. #print(Order_def.read())
  546. Order_str = Order_def.read()
  547. print(Order_str)
  548. Order_def.close()
  549. Order_l = Order_str.split(" ")
  550. print(Order_l)
  551. print(len(Order_l))
  552. '''
  553. Now let's substitute the numbers for the things we need in the .pho file
  554. '''
  555. B3_RT = []
  556. for n in Order_l:
  557. if n == "1":
  558. B3_RT.append("peu noe daa")
  559. elif n == "2":
  560. B3_RT.append("goo puu deu")
  561. elif n == "3":
  562. B3_RT.append("duu saa roo")
  563. elif n == "4":
  564. B3_RT.append("rie seu guu")
  565. #for h in B3_RT:
  566. # print(h)
  567. # write to a file so we don't lose anything. (B3 Block 1)
  568. B3_RT_str = " "
  569. B3_RT_str = B3_RT_str.join(B3_RT)
  570. print(B3_RT_str)
  571. # write it to a .txt file
  572. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\RTtaskfiles\B3_RT_words" + itemz + ".txt", "w") as f:
  573. f.write(B3_RT_str)
  574. print("DONE")
  575. #%%
  576. # AND NOW FOR THE 2AFC TASK
  577. # WORDS
  578. A1 = []
  579. A1_part = []
  580. A2 = []
  581. A2_part = []
  582. A3 = []
  583. A3_part = []
  584. B1 = []
  585. B1_part =[]
  586. B2 = []
  587. B2_part = []
  588. B3 = []
  589. B3_part = []
  590. foils_A = []
  591. foils_B = []
  592. # A1 words
  593. A1.append("\ns 100\nu 200 100 100\nG 100\ni 200 100 100\nt 100\na 200 100 100")
  594. A1.append("\nt 100\no 200 100 100\nb 100\na 200 100 100\nm 100\n2 200 100 100")
  595. A1.append("\ns 100\ny 200 100 100\nt 100\n2 200 100 100\nb 100\no 200 100 100")
  596. A1.append("\nG 100\n2 200 100 100\nb 100\ny 200 100 100\nt 100\ni 200 100 100")
  597. A1_part.append("\nt 100\na 200 100 100\nt 100\no 200 100 100\nb 100\na 200 100 100")
  598. A1_part.append("\nt 100\n2 200 100 100\nb 100\no 200 100 100\nG 100\n2 200 100 100")
  599. A2.append("\nt 100\na 200 100 100\ns 100\nu 200 100 100\nG 100\ni 200 100 100")
  600. A2.append("\nm 100\n2 200 100 100\nt 100\no 200 100 100\nb 100\na 200 100 100")
  601. A2.append("\nb 100\no 200 100 100\ns 100\ny 200 100 100\nt 100\n2 200 100 100")
  602. A2.append("\nt 100\ni 200 100 100\nG 100\n2 200 100 100\nb 100\ny 200 100 100")
  603. A2_part.append("\nG 100\ni 200 100 100\nm 100\n2 200 100 100\nt 100\no 200 100 100")
  604. A2_part.append("\ns 100\ny 200 100 100\nt 100\n2 200 100 100\nt 100\ni 200 100 100")
  605. A3.append("\nG 100\ni 200 100 100\nt 100\na 200 100 100\ns 100\nu 200 100 100")
  606. A3.append("\nb 100\na 200 100 100\nm 100\n2 200 100 100\nt 100\no 200 100 100")
  607. A3.append("\nt 100\n2 200 100 100\nb 100\no 200 100 100\ns 100\ny 200 100 100")
  608. A3.append("\nb 100\ny 200 100 100\nt 100\ni 200 100 100\nG 100\n2 200 100 100")
  609. A3_part.append("\ns 100\nu 200 100 100\nb 100\na 200 100 100\nm 100\n2 200 100 100")
  610. A3_part.append("\nb 100\no 200 100 100\ns 100\ny 200 100 100\nb 100\ny 200 100 100")
  611. B1.append("\nd 100\na 200 100 100\np 100\n2 200 100 100\nn 100\nu 200 100 100")
  612. B1.append("\nd 100\n2 200 100 100\nG 100\no 200 100 100\np 100\ny 200 100 100")
  613. B1.append("\nr 100\no 200 100 100\nd 100\ny 200 100 100\ns 100\na 200 100 100")
  614. B1.append("\nG 100\ny 200 100 100\nr 100\ni 200 100 100\ns 100\n2 200 100 100")
  615. B1_part.append("\nn 100\nu 200 100 100\nd 100\n2 200 100 100\nG 100\no 200 100 100")
  616. B1_part.append("\nd 100\ny 200 100 100\ns 100\na 200 100 100\nG 100\ny 200 100 100")
  617. B2.append("\nn 100\nu 200 100 100\nd 100\na 200 100 100\np 100\n2 200 100 100")
  618. B2.append("\np 100\ny 200 100 100\nd 100\n2 200 100 100\nG 100\no 200 100 100")
  619. B2.append("\ns 100\na 200 100 100\nr 100\no 200 100 100\nd 100\ny 200 100 100")
  620. B2.append("\ns 100\n2 200 100 100\nG 100\ny 200 100 100\nr 100\ni 200 100 100")
  621. B2_part.append("\np 100\n2 200 100 100\np 100\ny 200 100 100\nd 100\n2 200 100 100")
  622. B2_part.append("\nr 100\no 200 100 100\nd 100\ny 200 100 100\ns 100\n2 200 100 100")
  623. B3.append("\np 100\n2 200 100 100\nn 100\nu 200 100 100\nd 100\na 200 100 100")
  624. B3.append("\nG 100\no 200 100 100\np 100\ny 200 100 100\nd 100\n2 200 100 100")
  625. B3.append("\nd 100\ny 200 100 100\ns 100\na 200 100 100\nr 100\no 200 100 100")
  626. B3.append("\nr 100\ni 200 100 100\ns 100\n2 200 100 100\nG 100\ny 200 100 100")
  627. B3_part.append("\nd 100\na 200 100 100\nG 100\no 200 100 100\np 100\ny 200 100 100")
  628. B3_part.append("\ns 100\na 200 100 100\nr 100\no 200 100 100\nr 100\ni 200 100 100")
  629. foils_A.append("\nt 100\n2 200 100 100\nm 100\n2 200 100 100\ns 100\nu 200 100 100")
  630. foils_A.append("\nt 100\ni 200 100 100\nG 100\ni 200 100 100\nb 100\no 200 100 100")
  631. foils_B.append("\np 100\n2 200 100 100\nG 100\ny 200 100 100\nd 100\ny 200 100 100")
  632. foils_B.append("\nr 100\ni 200 100 100\nG 100\no 200 100 100\nn 100\nu 200 100 100")
  633. #%%
  634. # A1 words
  635. index = 1
  636. for item in A1:
  637. tijdelijk = ["_ 5 100 100"]
  638. tijdelijk_str = ""
  639. #print(item)
  640. tijdelijk.append(item)
  641. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  642. tijdelijk.append("\n_ 5 100 100")
  643. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  644. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A1_word" + str(index) + ".txt", "w") as f:
  645. f.write(tijdelijk_str)
  646. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A1_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A1_word"+str(index)+".wav"
  647. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  648. g.write(mbrola_command)
  649. index = index + 1
  650. print("DONE")
  651. #%%
  652. # A1_part words
  653. index = 1
  654. for item in A1_part:
  655. tijdelijk = ["_ 5 100 100"]
  656. tijdelijk_str = ""
  657. #print(item)
  658. tijdelijk.append(item)
  659. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  660. tijdelijk.append("\n_ 5 100 100")
  661. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  662. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A1_part_word" + str(index) + ".txt", "w") as f:
  663. f.write(tijdelijk_str)
  664. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A1_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A1_part_word"+str(index)+".wav"
  665. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  666. g.write(mbrola_command)
  667. index = index + 1
  668. print("DONE")
  669. #%%
  670. # A2 words
  671. index = 1
  672. for item in A2:
  673. tijdelijk = ["_ 5 100 100"]
  674. tijdelijk_str = ""
  675. #print(item)
  676. tijdelijk.append(item)
  677. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  678. tijdelijk.append("\n_ 5 100 100")
  679. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  680. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A2_word" + str(index) + ".txt", "w") as f:
  681. f.write(tijdelijk_str)
  682. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A2_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A2_word"+str(index)+".wav"
  683. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  684. g.write(mbrola_command)
  685. index = index + 1
  686. print("DONE")
  687. #%%
  688. # A3 words
  689. index = 1
  690. for item in A3:
  691. tijdelijk = ["_ 5 100 100"]
  692. tijdelijk_str = ""
  693. #print(item)
  694. tijdelijk.append(item)
  695. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  696. tijdelijk.append("\n_ 5 100 100")
  697. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  698. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A3_word" + str(index) + ".txt", "w") as f:
  699. f.write(tijdelijk_str)
  700. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A3_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A3_word"+str(index)+".wav"
  701. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  702. g.write(mbrola_command)
  703. index = index + 1
  704. print("DONE")
  705. #%%
  706. # B1 words
  707. index = 1
  708. for item in B1:
  709. tijdelijk = ["_ 5 100 100"]
  710. tijdelijk_str = ""
  711. #print(item)
  712. tijdelijk.append(item)
  713. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  714. tijdelijk.append("\n_ 5 100 100")
  715. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  716. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B1_word" + str(index) + ".txt", "w") as f:
  717. f.write(tijdelijk_str)
  718. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B1_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B1_word"+str(index)+".wav"
  719. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  720. g.write(mbrola_command)
  721. index = index + 1
  722. print("DONE")
  723. #%%
  724. # B2 words
  725. index = 1
  726. for item in B2:
  727. tijdelijk = ["_ 5 100 100"]
  728. tijdelijk_str = ""
  729. #print(item)
  730. tijdelijk.append(item)
  731. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  732. tijdelijk.append("\n_ 5 100 100")
  733. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  734. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B2_word" + str(index) + ".txt", "w") as f:
  735. f.write(tijdelijk_str)
  736. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B2_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B2_word"+str(index)+".wav"
  737. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  738. g.write(mbrola_command)
  739. index = index + 1
  740. print("DONE")
  741. #%%
  742. # B3 words
  743. index = 1
  744. for item in B3:
  745. tijdelijk = ["_ 5 100 100"]
  746. tijdelijk_str = ""
  747. #print(item)
  748. tijdelijk.append(item)
  749. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  750. tijdelijk.append("\n_ 5 100 100")
  751. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  752. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B3_word" + str(index) + ".txt", "w") as f:
  753. f.write(tijdelijk_str)
  754. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B3_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B3_word"+str(index)+".wav"
  755. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  756. g.write(mbrola_command)
  757. index = index + 1
  758. print("DONE")
  759. #%%
  760. # A2_part words
  761. index = 1
  762. for item in A2_part:
  763. tijdelijk = ["_ 5 100 100"]
  764. tijdelijk_str = ""
  765. #print(item)
  766. tijdelijk.append(item)
  767. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  768. tijdelijk.append("\n_ 5 100 100")
  769. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  770. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A2_part_word" + str(index) + ".txt", "w") as f:
  771. f.write(tijdelijk_str)
  772. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A2_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A2_part_word"+str(index)+".wav"
  773. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  774. g.write(mbrola_command)
  775. index = index + 1
  776. print("DONE")
  777. #%%
  778. # A3_part words
  779. index = 1
  780. for item in A3_part:
  781. tijdelijk = ["_ 5 100 100"]
  782. tijdelijk_str = ""
  783. #print(item)
  784. tijdelijk.append(item)
  785. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  786. tijdelijk.append("\n_ 5 100 100")
  787. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  788. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\A3_part_word" + str(index) + ".txt", "w") as f:
  789. f.write(tijdelijk_str)
  790. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/A3_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/A3_part_word"+str(index)+".wav"
  791. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  792. g.write(mbrola_command)
  793. index = index + 1
  794. print("DONE")
  795. #%%
  796. # B1_part words
  797. index = 1
  798. for item in B1_part:
  799. tijdelijk = ["_ 5 100 100"]
  800. tijdelijk_str = ""
  801. #print(item)
  802. tijdelijk.append(item)
  803. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  804. tijdelijk.append("\n_ 5 100 100")
  805. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  806. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B1_part_word" + str(index) + ".txt", "w") as f:
  807. f.write(tijdelijk_str)
  808. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B1_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B1_part_word"+str(index)+".wav"
  809. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  810. g.write(mbrola_command)
  811. index = index + 1
  812. print("DONE")
  813. #%%
  814. # B2_part words
  815. index = 1
  816. for item in B2_part:
  817. tijdelijk = ["_ 5 100 100"]
  818. tijdelijk_str = ""
  819. #print(item)
  820. tijdelijk.append(item)
  821. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  822. tijdelijk.append("\n_ 5 100 100")
  823. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  824. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B2_part_word" + str(index) + ".txt", "w") as f:
  825. f.write(tijdelijk_str)
  826. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B2_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B2_part_word"+str(index)+".wav"
  827. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  828. g.write(mbrola_command)
  829. index = index + 1
  830. print("DONE")
  831. #%%
  832. # B3_part words
  833. index = 1
  834. for item in B3_part:
  835. tijdelijk = ["_ 5 100 100"]
  836. tijdelijk_str = ""
  837. #print(item)
  838. tijdelijk.append(item)
  839. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  840. tijdelijk.append("\n_ 5 100 100")
  841. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  842. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\B3_part_word" + str(index) + ".txt", "w") as f:
  843. f.write(tijdelijk_str)
  844. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/B3_part_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/B3_part_word"+str(index)+".wav"
  845. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  846. g.write(mbrola_command)
  847. index = index + 1
  848. print("DONE")
  849. #%%
  850. # foils_A words
  851. index = 1
  852. for item in foils_A:
  853. tijdelijk = ["_ 5 100 100"]
  854. tijdelijk_str = ""
  855. #print(item)
  856. tijdelijk.append(item)
  857. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  858. tijdelijk.append("\n_ 5 100 100")
  859. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  860. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\foils_A_word" + str(index) + ".txt", "w") as f:
  861. f.write(tijdelijk_str)
  862. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/foils_A_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/foils_A_word"+str(index)+".wav"
  863. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  864. g.write(mbrola_command)
  865. index = index + 1
  866. print("DONE")
  867. #%%
  868. # foils_B words
  869. index = 1
  870. for item in foils_B:
  871. tijdelijk = ["_ 5 100 100"]
  872. tijdelijk_str = ""
  873. #print(item)
  874. tijdelijk.append(item)
  875. #tijdelijk = tijdelijk.insert(0, "_ 5 100 100")
  876. tijdelijk.append("\n_ 5 100 100")
  877. tijdelijk_str = tijdelijk_str.join(tijdelijk)
  878. with open(r"O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\2AFCfiles\foils_B_word" + str(index) + ".txt", "w") as f:
  879. f.write(tijdelijk_str)
  880. mbrola_command = "\n"+ r"mbrola /usr/share/mbrola/nl2/nl2 /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/2AFCfiles/foils_B_word" + str(index) + r".pho /mnt/symbolic/O-Drive/Research/GW/Projects/Phase_locking_project/Promotietraject_labfolder/Experiments/EXPERIMENT_1/Stimuli/MBROLA_2AFC_23-05-2022/foils_B_word"+str(index)+".wav"
  881. with open("O:\Research\GW\Projects\Phase_locking_project\Promotietraject_labfolder\Experiments\EXPERIMENT_1\Stimuli\MBROLA_2AFC_23-05-2022\mbrola_commands.txt", "a") as g:
  882. g.write(mbrola_command)
  883. index = index + 1
  884. print("DONE")

2AFC_RT_phogenerator.py, no license · at the source

Overview

  1. Department of Languages, Literature and Communication, Institute for Language Sciences, Utrecht University, Utrecht, the Netherlands
Institutions: Utrecht University (Netherlands)
Journal: Developmental science, volume 29, issue 2, article e70116
Dates: received 19 May 2025; accepted 7 December 2025; published online 31 December 2025; in print March 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1111/desc.70116 · PMID 41472612 · PMCID PMC12754635 · OpenAlex W7117678791
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism)
Methods: Spectral & time-frequency, Preprocessing, Statistics, Connectivity
Keywords: EEG, individual differences, infants, neural entrainment, rhythmic ability, statistical learning
MeSH: Individuality*, Language Development*, Learning*, Music*, Speech Perception*, Acoustic Stimulation, Auditory Perception, Electroencephalography, Female, Humans, Infant, Male, Periodicity (* major topic)
Topic: Neuroscience and Music Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Dutch Research Council (NWO) (PGW.21.007)
Citations: cited by 2 papers (Europe PMC); 64 references in the paper

Abstract

Music and language are both hierarchically structured: syllables combine into words, and meters are groupings of musical beats. Statistical learning (SL) supports speech segmentation through computation of transitional probabilities between syllables, and individual differences in SL ability were found predictive of further language development. The current study investigated whether rhythmic ability (RA; the ability to perceive the beat and infer the meter in a rhythmic stimulus auditory input) correlated with SL in 6‐ to 9‐month‐old infants. We further explored whether RA of the parents predicted infant RA and/or SL. We used EEG to measure infants’ neural entrainment in two conditions: (1) a speech segmentation SL condition in which transitional probabilities between syllables were the only cue to segment the speech stream into words; (2) a RA condition exposing infants to a syncopated rhythm in a quadruple meter. We correlated neural entrainment to the words in the SL condition with entrainment to the meter in the RA condition. Parents completed behavioral tasks measuring their RA and were asked about their engagement with music. Results revealed a correlation between neural entrainment indexing SL and RA in infants, which was unaffected by infant age. This correlation was specific to neural entrainment to words and meters, suggesting similarity between processing items at hierarchically corresponding levels. We found no evidence that parental RA predicted infant RA or SL. However, frequency of parent–child joint musical engagement appeared to have a positive effect on infant RA.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above.

OSF wfdkr

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Languages: Python (3)
Size: 47 files, 3 scripts
Software Heritage: not checked
Found in: the references
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
3 files
At the source:

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 3 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data Availability Statement

The data are openly available through https://doi.org/10.24416/UU01‐ZJHU40 (https://doi.org/10.24416/UU01-ZJHU40)

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 6 keywords, 13 MeSH terms, 1 funder, 58 references.

Cite

This paper

van der Wulp, I., Struiksma (Marijn), M., & Wijnen (Frank), F. (2026). Words and Meters: Neural Evidence for a Connection Between Individual Differences in Statistical Learning and Rhythmic Ability in Infancy. Developmental science, 29(2), e70116. https://doi.org/10.1111/desc.70116

BibTeX

@article{vanderwulp2026words,
author = {van der Wulp, Iris and Struiksma (Marijn), Marijn and Wijnen (Frank), Frank},
title = {{Words and Meters: Neural Evidence for a Connection Between Individual Differences in Statistical Learning and Rhythmic Ability in Infancy}},
journal = {Developmental science},
year = {2026},
month = mar,
volume = {29},
number = {2},
pages = {e70116},
publisher = {Wiley},
issn = {1363-755X},
doi = {10.1111/desc.70116},
url = {https://doi.org/10.1111/desc.70116},
pmid = {41472612},
pmcid = {PMC12754635}
}

RIS

TY - JOUR
AU - van der Wulp, Iris
AU - Struiksma (Marijn), Marijn
AU - Wijnen (Frank), Frank
TI - Words and Meters: Neural Evidence for a Connection Between Individual Differences in Statistical Learning and Rhythmic Ability in Infancy
T2 - Developmental science
J2 - Dev Sci
PY - 2026
DA - 2026/03/01
VL - 29
IS - 2
SP - e70116
SN - 1363-755X
PB - Wiley
DO - 10.1111/desc.70116
UR - https://doi.org/10.1111/desc.70116
LA - en
ER -

CSL-JSON

{
"id": "10.1111/desc.70116",
"type": "article-journal",
"title": "Words and Meters: Neural Evidence for a Connection Between Individual Differences in Statistical Learning and Rhythmic Ability in Infancy",
"container-title": "Developmental science",
"author": [
{
"family": "van der Wulp",
"given": "Iris"
},
{
"family": "Struiksma (Marijn)",
"given": "Marijn"
},
{
"family": "Wijnen (Frank)",
"given": "Frank"
}
],
"container-title-short": "Dev Sci",
"volume": "29",
"issue": "2",
"page": "e70116",
"DOI": "10.1111/desc.70116",
"PMID": "41472612",
"PMCID": "PMC12754635",
"ISSN": "1363-755X",
"publisher": "Wiley",
"URL": "https://doi.org/10.1111/desc.70116",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
1
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1002/aur.70312 [code]
Aberrant Neural Entrainment to Word-Level Speech Patterns in Fragile X Syndrome: Evidence for a Statistical Learning Deficit.
Journal: Autism research : official journal of the International Society for Autism Research
In common: EEG, 10 references
[2] doi:10.7554/elife.109901
Infants at high and low likelihood for autism show different EEG developmental trajectories in speech tracking and statistical learning.
Journal: eLife
In common: EEG, 7 references
[3] doi:10.1162/opmi.a.358 [code]
Tracking Visual Statistical Learning with Steady-State Visual Evoked Potentials: Effects of Exemplar and Category Information.
Journal: Open mind : discoveries in cognitive science
In common: EEG, 6 references
[4] doi:10.1162/imag.a.1161
The infant brain rapidly entrains to visual statistical regularities during stimulus exposure.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: EEG, 5 references
[5] doi:10.1162/imag.a.1325 [code]
Decoding everyday levels of musical training from subcortical white-matter architecture.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: 5 references
[6] doi:10.7554/elife.107088 [code]
Development of auditory and spontaneous movement responses to music over the first postnatal year.
Journal: eLife
In common: EEG, 5 references
[7] doi:10.1111/nyas.70372 [code]
Distinct Rhythmic Competencies Identified via Internet-Based Assessment.
Journal: Annals of the New York Academy of Sciences
In common: 4 references
[8] doi:10.1162/imag.a.1185 [code]
Musical groove listening does not enhance primary motor cortex activation.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: EEG, 4 references
[9] doi:10.1111/ejn.70673
Reduced Motor Preparation and Altered EEG Signatures of Prediction in Autistic Adults.
Journal: The European journal of neuroscience
In common: EEG, 3 references
[10] doi:10.1016/j.dcn.2026.101782 [code]
Do babies perceive cries as speech?
Journal: Developmental cognitive neuroscience
In common: 3 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.