I have got this function in my program.
def time(transcriptionFile) :
''' This function changes the time values in secs from the transcription file and keeps a list of start time and duration for each phoneme.'''
with open("transcriptions.txt", "r") as tFile :
timeList = []
parameterList = []
frame = 0.04
lines = 0
for line in tFile :
lines += 1
for i in range(lines) :
i = i * frame
timeList.append(i)
li = line.split()
if li :
start_time = (int(li[0]) / 10000000.)
end_time = (int(li[1]) / 10000000.)
duration = ((int(li[1]) -int(li[0]))/10000000.)
poly = poly_coeff(start_time, end_time, i)
Newton(poly, parameterList)
I want to use i as an argument in poly_coeff. The number of times this function is called is the number of lines in the file. And i is increasing with each line. So when the function is called for the first time the first i value should should be passed as argument then second time the second i value should be passed and so on.
I have certainly done it wrong here I can see but can’t figure out how to do it in a right way. Also I guess too much is going on inside a single function. Is it better to split it? But everything is to do with opening the same file.
If you want the line number then you should do
If you want to use line number * frame
then do
I dont know what you are trying to do with