~ubuntu-branches/ubuntu/maverick/speech-tools/maverick

« back to all changes in this revision

Viewing changes to intonation/tilt/tilt_synthesis.cc

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry, Kumar Appaiah, Kartik Mistry
  • Date: 2007-11-19 17:39:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071119173939-l5zuh2waxmrel31x
Tags: 1:1.2.96~beta-1
[Kumar Appaiah]
* Long awaited new upstream version (Closes: #437682)
* debian/patches:
  + Split all patches, and use quilt for patch management
  + Use latest config.guess, config.sub
* Minor manpage description fix
* debian/rules:
  + Fix old autoconf files, using autotools-dev
  + Find versions using debian/get_versions.sh, instead of hard coding

[Kartik Mistry]
* Added debian/watch file from Kumar
* debian/control:
  + Added homepage entry
  + Added Kumar Appaiah as co-maintainer list
  + Added XS-Dm-Upload-Allowed: yes to allow Debian-Maintainer upload
* debian/copyright: moved copyright out of license section
* debian/manpage.1: fixed lintian warning
* debian/rules: includes base_class/*.cc which is badly needed for
  festival compilation

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
 
92
92
void fill_connection_values(EST_Track &fz, float start_f0, float start_pos,
93
93
                 float end_f0, float end_pos)
94
 
 
95
94
{
96
95
    float f_shift, a, m;
97
96
    int j;
98
 
 
99
97
    f_shift = fz.shift();
100
 
 
101
98
    if ((end_pos - start_pos) == 0)
102
99
        m = 0.0;
103
100
    else
104
101
        m = (end_f0 - start_f0) / (end_pos - start_pos);
105
 
 
106
 
    for (j = 0; j < fz.num_frames(); ++j)
107
 
    {
108
 
        fz.a(j) = (m * (float) j * f_shift) + start_f0;
109
 
        fz.set_value(j);
110
 
    }
111
 
    // hack to fill final values because of timing rounding errors
112
 
    a = fz.a(j -1);
113
 
    for (; j < fz.num_frames(); ++j)
114
 
        fz.a(j) = a;
115
 
 
 
102
        for (j = 0; j < fz.num_frames()-1; ++j)
 
103
        {
 
104
                fz.a(j) = (m * (float) j * f_shift) + start_f0;
 
105
                fz.set_value(j);
 
106
        }
 
107
        fz.a(fz.num_frames()-1) = end_f0;
 
108
        fz.set_value(fz.num_frames()-1);
 
109
                // hack to fill final values because of timing rounding errors
 
110
    //a = fz.a(j -1);  // I Think this is ezafi
 
111
    //for (; j < fz.num_frames(); ++j)
 
112
        //fz.a(j) = a;
116
113
}
117
114
 
118
115
 
125
122
    float end_pos, end_f0;
126
123
    int n;
127
124
 
128
 
    if (event_item(*ev.tail()))
 
125
    if (event_item(*ev.tail())) 
129
126
        n = (int)(ceil((ev.tail()->F("time") + 
130
127
                        ev.tail()->F("rfc.fall_dur",0)) / f_shift)) + 1;
131
128
    else
148
145
            start_pos = e->F("time") - e->F("rfc.rise_dur");
149
146
            end_pos = e->F("time") + e->F("rfc.fall_dur");
150
147
 
151
 
            start_index = (int) floor(start_pos / f_shift); 
152
 
            end_index = (int) ceil(end_pos / f_shift); 
153
 
 
 
148
                if ((start_pos / f_shift-(int)start_pos / f_shift)>.5)
 
149
                        start_index=int(start_pos / f_shift+1);
 
150
                else
 
151
                        start_index = (int) start_pos / f_shift;        
 
152
                if(end_pos / f_shift-(int)end_pos / f_shift>.5)
 
153
                        end_index = int( end_pos / f_shift+1); 
 
154
                else
 
155
                        end_index = (int) end_pos / f_shift; 
154
156
//          cout << "a: " << fz.equal_space() << endl;
155
157
 
156
158
            fz.sub_track(sub, start_index, (end_index - start_index) + 1, 
182
184
        end_f0 = nn->F("ev.f0") - nn->F("rfc.rise_amp", 0.0);
183
185
        end_pos = nn->F("time") - nn->F("rfc.rise_dur", 0.0);
184
186
 
185
 
        start_index = (int) floor(start_pos / f_shift); 
186
 
        end_index = (int) ceil(end_pos / f_shift); 
 
187
        if ((start_pos / f_shift-(int)start_pos / f_shift)>.5)
 
188
                start_index=int(start_pos / f_shift+1);
 
189
        else
 
190
                start_index = (int) start_pos / f_shift; 
 
191
        if(end_pos / f_shift-(int)end_pos / f_shift>.5)
 
192
                end_index = int( end_pos / f_shift+1); 
 
193
        else
 
194
                end_index = (int) end_pos / f_shift; 
 
195
 
187
196
 
188
197
        if (start_index >= end_index) // no connection needed
189
198
            continue;
190
199
 
191
 
        fz.sub_track(sub, start_index, end_index - start_index +1, 0, EST_ALL);
 
200
        fz.sub_track(sub, start_index, end_index - start_index+1 , 0, EST_ALL); 
192
201
 
193
202
        fill_connection_values(sub, start_f0, start_pos, end_f0, end_pos);
194
203
    }