jmarkovitsr / Rythm_paper

final paper phonetics
0 stars 0 forks source link

@jvcasillas #3

Open jmarkovitsr opened 4 years ago

jmarkovitsr commented 4 years ago

Hola @jvcasillas, ya tengo listo todos mis estímulos y traté de sacar la data con el script del PA3 (porque pienso que necesito los mismos datos que usamos en ese PA), pero el script no corre, me podrías ayudar o dar una pista y así puedo empezar a trabajar en R? Guardé el script en la carpeta del repositorio y así, cuando tengas un tiempo, lo puedes ver. De antemano muchas gracias

jvcasillas commented 4 years ago

Hola Jenifer. Intentemos hacer un poco de trouble shooting usando GitHub. Ponme el error que te da aquí y miramos lo que se tiene que modificar en el script.

jmarkovitsr commented 4 years ago

esto aparece [image: image.png] gracias

On Wed, May 6, 2020 at 10:41 AM Joseph V. Casillas notifications@github.com wrote:

Hola Jenifer. Intentemos hacer un poco de trouble shooting usando GitHub. Ponme el error que te da aquí y miramos lo que se tiene que modificar en el script.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmarkovitsr/Rythm_paper/issues/3#issuecomment-624689421, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGTACEO32ERLBAEZ4QEKGTRQFZLFANCNFSM4M2P4I6A .

jvcasillas commented 4 years ago

No veo nada.

jmarkovitsr commented 4 years ago

image ahora?

jvcasillas commented 4 years ago

Parece que has copiado y pegado este código de otro script y has borrado el # del primer comentario.

jmarkovitsr commented 4 years ago

no te entiendo Joseph, disculpa, el script que corrí está en la carpeta script del repositorio (solo cambié los path del script del PA3) y luego cuando lo corrí, aparece el error que se ve en la imagen que pegué en el issue anterior. Espero haya sido clara Gracias

jvcasillas commented 4 years ago

Lo que has puesto en ese script parece ser una copia de un script que usamos antes. Al copiarlo se te ha olvidado un # en el primer comentario. Como dice en el error, line 1. En el script original había más información antes de lo que es line 1 en tu script (por eso intuyo que lo has copiado y pegado). Entonces solo tienes que reponer el # y no te dará ese error (seguramente te dé otro). Tiene sentido?

jmarkovitsr commented 4 years ago

sí, sí, muy claro, diculpa, lo volveré a copiar y te cuento Gracias Joseph

On Wed, May 6, 2020 at 11:40 AM Joseph V. Casillas notifications@github.com wrote:

Lo que has puesto en ese script parece ser una copia de un script que usamos antes. Al copiarlo se te ha olvidado un # en el primer comentario. Como dice en el error, line 1. En el script original había más información antes de lo que es line 1 en tu script (por eso intuyo que lo has copiado y pegado). Entonces solo tienes que reponer el # y no te dará ese error (seguramente te dé otro). Tiene sentido?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmarkovitsr/Rythm_paper/issues/3#issuecomment-624724923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGTACGLSICTP6UMBTU4YB3RQGAGDANCNFSM4M2P4I6A .

jmarkovitsr commented 4 years ago

Hola Joseph, ahora sale un error en la línea 120. En el script que estoy tratando de correr aparece esto language$ = Get label of point: 3, 1 y el error dice esto image

jvcasillas commented 4 years ago

Por lo que leo parece que el código del script busca un point tier pero lo que tienes en tu textgrid no es eso (será interval tier).

jvcasillas commented 4 years ago

Otra cosa... este script te saca formant frequencies. No ibas a mirar duración? No recuerdo bien ahora pero me da que puedes simplificar el script mucho.

jmarkovitsr commented 4 years ago

Cuando creé los textgrid hice cuatro labels, word, vowel1, vowel2 y language. Los tres primeros son interval tier y language es point tear. Y sí, quiero mirar solo la duración de las vocales, pero no sé como modificar el script que nos diste para hacer eso

jvcasillas commented 4 years ago

Ah muy bien. Entonces sí, podemos quitar mucho fluff. Le echo un vistazo cuando tenga el portátil delante.

jmarkovitsr commented 4 years ago

