timmahrt / praatIO.js

Javascript library for reading and writing textgrid files
MIT License
15 stars 4 forks source link

Generalization of PraatIO to open all kind of ooTextFile #7

Open CarlosJimenez opened 4 years ago

CarlosJimenez commented 4 years ago

Hello Tim Based in my previous excellent experience solving my issue, I want to expose an idea

I would like to know your opinion about a posible generalisation of PraatIO Praat uses his own programming language and his own file format. I think PraatIO could include a converter to Javascript of his own file format ooTextFile For example if you want to exports Formats, you get a similar file format as TextGrids.

Maybe could be interesting to expand parseTextGrid to other kind of ooTextFile file format

header of .TextGrid

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

xmin = 0 
xmax = 3118.9278684807255 
tiers? <exists> 
size = 1 
item []: 
    item [1]:
        class = "IntervalTier" 

header of .Formats

File type = "ooTextFile"
Object class = "Formant 2"

xmin = 0 
xmax = 1.5270521541950113 
nx = 237 
dx = 0.00625 
x1 = 0.026026077097505596 
maxnFormants = 5 
frames []: 
    frames [1]:

header of .Matrix

File type = "ooTextFile"
Object class = "Matrix 2"

xmin = 0 
xmax = 3.4339909297052156 
nx = 542 
dx = 0.00625 
x1 = 0.026370464852607745 
ymin = 1 
ymax = 1 
ny = 1 
dy = 1 
y1 = 1 
z [] []: 
    z [1]:
        z [1] [1] = 686.944363934466 
        z [1] [2] = 652.149122145149 

I understand that this could be a lot of work for you. I could try by myself and give to you a proposal of a function parse_ooTextFile if you prefer.

What do you think?

I attach a couple of examples of ooTextFiles example.Formant.zip example.Matrix.zip

Interesting links: https://www.fon.hum.uva.nl/praat/manual/TextGrid_file_formats.html https://stackoverflow.com/questions/6167630/how-to-parse-this-format-praat-textgrid

Best regards

timmahrt commented 4 years ago

Hi Carlos, Thank you for the idea. PraatIO has lots of different file formats that it creates, it would be a lot of work to support them all. I can look into maybe adding support incrementally. But I hesitate to give a time estimate.

If you have time and would like to implement something, you could open a PR in PraatIO or make a new library.

Thanks! Tim