2

I am relatively new to praat, and I have written a praat script that segments a larger file into smaller files based on a procedure:

@instance: "sbc001", 756.00, 758.70 procedure instance: .sound$, .start, .end

However, praat is removing final zeros. For example, if my start time is 756.00 and my end time is 758.70 it will name the file sbc001_756_758_7 instead of naming it sbc001_756_00_758_70. Is there some way to force praat to include these zeros?

I might be able to modify my perl code to return 758 and 70 so that I could put them together as a decimal in praat, but I'm not sure how to do that while getting praat to read it as a number.

1 Answer 1

1

I’m not currently working with Praat, but I assume you’re calling something like string$() for the filename at some point. (Or, it’s being called implicitly to coerce your numerics into strings.) Can you use this function instead?

fixed$ (number, precision)

From Praat Manual: "formats a number as a string with precision digits after the decimal point. Thus, fixed$ (72.65687, 3) becomes the string 72.657, and fixed$ (72.65001, 3) becomes the string 72.650. In these examples, we see that the result can be rounded up and that trailing zeroes are kept. At least one digit of precision is always given, e.g. fixed$ (0.0000157, 3) becomes the string 0.00002. The number 0 always becomes the string 0."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.