Gracias Joseph, estoy tratando sola, copiando de tus scripts y viendo en internet, pero no sé como crear mis variables, y tampoco sé el código para que saque la duración de ambas vocales. En resumen te quiero decir que lo estoy intentado. Muchas gracias

On Wed, May 6, 2020 at 12:21 PM Joseph V. Casillas notifications@github.com wrote:

Ah muy bien. Entonces sí, podemos quitar mucho fluff. Le echo un vistazo cuando tenga el portátil delante.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmarkovitsr/Rythm_paper/issues/3#issuecomment-624748458, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGTACERWMRH35BBTID5HUDRQGFB3ANCNFSM4M2P4I6A .

jmarkovitsr commented 4 years ago

Hola Joseph, sorry for bothering you again, but it when I run the script it says that is a problem with line 56 And also if you can take a look at the data, the column vowel_1 and vowel_2 has an odd information Sorry for so many emails image

jvcasillas commented 4 years ago

No need to apologize. It’s not a bother and this is what GitHub is for. Your error is very informative. It looks like you might have made a mistake in one of your textgrids. That’s why it stopped. Look in the praat object window and check what the last .wav and .texgrid pair was. Open them (view and edit) and check to see if the textgrid has a mistake. It probably does.

jmarkovitsr commented 4 years ago

Hi Joseph, I could run the script with all the items (I had to fix several text grids), but I would like to ask if you can take a look to the CSV since the information in the columns vowel1 and vowel 2 is odd, there is no a number, it appears this 'vowel_1:2'

Gracias por todo tu tiempo

jvcasillas commented 4 years ago

Jaja poco a poco. No quería agobiarte con todo a la vez. No hay valores en esas columnas porque es script aún no calcula la duración. Si lo miras bien verás que dentro del bucle hay un comentario que señala donde se tiene que incluir ese código. Como la variable no tiene ese código al ejecutar el script solo pone el nombre de la variable. Intenta calcular la duración de la palabra, v1 y v2. La tarea de programación 3 tiene un ejemplo de lo que tienes que hacer. Prueba algo y avísame con el resultado/error. El primer paso siempre es determinar cuál es el problema.

jmarkovitsr commented 4 years ago

jajaj,ya, muy bien, buen método de enseñanza, esto nunca se me va a olvidar. Bueno, voy a probar y te voy contando

On Wed, May 6, 2020 at 3:23 PM Joseph V. Casillas notifications@github.com wrote:

Jaja poco a poco. No quería agobiarte con todo a la vez. No hay valores en esas columnas porque es script aún no calcula la duración. Si lo miras bien verás que dentro del bucle hay un comentario que señala donde se tiene que incluir ese código. Como la variable no tiene ese código al ejecutar el script solo pone el nombre de la variable. Intenta calcular la duración de la palabra, v1 y v2. La tarea de programación 3 tiene un ejemplo de lo que tienes que hacer. Prueba algo y avísame con el resultado/error. El primer paso siempre es determinar cuál es el problema.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmarkovitsr/Rythm_paper/issues/3#issuecomment-624841519, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGTACANYQO4BBR4YEYA5RLRQG2JVANCNFSM4M2P4I6A .

jmarkovitsr commented 4 years ago

Joseph, estoy perdida, no tengo idea como calcular la duración de la palabra o las vocales en el script, estuve revisando el script del PA3 e intenté varias cosas, pero no me resulta

jvcasillas commented 4 years ago

Pon aquí lo que has hecho para empezar y lo arreglamos juntos.

jmarkovitsr commented 4 years ago

he hecho varias cosas. Miré en el script de PA3 y probé los siguientes códigos (algunos copiados tal cual otros y otros modificados)

  1. Extract part... intervalstart intervalend rectangular 1 no language$ = Get label of point: 3, 1 vonset = Get starting point: 2, 2 voffset = Get end point: 2, 2 durationV = voffset - vonset
  2. Luego copié el siguiente código select Sound 'soundname$' Extract part... intervalstart intervalend rectangular 1 no do ("To Formant (burg)...", 0, 5, 4800, 0.025, 30) f1_20 = do ("Get value at time...", 1, per20, "Hertz", "Linear") f1_35 = do ("Get value at time...", 1, per35, "Hertz", "Linear") y lo modifiqué Extract part... intervalstart intervalend rectangular 1 no do ("To Formant (burg)...", 0, 5, 4800, 0.025, 30) vowel_1 = do ("Get value at time...", 1, per1, "Hertz", "Linear") vowel_2= do ("Get value at time...", 1, per2, "Hertz", "Linear") y luego copié este código item$ = Get label of interval: 1, interval vowel$ = Get label of interval: 2, interval pero siempre me aparece error en la primera línea del nuevo código copiado
