eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spect.cpp 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /***************************************************************************
  2. * Copyright (C) 2005 to 2007 by Jonathan Duddington *
  3. * email: [email protected] *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 3 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write see: *
  17. * <http://www.gnu.org/licenses/>. *
  18. ***************************************************************************/
  19. #include "wx/wx.h"
  20. #include "speak_lib.h"
  21. #include "speech.h"
  22. #include "main.h"
  23. #include "phoneme.h"
  24. #include "synthesize.h"
  25. #include "voice.h"
  26. #include "spect.h"
  27. #include "options.h"
  28. #include "wx/txtstrm.h"
  29. #include "wx/brush.h"
  30. #include "wx/datstrm.h"
  31. extern int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control);
  32. extern unsigned char pk_shape1[];
  33. extern int pk_select;
  34. extern char voice_name[];
  35. wxPen BLUE_PEN(wxColour(0,0,255),2,wxSOLID);
  36. wxBrush BRUSH_SELECTED_PEAK(wxColour(255,180,180),wxSOLID);
  37. wxBrush BRUSH_MARKER[N_MARKERS] = {
  38. wxBrush(wxColour(200,0,255),wxSOLID),
  39. wxBrush(wxColour(255,0,0),wxSOLID),
  40. wxBrush(wxColour(255,200,0),wxSOLID),
  41. wxBrush(wxColour(0,255,0),wxSOLID),
  42. wxBrush(wxColour(0,255,255),wxSOLID),
  43. wxBrush(wxColour(200,0,255),wxSOLID),
  44. wxBrush(wxColour(200,0,255),wxSOLID),
  45. wxBrush(wxColour(255,0,200),wxSOLID) };
  46. #define DRAWPEAKWIDTH 2000
  47. #define PEAKSHAPEW 256
  48. #include <math.h>
  49. static int default_freq[N_PEAKS] =
  50. {200,500,1200,3000,3500,4000,6900,7800,9000};
  51. static int default_width[N_PEAKS] =
  52. {750,500,550,550,600,700,700,700,700};
  53. static int default_klt_bw[N_PEAKS] =
  54. {89,90,140,260,260,260,500,500,500};
  55. float SpectTilt(int value, int freq)
  56. {//=================================
  57. float x;
  58. float y;
  59. if((currentcanvas == NULL) || (currentcanvas->spectseq->bass_reduction == 0))
  60. return(float(value));
  61. y = value*value*2;
  62. if(freq < 600)
  63. {
  64. return(sqrt(y/2.5));
  65. }
  66. else
  67. if(freq < 1050)
  68. {
  69. x = 1.0 + ((1050.0-freq)* 1.5)/450.0;
  70. return(sqrt(y/x));
  71. }
  72. else
  73. {
  74. return(sqrt(y));
  75. }
  76. }
  77. SpectFrame::SpectFrame(SpectFrame *copy)
  78. {//=====================================
  79. int ix;
  80. selected = 0;
  81. keyframe = 0;
  82. spect = NULL;
  83. markers = 0;
  84. pitch = 0;
  85. nx = 0;
  86. time = 0;
  87. length = 0;
  88. amp_adjust = 100;
  89. length_adjust = 0;
  90. for(ix=0; ix<N_PEAKS; ix++)
  91. {
  92. formants[ix].freq = 0;
  93. peaks[ix].pkfreq = default_freq[ix];
  94. peaks[ix].pkheight = 0;
  95. peaks[ix].pkwidth = default_width[ix];
  96. peaks[ix].pkright = default_width[ix];
  97. peaks[ix].klt_bw = default_klt_bw[ix];
  98. peaks[ix].klt_ap = 0;
  99. peaks[ix].klt_bp = default_klt_bw[ix];
  100. }
  101. memset(klatt_param, 0, sizeof(klatt_param));
  102. klatt_param[KLATT_AV] = 59;
  103. klatt_param[KLATT_Kopen] = 40;
  104. if(copy != NULL)
  105. {
  106. *this = *copy;
  107. spect = new USHORT[nx];
  108. memcpy(spect,copy->spect,sizeof(USHORT)*nx);
  109. }
  110. }
  111. SpectFrame::~SpectFrame()
  112. {//=======================
  113. if(spect != NULL)
  114. delete spect;
  115. }
  116. int SpectFrame::Import(wxInputStream& stream1)
  117. {//==========================================
  118. // Import Pratt analysis data
  119. int ix;
  120. double x;
  121. unsigned short *spect_data;
  122. wxTextInputStream stream(stream1);
  123. stream >> time;
  124. stream >> pitch;
  125. stream >> nx;
  126. stream >> dx;
  127. if(stream1.Eof())
  128. return(1);
  129. for(ix=0; ix<N_PEAKS; ix++)
  130. {
  131. peaks[ix].pkfreq = default_freq[ix];
  132. peaks[ix].pkheight = 0;
  133. peaks[ix].pkwidth = default_width[ix];
  134. peaks[ix].pkright = default_width[ix];
  135. }
  136. for(ix=1; ix<=5; ix++)
  137. {
  138. stream >> x;
  139. formants[ix].freq = (int)x;
  140. if(x > 0)
  141. peaks[ix].pkfreq = (int)x;
  142. stream >> x;
  143. formants[ix].bandw = (int)x;
  144. }
  145. spect_data = new USHORT[nx];
  146. if(spect_data == NULL)
  147. {
  148. wxLogError(_T("Failed to allocate memory"));
  149. return(1);
  150. }
  151. max_y = 0;
  152. for(ix=0; ix<nx; ix++)
  153. {
  154. stream >> x;
  155. spect_data[ix] = (int)(sqrt(x) * 16386);
  156. if(spect_data[ix] > max_y)
  157. max_y = spect_data[ix];
  158. }
  159. spect = spect_data;
  160. return(0);
  161. } // End of SpectFrame::Import
  162. int SpectFrame::ImportSPC2(wxInputStream& stream, float &time_acc)
  163. {//===============================================================
  164. int ix;
  165. int size;
  166. unsigned short *spect_data;
  167. CYCLE cy;
  168. CYCLE *p;
  169. float len;
  170. static char peak_factor[8] = {4,5,11,20,20,25,32,32};
  171. stream.Read(&cy,44);
  172. size = SPC2_size_cycle(&cy);
  173. p = (CYCLE *)malloc(size);
  174. if(p == NULL)
  175. {
  176. return(1);
  177. }
  178. stream.SeekI(-44,wxFromCurrent);
  179. stream.Read(p,size);
  180. time = time_acc;
  181. len = cy.length / 15625.0;
  182. time_acc += len;
  183. pitch = float(cy.pitch) / 16.0;
  184. nx = cy.n_harm;
  185. dx = pitch;
  186. for(ix=0; ix<7; ix++)
  187. {
  188. peaks[ix].pkfreq = cy.peak_data[ix].freq * peak_factor[ix];
  189. if(peaks[ix].pkfreq == 0)
  190. peaks[ix].pkfreq = default_freq[ix];
  191. peaks[ix].pkheight = cy.peak_data[ix].height * 40;
  192. peaks[ix].pkwidth = cy.peak_data[ix].width_l * 12;
  193. peaks[ix].pkright = cy.peak_data[ix].width_r * 12;
  194. }
  195. for(ix=7; ix<=8; ix++)
  196. {
  197. peaks[ix].pkfreq = default_freq[ix]; // default
  198. peaks[ix].pkheight = 0;
  199. peaks[ix].pkwidth = peaks[ix].pkright = default_width[ix];
  200. }
  201. if(((cy.flags & 0x80)==0) && (peaks[1].pkheight > 0))
  202. keyframe = 1;
  203. if(cy.flags & 0x08)
  204. markers |= 4;
  205. if(cy.flags & 0x10)
  206. markers |= 2;
  207. if(cy.flags & 0x04)
  208. markers |= 8;
  209. spect_data = new USHORT[nx];
  210. if(spect_data == NULL)
  211. {
  212. wxLogError(_T("Failed to allocate memory"));
  213. return(1);
  214. }
  215. max_y = 0;
  216. for(ix=0; ix<nx; ix++)
  217. {
  218. spect_data[ix] = p->data[ix];
  219. if(spect_data[ix] > max_y)
  220. max_y = spect_data[ix];
  221. }
  222. if(nx==0)
  223. {
  224. nx = int(8000/dx);
  225. spect_data = new USHORT[nx];
  226. for(ix=0; ix<nx; ix++)
  227. spect_data[ix] = 1;
  228. max_y = 1;
  229. }
  230. spect = spect_data;
  231. free(p);
  232. return(0);
  233. } // end of ImportSPC2
  234. int SpectFrame::Load(wxInputStream& stream, int file_format_type)
  235. {//==============================================================
  236. int ix;
  237. int x;
  238. unsigned short *spect_data;
  239. wxDataInputStream s(stream);
  240. time = s.ReadDouble();
  241. pitch = s.ReadDouble();
  242. length = s.ReadDouble();
  243. dx = s.ReadDouble();
  244. nx = s.Read16();
  245. markers = s.Read16();
  246. amp_adjust = s.Read16();
  247. if(file_format_type == 2)
  248. {
  249. ix = s.Read16(); // spare
  250. ix = s.Read16(); // spare
  251. }
  252. for(ix=0; ix<N_PEAKS; ix++)
  253. {
  254. formants[ix].freq = s.Read16();
  255. formants[ix].bandw = s.Read16();
  256. peaks[ix].pkfreq = s.Read16();
  257. if((peaks[ix].pkheight = s.Read16()) > 0)
  258. keyframe = 1;
  259. peaks[ix].pkwidth = s.Read16();
  260. peaks[ix].pkright = s.Read16();
  261. if(file_format_type == 2)
  262. {
  263. peaks[ix].klt_bw = s.Read16();
  264. peaks[ix].klt_ap = s.Read16();
  265. peaks[ix].klt_bp = s.Read16();
  266. }
  267. }
  268. if(file_format_type > 0)
  269. {
  270. for(ix=0; ix<N_KLATTP2; ix++)
  271. {
  272. klatt_param[ix] = s.Read16();
  273. }
  274. }
  275. spect_data = new USHORT[nx];
  276. if(spect_data == NULL)
  277. {
  278. wxLogError(_T("Failed to allocate memory"));
  279. return(1);
  280. }
  281. max_y = 0;
  282. for(ix=0; ix<nx; ix++)
  283. {
  284. x = spect_data[ix] = s.Read16();
  285. if(x > max_y) max_y = x;
  286. }
  287. spect = spect_data;
  288. return(0);
  289. } // End of SpectFrame::Load
  290. int SpectFrame::Save(wxOutputStream& stream, int file_format_type)
  291. {//===============================================================
  292. int ix;
  293. wxDataOutputStream s(stream);
  294. s.WriteDouble(time);
  295. s.WriteDouble(pitch);
  296. s.WriteDouble(length);
  297. s.WriteDouble(dx);
  298. s.Write16(nx);
  299. s.Write16(markers);
  300. s.Write16(amp_adjust);
  301. if(file_format_type == 2)
  302. {
  303. s.Write16(0); // spare
  304. s.Write16(0); // spare
  305. }
  306. for(ix=0; ix<N_PEAKS; ix++)
  307. {
  308. s.Write16(formants[ix].freq);
  309. s.Write16(formants[ix].bandw);
  310. s.Write16(peaks[ix].pkfreq);
  311. s.Write16(keyframe ? peaks[ix].pkheight : 0);
  312. s.Write16(peaks[ix].pkwidth);
  313. s.Write16(peaks[ix].pkright);
  314. if(file_format_type == 2)
  315. {
  316. s.Write16(peaks[ix].klt_bw);
  317. s.Write16(peaks[ix].klt_ap);
  318. s.Write16(peaks[ix].klt_bp);
  319. }
  320. }
  321. if(file_format_type > 0)
  322. {
  323. for(ix=0; ix<N_KLATTP2; ix++)
  324. {
  325. s.Write16(klatt_param[ix]);
  326. }
  327. }
  328. for(ix=0; ix<nx; ix++)
  329. {
  330. s.Write16(spect[ix]);
  331. }
  332. return(0);
  333. } // end of SpectFrame::Save
  334. void SpectFrame::ZeroPeaks()
  335. {//=========================
  336. int pk;
  337. for(pk=0; pk<N_PEAKS; pk++)
  338. peaks[pk].pkheight = 0;
  339. }
  340. void SpectFrame::CopyPeaks(SpectFrame *sf)
  341. {//=======================================
  342. memcpy(peaks,sf->peaks,sizeof(peaks));
  343. memcpy(klatt_param, sf->klatt_param, sizeof(klatt_param));
  344. keyframe = sf->keyframe;
  345. }
  346. void SpectFrame::ToggleMarker(int n)
  347. {//=================================
  348. markers ^= 1<<n;
  349. }
  350. void SpectFrame::ApplyVoiceMods()
  351. {//==============================
  352. // apply the modifications to the formants which are defined in the current voice
  353. int pk;
  354. char voice_name1[40];
  355. strcpy(voice_name1, voice_name2); // remember current voice name
  356. if(LoadVoice(path_modifiervoice.mb_str(wxConvLocal),0x13) == NULL)
  357. {
  358. wxLogError(_T("Can't read voice: ")+path_modifiervoice);
  359. OnOptions2(MENU_PATH4);
  360. return;
  361. }
  362. wxLogStatus(_T("Convert using voice: ")+path_modifiervoice);
  363. for(pk=0; pk<N_PEAKS; pk++)
  364. {
  365. peaks[pk].pkfreq = (peaks[pk].pkfreq * voice->freq2[pk])/256;
  366. peaks[pk].pkheight = (peaks[pk].pkheight * voice->height2[pk])/256;
  367. peaks[pk].pkwidth = (peaks[pk].pkwidth * voice->width2[pk])/256;
  368. peaks[pk].pkright = (peaks[pk].pkright * voice->width2[pk])/256;
  369. }
  370. LoadVoice(voice_name1,1);
  371. }
  372. double SpectFrame::GetRms(int seq_amplitude)
  373. {//=========================================
  374. int h;
  375. float total=0;
  376. int maxh;
  377. int height;
  378. int htab[400];
  379. wavegen_peaks_t wpeaks[9];
  380. for(h=0; h<9; h++)
  381. {
  382. height = (peaks[h].pkheight * seq_amplitude * amp_adjust)/10000;
  383. wpeaks[h].height = height << 8;
  384. wpeaks[h].freq = peaks[h].pkfreq << 16;
  385. wpeaks[h].left = peaks[h].pkwidth << 16;
  386. wpeaks[h].right = peaks[h].pkright << 16;
  387. }
  388. maxh = PeaksToHarmspect(wpeaks,90<<16,htab,0);
  389. for(h=1; h<maxh; h++)
  390. {
  391. total += ((htab[h] * htab[h]) >> 10);
  392. }
  393. rms = sqrt(total) / 7.25;
  394. // DrawPeaks(NULL,0,0,amp);
  395. return(rms);
  396. }
  397. void SpectFrame::DrawPeaks(wxDC *dc, int offy, int frame_width, int seq_amplitude, double scale_x)
  398. {//==============================================================================================
  399. // dc==NULL means don't draw, just calculate RMS
  400. int peak;
  401. peak_t *pk;
  402. int x1,x2,x3,width,ix;
  403. int y1, y2;
  404. double yy;
  405. int max_ix;
  406. int height;
  407. int pkright;
  408. int pkwidth;
  409. int buf[DRAWPEAKWIDTH*2];
  410. max_ix = int(9000 * scale_x);
  411. memset(buf,0,sizeof(buf));
  412. for(peak=0; peak<N_PEAKS; peak++)
  413. {
  414. pk = &peaks[peak];
  415. if((pk->pkfreq == 0) || (pk->pkheight==0)) continue;
  416. height = pk->pkheight;
  417. pkright = pk->pkright;
  418. pkwidth = pk->pkwidth;
  419. x1 = (int)(pk->pkfreq*scale_x);
  420. x2 = (int)((pk->pkfreq + pkright)*scale_x);
  421. x3 = (int)((pk->pkfreq - pkwidth)*scale_x);
  422. if(x3 >= DRAWPEAKWIDTH)
  423. continue; // whole peak is off the scale
  424. if((width = x2-x1) <= 0) continue;
  425. for(ix=0; ix<width; ix++)
  426. {
  427. buf[x1+ix] += height * pk_shape1[(ix*PEAKSHAPEW)/width];
  428. }
  429. if((width = x1-x3) <= 0) continue;
  430. for(ix=1; ix<width; ix++)
  431. {
  432. if(x3+ix >= 0)
  433. {
  434. buf[x3+ix] += height * pk_shape1[((width-ix)*PEAKSHAPEW)/width];
  435. }
  436. }
  437. }
  438. rms = buf[0]>>12;
  439. rms = rms*rms*23;
  440. rms = rms*rms;
  441. if(dc != NULL) dc->SetPen(*wxGREEN_PEN);
  442. x1 = 0;
  443. y1 = offy - ((buf[0] * FRAME_HEIGHT) >> 21);
  444. for(ix=1; ix<max_ix; ix++)
  445. {
  446. yy = buf[ix]>>12;
  447. yy = yy*yy*23;
  448. rms += (yy*yy);
  449. x2 = ix;
  450. y2 = offy - ((buf[ix] * FRAME_HEIGHT) >> 21);
  451. if(dc != NULL) dc->DrawLine(x1,y1,x2,y2);
  452. x1 = x2;
  453. y1 = y2;
  454. }
  455. rms = sqrt(rms)/200000.0;
  456. // apply adjustment from spectseq amplitude
  457. rms = rms * seq_amplitude * amp_adjust / 10000.0;
  458. rms = GetRms(seq_amplitude);
  459. } // end of SpectFrame::DrawPeaks
  460. void SpectFrame::Draw(wxDC& dc, int offy, int frame_width, double scalex, double scaley)
  461. {//=====================================================================================
  462. int pt;
  463. int peak;
  464. peak_t *pk;
  465. int ix;
  466. double x0, x1;
  467. int y0, y1;
  468. int x, x2, x3;
  469. double xinc;
  470. double yf;
  471. int font_height;
  472. wxString text;
  473. if(currentcanvas == NULL)
  474. return;
  475. dc.SetFont(*wxSWISS_FONT);
  476. xinc = dx * scalex;
  477. x0 = xinc;
  478. x1 = nx * xinc;
  479. if(selected) // this frame is selected
  480. {
  481. // highlight selected peak by drawing a red triangle
  482. pk = &peaks[pk_select];
  483. x2 = int(pk->pkright * scalex * 0.44);
  484. x3 = int(pk->pkwidth * scalex * 0.44);
  485. x = int((pk->pkfreq) * scalex);
  486. y1 = (pk->pkheight * FRAME_HEIGHT) >> 14;
  487. if(y1 < 5) y1 = 5;
  488. wxPoint triangle[3];
  489. dc.SetBrush(BRUSH_SELECTED_PEAK);
  490. dc.SetPen(*wxTRANSPARENT_PEN);
  491. triangle[0] = wxPoint(0,-y1);
  492. triangle[1] = wxPoint(x2,0);
  493. triangle[2] = wxPoint(-x3,0);
  494. dc.DrawPolygon(3,triangle,x,offy);
  495. }
  496. // draw the measured formants
  497. dc.SetPen(BLUE_PEN);
  498. for(peak=1; peak<=5; peak++)
  499. {
  500. if(formants[peak].freq != 0)
  501. {
  502. // set height from linear interpolation of the adjacent
  503. // points in the spectrum
  504. pt = (int)(formants[peak].freq / dx);
  505. y0 = spect[pt-1];
  506. y1 = spect[pt];
  507. yf = (y1-y0) * (formants[peak].freq - pt*dx)/dx;
  508. y1 = offy - (int)((y0+yf) * scaley);
  509. x1 = formants[peak].freq * scalex;
  510. dc.DrawLine((int)x1,offy,(int)x1,y1);
  511. }
  512. }
  513. // draw the spectrum outline
  514. if(keyframe)
  515. dc.SetPen(*wxBLACK_PEN);
  516. else
  517. dc.SetPen(*wxMEDIUM_GREY_PEN);
  518. if(spect != NULL)
  519. {
  520. y0 = offy - (int)(spect[0] * scaley);
  521. for(pt=1; pt<nx; pt++)
  522. {
  523. x1 = x0 + xinc;
  524. y1 = offy - (int)(SpectTilt(spect[pt],int(pt*dx)) * scaley);
  525. dc.DrawLine((int)x0,y0,(int)x1,y1);
  526. x0 = x1;
  527. y0 = y1;
  528. }
  529. }
  530. if(currentcanvas->zoom < 2)
  531. dc.SetFont(FONT_SMALL);
  532. else
  533. dc.SetFont(FONT_MEDIUM);
  534. // Markers
  535. x = frame_width - 120 - 32;
  536. for(ix=0; ix<N_MARKERS; ix++)
  537. {
  538. if(markers & 1<<ix)
  539. {
  540. dc.SetBrush(BRUSH_MARKER[ix]);
  541. y0 = offy-FRAME_HEIGHT+22;
  542. dc.DrawRectangle(x,y0,22,22);
  543. if(currentcanvas->zoom > 2)
  544. {
  545. text.Printf(_T("%d"),ix);
  546. dc.DrawText(text,x+2,y0);
  547. }
  548. x -= 26;
  549. }
  550. }
  551. DrawPeaks(&dc,offy,frame_width,currentcanvas->spectseq->amplitude,scalex);
  552. font_height = int(15 / currentcanvas->zoomy);
  553. text.Printf(_T("%3dmS %.1fHz"),int(time*1000),pitch);
  554. dc.DrawText(text,frame_width-130,offy-FRAME_HEIGHT+20+font_height);
  555. if(keyframe || rms > 0)
  556. {
  557. text.Printf(_T("%3d"),(int)rms);
  558. dc.DrawText(text,frame_width-130,offy-FRAME_HEIGHT+20+font_height*2);
  559. }
  560. dc.SetPen(*wxBLACK_PEN);
  561. dc.DrawLine(0,offy,frame_width,offy); // base line
  562. } // end of SpectFrame::Draw
  563. void SpectFrame::KlattDefaults()
  564. {//============================
  565. // set default values for Klatt parameters
  566. int pk;
  567. int bw;
  568. int bw3;
  569. klatt_param[KLATT_AV] = 59;
  570. klatt_param[KLATT_AVp] = 0;
  571. klatt_param[KLATT_Fric] = 0;
  572. klatt_param[KLATT_FricBP] = 0;
  573. klatt_param[KLATT_Aspr] = 0;
  574. klatt_param[KLATT_Turb] = 0;
  575. klatt_param[KLATT_Skew] = 0;
  576. klatt_param[KLATT_Tilt] = 0;
  577. klatt_param[KLATT_Kopen] = 40;
  578. klatt_param[KLATT_FNZ] = 280;
  579. bw = 60;
  580. if(peaks[1].pkfreq < 400)
  581. bw = 55;
  582. if(peaks[1].pkfreq > 600)
  583. bw = 70;
  584. if(peaks[1].pkfreq > 650)
  585. bw = 80;
  586. if(peaks[1].pkfreq > 750)
  587. bw = 90;
  588. peaks[1].pkwidth = bw;
  589. bw = 90;
  590. bw3 = 150;
  591. if(peaks[2].pkfreq < 1000)
  592. {
  593. bw = 80;
  594. bw3 = 120;
  595. }
  596. if(peaks[2].pkfreq > 1600)
  597. {
  598. bw = 100;
  599. bw3 = 200;
  600. }
  601. if(peaks[2].pkfreq > 2000)
  602. {
  603. bw = 110;
  604. bw3 = 250;
  605. }
  606. peaks[2].pkwidth = bw;
  607. peaks[3].pkwidth = bw3;
  608. peaks[4].pkwidth = 200;
  609. peaks[5].pkwidth = 200;
  610. peaks[6].pkwidth = 500;
  611. peaks[0].pkfreq = 280; // FNP
  612. peaks[0].pkwidth = 280; // FNZ
  613. peaks[7].pkfreq = 7800;
  614. peaks[7].pkwidth = 0;
  615. peaks[8].pkfreq = 9000;
  616. peaks[8].pkwidth = 0;
  617. for(pk=0; pk<=8; pk++)
  618. {
  619. peaks[pk].pkheight = peaks[pk].pkwidth << 6;
  620. peaks[pk].pkright = 0;
  621. }
  622. }