spreadsheetpraat

Selecting specific data from text spreadsheet on Praat


Praat scripting noobie here. I'm expanding on a pre-existing piece of code right now, and it produces a bunch of tables based on a set of sound data, and here's a couple examples of what they look like when pasted into Excel:

Table from Sound Data 1

Table from Sound Data 2

As you can see, there are labels ascribed to different points in each sound file, and the most important ones are '%,' 'H,' & 'L'. I want to copy data from the 'tone_height' column into separate tables - 'H' tone heights in a separate 'H' table, 'L' tone heights in a separate 'L' table and so forth. Problem is, because the number of %, H, and L values are not consistent across the sound files, I'm having trouble writing an algorithm that loops through all these tables and picks up JUST the H data, for instance. This is the code I have so far:

  Read TableOfReal from headerless spreadsheet file... 'directory$''name$'.means
  nrows = Get number of rows
  ncolumns = Get number of columns
  tone_row = 0
    for n from 1 to nrows
        tone_height = Get value... n 12 
        if tone_height > 0              
            rowname$ = Get row label... n
            Select columns where row: "5", "self[row,0] = 'H'"
        endif

I was trying to tell Praat to copy column 5, and only copy the elements where the string in column 0 is 'H.' But this doesn't seem to be working - am I missing an extra step or extra conditions?


Solution

  • Once selected your table in Praat, try this:

    Extract rows where column (text): "rowLabel", "is equal to", "H"