jvcasillas commented 4 years ago

he hecho varias cosas. Miré en el script de PA3 y probé los siguientes códigos (algunos copiados tal cual otros y otros modificados)

Perfecto. Parece que has encontrado justo lo que necesitas.

  1. Extract part... intervalstart intervalend rectangular 1 no language$ = Get label of point: 3, 1 vonset = Get starting point: 2, 2 voffset = Get end point: 2, 2 durationV = voffset - vonset

Aquí vonset da el starting point de la vocal. El primer 2 representa el tier y el segundo el interval. Puedes adaptar esto para que te dé la misma información. Te hacen falta 2 cosas para calcular la duración: v1_onset y v1_offset (puedes darle el nombre que quieras. Luego, calculas la duración de la vocal:

v1_dur = v1_offset - v1_onset

Luego lo tienes que hacer de nuevo para la segunda vocal.

  1. Luego copié el siguiente código select Sound 'soundname$' Extract part... intervalstart intervalend rectangular 1 no do ("To Formant (burg)...", 0, 5, 4800, 0.025, 30) f1_20 = do ("Get value at time...", 1, per20, "Hertz", "Linear") f1_35 = do ("Get value at time...", 1, per35, "Hertz", "Linear") y lo modifiqué Extract part... intervalstart intervalend rectangular 1 no do ("To Formant (burg)...", 0, 5, 4800, 0.025, 30) vowel_1 = do ("Get value at time...", 1, per1, "Hertz", "Linear") vowel_2= do ("Get value at time...", 1, per2, "Hertz", "Linear") y luego copié este código item$ = Get label of interval: 1, interval vowel$ = Get label of interval: 2, interval pero siempre me aparece error en la primera línea del nuevo código copiado

Este código no te sirve ya que no te interesan formant frequencies.

jmarkovitsr commented 4 years ago

Joseph, escribí este código Extract part... intervalstart intervalend rectangular 1 no language$ = Get label of point: 3, 1 v1_onset = Get starting point: 2, 2 v1_offset = Get end point: 2, 2 v2_onset = Get starting point: 3, 3 v2_offset = Get starting point: 3, 3 v1_dur = v1_offset - v1_onset v2_dur = v2_offset - v2_onset pero me sale error línea 62 o sea en Extract part... intervalstart intervalend rectangular 1 no image

jmarkovitsr commented 4 years ago

y tengo unas preguntas:

  1. language es un point tear y está en el tier 4, entonces se escribe langauge$ = 4,1 ?
  2. el tier y el intervalo es lo mismo, es decir, si V1 esta en tier 2, el intervalo también es 2, no es así? gracias
jvcasillas commented 4 years ago

Esa primera parte (Extract part... intervalstart intervalend rectangular 1 no) no hace falta (es para cuando solo tienes un textgrid muy largo, como era el caso en PA3).

Creo que el resto está casi perfecto.

  1. language es un point tear y está en el tier 4, entonces se escribe langauge$ = 4,1 ?

Exacto! Bueno... language$ = Get label of point: 4, 1

  1. el tier y el intervalo es lo mismo, es decir, si V1 esta en tier 2, el intervalo también es 2, no es así?

Así es. Entonces algo tipo...

v1_onset = Get starting point: 2, 2
v1_offset = Get end point: 2, 2
v2_onset = Get starting point: 3, 2
v2_offset = Get starting point: 3, 2
v1_dur = v1_offset - v1_onset
v2_dur = v2_offset - v2_onset
jmarkovitsr commented 4 years ago

Hola Joseph ahora corrió, pero cuando abro el csv en la carpeta data en mi proyecto en mi desktop no aparecen los valores de la duración de las vocales (aparece solo el nombre de las variables) Adjunto el script

Set up output file ----------------------------------------------------------

Store path to where we want to save data (look at the structure of your project)

savePath$ = "C:/Users/jmarkovits/desktop/Rythm_paper/data/"

Choose name for .csv file

outFile$ = "vowel_data.csv"

Delete current file

filedelete 'savePath$'/'outFile$'

Create file with headers

fileappend 'savePath$'/'outFile$' id,language,item,vowel_1,vowel_2,'newline$'

-----------------------------------------------------------------------------

Set up loop -----------------------------------------------------------------

Set path to stim files (.wav and .TextGrid)

filePath$ = "C:/Users/jmarkovits/desktop/Rythm_paper/item/"

Get .wav file and store in list

Create Strings as file list... dirFiles 'filePath$'/*.wav

Select .wav file and corresponding textgrid

select Strings dirFiles numberOfStrings = Get number of strings

-----------------------------------------------------------------------------

Run loop --------------------------------------------------------------------

for interval from 1 to numberOfStrings select Strings dirFiles fileName$ = Get string... interval prefix$ = fileName$ - ".wav" Read from file... 'filePath$'/'prefix$'.wav Read from file... 'filePath$'/'prefix$'.TextGrid select TextGrid 'prefix$'

#
# Get id, item, vowel and language labels
#

id$ = prefix$
item$ = Get label of interval: 1, 2
language$ = Get label of point: 4, 1
vowel_1$ = Get label of interval: 2, 2
vowel_2$ = Get label of interval: 3, 2

# Get vowel durations

language$ = Get label of point: 4, 1

v1_onset = Get starting point: 2, 2

v1_offset = Get end point: 2, 2

v2_onset = Get starting point: 3, 2

v2_offset = Get starting point: 3, 2

v1_dur = v1_offset - v1_onset

v2_dur = v2_offset - v2_onset

# Print results to window and save to .csv file
printline 'id$','language$','item$','vowel_1','vowel_2'
fileappend 'savePath$'/'outFile$' 'id$','language$','item$','vowel_1:2',
...'vowel_2:2''newline$'

endfor

Remove objects from praat menu

select all

Remove

---------------------------------------------------------------

jvcasillas commented 4 years ago

I can't really read that but I imagine that the issue is that the variable names containing the durations don't match up with the column names in the file you created. You need to change the column names at the top and bottom of the script.

Ex.

fileappend 'savePath$'/'outFile$' id,language,item,vowel_1,vowel_2,'newline$'

Needs to be...

fileappend 'savePath$'/'outFile$' id,language,item, v1_dur, v1_dur,'newline$'

Same thing here:

# Print results to window and save to .csv file
printline 'id$','language$','item$','vowel_1','vowel_2'
fileappend 'savePath$'/'outFile$' 'id$','language$','item$','vowel_1:2',
...'vowel_2:2''newline$'
jmarkovitsr commented 4 years ago

Joseph, disculpa, creo que esto es lo último y no te molesto más. Me salieron los valores de v1, pero en v2 aparecieron solo ceros. Te copio las modificaciones que hice at the top fileappend 'savePath$'/'outFile$' id,language,item, v1_dur, v2_dur,'newline$' at the bottom

Print results to window and save to .csv file

printline 'id$','language$','item$','v1_dur','v2_dur' fileappend 'savePath$'/'outFile$' 'id$','language$','item$','v1_dur', ...'v2_dur''newline$'

jvcasillas commented 4 years ago

La columnas están bien. Ahora veo que la segunda línea donde sacas el offset de v2 no está bien. Tienes que coger el end point y no el starting point.

jmarkovitsr commented 4 years ago

por fin!!!!!!!! muchas gracias Joseph y disculpa todo el tiempo que tomó. Ahora puedo trabajar en R y en esa plataforma me siento un poquito, pero solo un poquito más cómoda, ja Gracias gracias, que tengas buena tarde junto a tu familia

jvcasillas commented 4 years ago

No hay de que! No ha sido para tanto. Buen trabajo. Puedes cerrar este issue. 👍🏽