Added TextGrid Interval Support

#1

Here's screenshots of the changes:

Screenshot 2025-06-20 at 11.10.12 AM.png
Screenshot 2025-06-20 at 11.10.29 AM.png

Here's a sample output:

File type = "ooTextFile"
Object class = "TextGrid"

xmin = 0.0
xmax = 26.74608
tiers? <exists>
size = 2
item []:
    item [1]:
        class = "IntervalTier"
        name = "sentence"
        xmin = 0.0
        xmax = 26.74608
        intervals: size = 10
        intervals [1]:
            xmin = 0.0
            xmax = 0.7995000400000001
            text = ""
        intervals [2]:
            xmin = 0.7995000400000001
            xmax = 3.4185402
            text = "and seemed to work pretty well that way too"
        intervals [3]:
            xmin = 3.4185402
            xmax = 4.7975004
            text = ""
        intervals [4]:
            xmin = 4.7975004
            xmax = 12.9231205
            text = "also of course we would usually fill the gas tank on sunday if we had been doing any driving through the week"
        intervals [5]:
            xmin = 12.9231205
            xmax = 13.4625
            text = ""
        intervals [6]:
            xmin = 13.4625
            xmax = 16.130500340179836
            text = "and my first recollections"
        intervals [7]:
            xmin = 16.130500340179836
            xmax = 16.421021
            text = ""
        intervals [8]:
            xmin = 16.421021
            xmax = 21.62864
            text = "that there were no filling stations at all any anywhere that i can remember"
        intervals [9]:
            xmin = 21.62864
            xmax = 22.84768
            text = ""
        intervals [10]:
            xmin = 22.84768
            xmax = 26.74608
            text = "so dad when he first got his car"
    item [2]:
        class = "IntervalTier"
        name = "IPATier"
        xmin = 0.0
        xmax = 26.74608
        intervals: size = 10
        intervals [1]:
            xmin = 0.0
            xmax = 0.7995000400000001
            text = ""
        intervals [2]:
            xmin = 0.7995000400000001
            xmax = 3.4185402
            text = "ʌnsimdwʌkpɹɪɾiwɛlðæʔweɪtu"
        intervals [3]:
            xmin = 3.4185402
            xmax = 4.7975004
            text = ""
        intervals [4]:
            xmin = 4.7975004
            xmax = 12.9231205
            text = "ɔlsoʊkɔʌwiwʊdjuʒlifɪlʌɡæʃtæŋkɑnsʌndiɪfɪfwihɛdbɪnduɪŋɛnidɹaɪvɪŋθɹuðʌwik"
        intervals [5]:
            xmin = 12.9231205
            xmax = 13.4625
            text = ""
        intervals [6]:
            xmin = 13.4625
            xmax = 16.130500340179836
            text = "ændmaɪfɹ̩stɹɛkʌlɛkʃʌnz"
        intervals [7]:
            xmin = 16.130500340179836
            xmax = 16.421021
            text = ""
        intervals [8]:
            xmin = 16.421021
            xmax = 21.62864
            text = "ɑðɛtɛɹwɹ̩ʌnoʊfɪlɪŋsteɪʃʌnzɾɔɛniɛñiweɪðɛɾaɪkɪnɹmɛmbʌ"
        intervals [9]:
            xmin = 21.62864
            xmax = 22.84768
            text = ""
        intervals [10]:
            xmin = 22.84768
            xmax = 26.74608
            text = "soʊdɛdwɛɾ̃ifɹ̩stɡɑtɪzkʌ"

The files I used to test it out:

File type = "ooTextFile"
Object class = "TextGrid"

xmin = 0 
xmax = 26.74608 
tiers? <exists> 
size = 1 
item []: 
    item [1]:
        class = "IntervalTier" 
        name = "sentence" 
        xmin = 0 
        xmax = 26.74608 
        intervals: size = 10 
        intervals [1]:
            xmin = 0 
            xmax = 0.7995000400000001 
            text = "" 
        intervals [2]:
            xmin = 0.7995000400000001 
            xmax = 3.4185402 
            text = "and seemed to work pretty well that way too" 
        intervals [3]:
            xmin = 3.4185402 
            xmax = 4.7975004 
            text = "" 
        intervals [4]:
            xmin = 4.7975004 
            xmax = 12.9231205 
            text = "also of course we would usually fill the gas tank on sunday if we had been doing any driving through the week" 
        intervals [5]:
            xmin = 12.9231205 
            xmax = 13.4625 
            text = "" 
        intervals [6]:
            xmin = 13.4625 
            xmax = 16.130500340179836 
            text = "and my first recollections" 
        intervals [7]:
            xmin = 16.130500340179836 
            xmax = 16.421021 
            text = "" 
        intervals [8]:
            xmin = 16.421021 
            xmax = 21.62864 
            text = "that there were no filling stations at all any anywhere that i can remember" 
        intervals [9]:
            xmin = 21.62864 
            xmax = 22.84768 
            text = "" 
        intervals [10]:
            xmin = 22.84768 
            xmax = 26.74608 
            text = "so dad when he first got his car"
Owner

Thanks, Parth! The TextGrid output looks exactly right to me! Nice work on that.

Could you please add the soundfile dependency to requirements.txt? I know it's used by librosa, so it should be installed, but this will explicitly put it in the dependencies, so nothing will break if we decide to stop using librosa in the future.

Before we merge this in, I'd also like to discuss some potential UI changes. However, I'm not sure how difficult they would be to implement, so I want to brainstorm with you first.

Owner

Closing as this functionality was replaced by PR #2

ginic changed pull request status to closed

Sign up or log in to comment