Search code examples
praat

how to edit the result of praat script?


I have praat script which give me information about intensity of sound, and the result will be in text file but the result does not seem good and messy ? can any one help me to make equal spaces between the columns so I can see every column clearly?

the result like this: enter image description here

part of my script :

calculates the intensity values

    select Intensity 'soundname$'
    min_int = Get minimum... onset offset Parabolic
    min_time = Get time of minimum... onset offset Parabolic
    max_int = Get maximum... onset offset Parabolic
    max_time = Get time of maximum... onset offset Parabolic
    mean_Int = Get mean... onset offset dB


    resultline$ = " 'soundname$'    'label$'           'mean_Int'          'min_int'       'min_time'           'max_int'            'max_time'           "
    fileappend "'textfile$'" 'resultline$'
endif

endfor


Solution

  • You can improve the output by using tabs as separators. If the values you are printing also have very variable lengths, it might also be useful to limit the precision with which they are printed.

    Using the line you provided, you can do this using the shorthand, like this:

    resultline$ = soundname$ + tab$ + label$ + tab$ + "'mean_Int:3''tab$''min_int:3''tab$''min_time:3''tab$''max_int:3''tab$''max_time:3'"           "
    

    or the new syntax

    appendFileLine: soundname$ + tab$ + label$ + tab$ +
      ... fixed$(mean_Int, 3)  + tab$ +
      ... fixed$(min_int,  3)  + tab$ +
      ... fixed$(min_time, 3)  + tab$ +
      ... fixed$(max_int,  3)  + tab$ +
      ... fixed$(man_time, 3)