diff --git a/src/VowelChart.tsx b/src/VowelChart.tsx index 63fecee..29a4269 100644 --- a/src/VowelChart.tsx +++ b/src/VowelChart.tsx @@ -21,9 +21,6 @@ export function VowelChart(props: { mousePath: [], } - const [width, setWidth] = Solid.createSignal(700) - const [height, setHeight] = Solid.createSignal(400) - Solid.onMount(() => { state.ctx = state.canvas.getContext("2d")! @@ -150,7 +147,9 @@ function mouseMove( state: State, ev: MouseEvent | TouchEvent) { - ev.preventDefault() + if (state.mouseDown) + ev.preventDefault() + updateMousePos(state, ev) } @@ -159,7 +158,9 @@ function mouseUp( state: State, ev: MouseEvent | TouchEvent) { - ev.preventDefault() + if (state.mouseDown) + ev.preventDefault() + state.mouseDown = false state.synth.setGain(0) updateMousePos(state, ev) diff --git a/src/formantExtractor.ts b/src/formantExtractor.ts index 243fdc4..12d5717 100644 --- a/src/formantExtractor.ts +++ b/src/formantExtractor.ts @@ -1,27 +1,31 @@ -import { forwardLinearPrediction } from "./lpc.ts" +import { forwardLinearPrediction, praatBurgMethod } from "./lpc.ts" import { findRoots, Complex } from "./roots.ts" // From: https://www.mathworks.com/help/signal/ug/formant-estimation-with-lpc-coefficients.html // From: https://github.com/praat/praat/blob/master/fon/Sound_to_Formant.cpp export function extractFormants( - /// An array of samples in the range [-1, 1] + /// An array of sound samples in the range [-1, 1] sample: Float32Array, /// The sampling frequency in hertz samplingFrequency: number) /// Returns the frequencies of the formants in hertz : number[] { - const sampleWindowed = - //sample.map((s, i) => s * hammingWindow(i, sample.length)) - sample.map((s, i) => s * praatGaussianWindow(i, sample.length)) + if (sample.every(s => s === 0)) + return [] - const sampleFiltered = + const samplePreemphasized = //preemphasisFilter(sampleWindowed) - praatPreemphasis(sampleWindowed, samplingFrequency) + praatPreemphasis(sample, samplingFrequency) + + const sampleWindowed = + //sample.map((s, i) => s * hammingWindow(i, sample.length)) + samplePreemphasized.map((s, i) => s * praatGaussianWindow(i, sample.length)) const lpc = - forwardLinearPrediction(sampleFiltered, 10) + //forwardLinearPrediction(sampleWindowed, 10) + praatBurgMethod(sampleWindowed, 10) const roots = findRoots(lpc) .filter(c => c.imag >= 0) @@ -30,11 +34,13 @@ export function extractFormants( const angles = roots .map(c => Math.atan2(c.imag, c.real)) + const nyquistFrequency = samplingFrequency / 2 + const frequencies = angles - .map(a => a * samplingFrequency / 2 / Math.PI) + .map(a => a * nyquistFrequency / Math.PI) const bandwidths = roots - .map(r => -Math.log(complexMagnitude(r)) * samplingFrequency / 2 / Math.PI) + .map(r => -Math.log(complexMagnitude(r)) * nyquistFrequency / Math.PI) const formants = [] for (let i = 0; i < angles.length; i++) @@ -118,11 +124,11 @@ function praatPreemphasis( { const result = new Float32Array(array) - const frequency = 50 + const preemphasisFrequency = 50 const dx = 1 / samplingFrequency - const preEmphasis = Math.exp(-2.0 * Math.PI * frequency * dx) + const preEmphasis = Math.exp(-2.0 * Math.PI * preemphasisFrequency * dx) - for (let i = array.length - 1; i >= 2; i--) + for (let i = array.length - 1; i >= 1; i--) result[i] -= preEmphasis * result[i - 1] return result diff --git a/src/lpc.ts b/src/lpc.ts index 78c6054..4a68615 100644 --- a/src/lpc.ts +++ b/src/lpc.ts @@ -1,3 +1,4 @@ +// Verified equivalent to Praat's Burg method. export function forwardLinearPrediction( sample: Float32Array, numCoeffs: number) @@ -48,6 +49,101 @@ export function forwardLinearPrediction( } +// From: https://github.com/praat/praat/blob/master/dwsys/NUM2.cpp#L1370 +export function praatBurgMethod( + samples: Float32Array, + numCoeffs: number) + : number[] +{ + const a = new Array(numCoeffs).fill(0) + + if (samples.length <= 2) + { + a[1] = -1.0 + return a + //return ( n == 2 ? 0.5 * (x [1] * x [1] + x [2] * x [2]) : x [1] * x [1] ); + } + + const b1 = new Array(samples.length).fill(0) + const b2 = new Array(samples.length).fill(0) + const aa = new Array(numCoeffs).fill(0) + + const n = samples.length + const m = numCoeffs + + // (3) + + let p = 0 + for (let j = 1; j <= n; j++) + p += samples[j - 1] * samples[j - 1] + + let xms = p / n + if (xms <= 0) + return a // warning empty + + // (9) + + b1[1 - 1] = samples[1 - 1] + if (n < 2) + return a + + b2[n - 1 - 1] = samples[n - 1] + for (let j = 2; j <= n - 1; j++) + { + b1[j - 1] = samples[j - 1] + b2[j - 1 - 1] = samples[j - 1] + } + + for (let i = 1; i <= m; i++) + { + // (7) + + let num = 0 + let denum = 0 + for (let j = 1; j <= n - i; j++) + { + num += b1[j - 1] * b2[j - 1] + denum += b1[j - 1] * b1[j - 1] + b2[j - 1] * b2[j - 1] + } + + if (denum <= 0) + return a // warning ill-conditioned + + a[i - 1] = 2 * num / denum + + // (10) + + xms *= 1 - a[i - 1] * a[i - 1] + + // (5) + + for (let j = 1; j <= i - 1; j++) + a[j - 1] = aa[j - 1] - a[i - 1] * aa[i - j - 1] + + if (i < m) + { + // (8) Watch out: i -> i+1 + + for (let j = 1; j <= i; j++) + aa[j - 1] = a[j - 1] + + for (let j = 1; j <= n - i - 1; j++) + { + b1[j - 1] -= aa[i - 1] * b2[j - 1] + b2[j - 1] = b2[j + 1 - 1] - aa[i - 1] * b1[j + 1 - 1] + } + } + } + + for (let i = 0; i < a.length; i++) + a[i] *= -1 + + a.unshift(1) + + return a +} + + /*void ForwardLinearPrediction( vector &coeffs, const vector &x ) { // GET SIZE FROM INPUT VECTORS diff --git a/src/main.tsx b/src/main.tsx index fddaf43..0753813 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,6 +7,8 @@ import { VowelChart } from "./VowelChart.tsx" import { AnalysisChart } from "./AnalysisChart.tsx" import { RecordingPanel } from "./RecordingPanel.tsx" +//import "./test.ts" + function Page() { diff --git a/src/test.ts b/src/test.ts new file mode 100644 index 0000000..154976a --- /dev/null +++ b/src/test.ts @@ -0,0 +1,1211 @@ +import { forwardLinearPrediction, praatBurgMethod } from "./lpc.ts" +import { findRoots, Complex } from "./roots.ts" + + +const data = [ + 0, + 3.005394333399636e-8, + 3.0734820910538474e-8, + 3.175381380060571e-8, + 3.34500924736858e-8, + 3.6097862476935916e-8, + 3.9796212547571486e-8, + 4.441568179913702e-8, + 4.953858123712962e-8, + 5.4406516625249424e-8, + 5.793705426526685e-8, + 5.8728982565980914e-8, + 5.5383175379120075e-8, + 4.636385497747142e-8, + 3.0200919098888335e-8, + 6.254456952348164e-9, + -2.6253767160255848e-8, + -6.685459652544523e-8, + -1.1480824468890205e-7, + -1.6836233385220112e-7, + -2.2517988895742747e-7, + -2.823427394105238e-7, + -3.3632309737186006e-7, + -3.839527664695197e-7, + -4.2181210346825537e-7, + -4.464830283268384e-7, + -4.551170320610254e-7, + -4.4587883962776687e-7, + -4.1780731407925487e-7, + -3.6964846117371053e-7, + -3.02576523836251e-7, + -2.1779520409381803e-7, + -1.1670236688132718e-7, + -3.450127517012902e-9, + 1.1965838098149106e-7, + 2.4845914481375075e-7, + 3.779827295602445e-7, + 5.055568408351974e-7, + 6.260264058255416e-7, + 7.359760729741538e-7, + 8.319829589709116e-7, + 9.111296890296217e-7, + 9.709372079669265e-7, + 0.000001009364041237859, + 0.0000010245645398754277, + 0.0000010162711987504736, + 9.81965740720625e-7, + 9.220137826559949e-7, + 8.37292134292511e-7, + 7.248593192343833e-7, + 5.881014430997311e-7, + 4.2907117858703714e-7, + 2.4714910296097514e-7, + 4.838279465957385e-8, + -1.6291421900405112e-7, + -3.815337095147697e-7, + -5.989574560771871e-7, + -8.07217702458729e-7, + -0.0000010006469892687164, + -0.0000011683188176903059, + -0.0000013033044297117158, + -0.0000014014068483447772, + -0.0000014542961253027897, + -0.0000014639845176134259, + -0.0000014290519629867049, + -0.0000013500986142389593, + -0.0000012362373809082783, + -0.0000010969700952045969, + -9.348776188744523e-7, + -7.65081324516359e-7, + -6.007950332787004e-7, + -4.434054119428765e-7, + -3.0563029440600076e-7, + -1.9488682312385208e-7, + -1.1393391474712189e-7, + -6.784284067862245e-8, + -4.6489923022363655e-8, + -4.896166672097024e-8, + -7.633664722561662e-8, + -1.0985152698594902e-7, + -1.4687856264572474e-7, + -1.73021916793914e-7, + -1.7635652227454557e-7, + -1.5438959621860704e-7, + -8.995574063419554e-8, + 1.6861898544107135e-8, + 1.7208867575391196e-7, + 3.79329151201091e-7, + 6.296054948506935e-7, + 9.217823162543937e-7, + 0.0000012509301541285822, + 0.000001601483631930023, + 0.000001971836127268034, + 0.0000023392783532472095, + 0.000002694133854674874, + 0.000003030442485396634, + 0.0000033211367735930253, + 0.000003564204689610051, + 0.000003749994903046172, + 0.000003859033313347027, + 0.000003888746505253948, + 0.000003815136551565956, + 0.0000036421170079847798, + 0.0000033617407098063268, + 0.0000029511381853808416, + 0.0000024218600174208404, + 0.0000017679847132967552, + 9.80129698291421e-7, + 8.0030353899474e-8, + -9.28908036712528e-7, + -0.000002025223466262105, + -0.0000031783276881469646, + -0.000004369170255813515, + -0.0000055406749197572935, + -0.000006672667495877249, + -0.000007702614311710931, + -0.000008585308933106717, + -0.00000929745874600485, + -0.000009783331734070089, + -0.000010013024621002842, + -0.000009971926374419127, + -0.000009630786735215224, + -0.00000899467704584822, + -0.000008089282346190885, + -0.000006910460342623992, + -0.000005503893135028193, + -0.000003902104253938887, + -0.0000021583127818303183, + -3.503514278691e-7, + 0.0000015210024457701365, + 0.000003360923074069433, + 0.000005101262559037423, + 0.0000067480459620128386, + 0.000008201560376619454, + 0.000009452938684262335, + 0.000010480276614543982, + 0.000011235148122068495, + 0.000011759539120248519, + 0.000012010687896690797, + 0.000012026204785797745, + 0.00001181449079012964, + 0.000011353224181220867, + 0.000010706272405514028, + 0.000009907575076795183, + 0.000008969195732788648, + 0.000007899521733634174, + 0.000006724955255776877, + 0.00000551601897313958, + 0.00000427960503657232, + 0.0000030006356155354297, + 0.0000017271414662900497, + 5.190800607124402e-7, + -6.552046443175641e-7, + -0.0000017101300500144134, + -0.0000027014089027943555, + -0.0000036123706195212435, + -0.000004354585598775884, + -0.0000050621597438293975, + -0.000005657661859004293, + -0.000006160936209198553, + -0.000006692444912914652, + -0.000007170850494730985, + -0.000007728589480393566, + -0.000008325282578880433, + -0.000008997063559945673, + -0.00000983237441687379, + -0.000010767730600491632, + -0.000011882946637342684, + -0.000013075173228571657, + -0.000014271287000156008, + -0.0000155931556946598, + -0.00001680901368672494, + -0.000017811014913604595, + -0.000018669376004254445, + -0.00001918069028761238, + -0.000019165223420714028, + -0.000018672402802621946, + -0.00001762255487847142, + -0.00001591326690686401, + -0.000013463743016473018, + -0.00001035108380165184, + -0.000006582496553164674, + -0.00000215762111110962, + 0.000002734833515205537, + 0.000008080396582954563, + 0.00001363418505206937, + 0.000019349878130014986, + 0.00002510556805646047, + 0.000030491935831378214, + 0.00003552253110683523, + 0.000040010432712733746, + 0.00004367646397440694, + 0.000046612127334810793, + 0.00004857572275795974, + 0.000049361042329110205, + 0.000048991500079864636, + 0.000047567849833285436, + 0.00004491235449677333, + 0.00004093140523764305, + 0.00003598341208999045, + 0.000029998855097801425, + 0.00002302593202330172, + 0.00001535322553536389, + 0.000006911309355928097, + -0.0000019665767467813566, + -0.000011005758096871432, + -0.000020297071387176402, + -0.000029206763429101557, + -0.000037670597521355376, + -0.00004568122676573694, + -0.00005254349161987193, + -0.00005860347664565779, + -0.00006336347723845392, + -0.00006642760126851499, + -0.00006838811532361433, + -0.00006860245775897056, + -0.00006721522368025035, + -0.00006458372808992863, + -0.000060166312323417515, + -0.000054799660574644804, + -0.0000485047567053698, + -0.00004105119296582416, + -0.000033158910810016096, + -0.00002478207716194447, + -0.000016124740795930848, + -0.000007958232345117722, + 6.378475347901258e-8, + 0.00000787360386311775, + 0.000014953573554521427, + 0.000021479772840393707, + 0.000027225327357882634, + 0.00003209610440535471, + 0.00003659544381662272, + 0.000040639035432832316, + 0.000043917723814956844, + 0.0000467223726445809, + 0.0000496011198265478, + 0.000051979513955302536, + 0.00005402778697316535, + 0.00005614030305878259, + 0.00005829619476571679, + 0.00006030925578670576, + 0.00006186298560351133, + 0.00006335688522085547, + 0.00006455402035498992, + 0.00006496940477518365, + 0.00006500842573586851, + 0.00006446431507356465, + 0.00006303757982095703, + 0.000059997739299433306, + 0.00005585972758126445, + 0.00005097171015222557, + 0.000044020420318702236, + 0.0000358395445800852, + 0.000026615833121468313, + 0.000014859429029456805, + 0.0000021124837985553313, + -0.000011128449841635302, + -0.000026350695407018065, + -0.00004260531204636209, + -0.000059331687225494534, + -0.00007621917029609904, + -0.00009303444676334038, + -0.00010967516573145986, + -0.00012498092837631702, + -0.00013909547124058008, + -0.00015141000039875507, + -0.00016077302279882133, + -0.00016757429693825543, + -0.00017053887131623924, + -0.00016994467296171933, + -0.0001656235399423167, + -0.00015682712546549737, + -0.0001443095097783953, + -0.0001272290392080322, + -0.00010628585732774809, + -0.00008237986912718043, + -0.000054521420679520816, + -0.000025425604690099135, + 0.0000053818562264495995, + 0.000038745572965126485, + 0.00007037551404209808, + 0.00010083521920023486, + 0.00013178602966945618, + 0.00015977340808603913, + 0.00018344355339650065, + 0.00020401805522851646, + 0.00022031180560588837, + 0.00023160901037044823, + 0.00023937651712913066, + 0.00024154517450369895, + 0.00023737111769150943, + 0.00022971814905758947, + 0.00021805601136293262, + 0.0001996719220187515, + 0.00017931153706740588, + 0.00015633756993338466, + 0.00012835179222747684, + 0.00010067266703117639, + 0.0000696876595611684, + 0.000038104724808363244, + 0.000008948809409048408, + -0.000023600894564879127, + -0.0000534158680238761, + -0.00008101274579530582, + -0.00010847722296603024, + -0.00013179628876969218, + -0.00015241104119922966, + -0.0001707203482510522, + -0.00018664424715097994, + -0.00019910548871848732, + -0.00020901000243611634, + -0.00021502112213056535, + -0.00021717799245379865, + -0.00021885725436732173, + -0.000218463217606768, + -0.00021473338711075485, + -0.00020883354591205716, + -0.00020177537226118147, + -0.00019242877897340804, + -0.00018234339950140566, + -0.00017146466416306794, + -0.00015727632853668183, + -0.00014236987044569105, + -0.00012586259981617332, + -0.00010863982606679201, + -0.00008931160118663684, + -0.00006308412412181497, + -0.00003880736039718613, + -0.00001412868732586503, + 0.000018943752365885302, + 0.000051176513807149604, + 0.00008402721141465008, + 0.00012168458488304168, + 0.00015825236914679408, + 0.0001943044044310227, + 0.00023279942979570478, + 0.0002691544941626489, + 0.0003015374531969428, + 0.00033377681393176317, + 0.00035986481816507876, + 0.00037838812568224967, + 0.0003935235145036131, + 0.00040316354716196656, + 0.00040348045877180994, + 0.00039271090645343065, + 0.00037671808968298137, + 0.0003520520112942904, + 0.00031852565007284284, + 0.0002752572181634605, + 0.00022332854859996587, + 0.0001697666448308155, + 0.00010760427539935336, + 0.000039570928493048996, + -0.00002775195571302902, + -0.00010156549979001284, + -0.00017653474060352892, + -0.00024397624656558037, + -0.0003103744820691645, + -0.0003756713995244354, + -0.00043102254858240485, + -0.0004761139862239361, + -0.0005173120298422873, + -0.0005511562339961529, + -0.0005666185752488673, + -0.0005748923285864294, + -0.000571369135286659, + -0.0005513663636520505, + -0.0005270791589282453, + -0.0004860995977651328, + -0.0004374283307697624, + -0.0003826823376584798, + -0.00031557391048409045, + -0.0002459648239891976, + -0.00017116880917456, + -0.00009179073094855994, + -0.000015093856745806988, + 0.00006196821777848527, + 0.0001420553890056908, + 0.0002482057025190443, + 0.00042442872654646635, + 0.0007565877749584615, + 0.001368134981021285, + 0.0024081217125058174, + 0.003977437037974596, + 0.0062056430615484715, + 0.00909560825675726, + 0.012553674168884754, + 0.016368480399250984, + 0.020190691575407982, + 0.02356877364218235, + 0.02600006014108658, + 0.026978807523846626, + 0.02607317827641964, + 0.023001598194241524, + 0.017663396894931793, + 0.01018503587692976, + 0.0009946684585884213, + -0.009402703493833542, + -0.0202421136200428, + -0.030724739655852318, + -0.04007168114185333, + -0.04758213832974434, + -0.05273032560944557, + -0.05519576370716095, + -0.054897330701351166, + -0.05198382958769798, + -0.04678286984562874, + -0.03975585848093033, + -0.031446125358343124, + -0.02240312471985817, + -0.013154960237443447, + -0.0041297487914562225, + 0.004343275912106037, + 0.012009993195533752, + 0.018741579726338387, + 0.0244697704911232, + 0.029188690707087517, + 0.03291129320859909, + 0.03567424416542053, + 0.03755567595362663, + 0.038574595004320145, + 0.038807421922683716, + 0.038321834057569504, + 0.03717224299907684, + 0.035407137125730515, + 0.03309682756662369, + 0.03028634935617447, + 0.02696256898343563, + 0.023143602535128593, + 0.018813394010066986, + 0.01395268365740776, + 0.00858979020267725, + 0.002693530870601535, + -0.0035680970177054405, + -0.010029586032032967, + -0.016428297385573387, + -0.022452473640441895, + -0.02773326076567173, + -0.031855951994657516, + -0.03448636084794998, + -0.03535814955830574, + -0.0343177393078804, + -0.0313849113881588, + -0.026735704392194748, + -0.020726531744003296, + -0.013831923715770245, + -0.006653357297182083, + 0.00023796374443918467, + 0.0062295240350067616, + 0.010828732512891293, + 0.013713532127439976, + 0.014687483198940754, + 0.013751843944191933, + 0.011087439022958279, + 0.007003815844655037, + 0.0019317601108923554, + -0.0036923098377883434, + -0.009304139763116837, + -0.014504065737128258, + -0.018906153738498688, + -0.022219108417630196, + -0.024256018921732903, + -0.024894172325730324, + -0.024164149537682533, + -0.022148283198475838, + -0.018952790647745132, + -0.014772186987102032, + -0.009821084327995777, + -0.0043138787150382996, + 0.0014773356961086392, + 0.007381604518741369, + 0.013161326758563519, + 0.018644120544195175, + 0.023651808500289917, + 0.02807752974331379, + 0.031835053116083145, + 0.03487348183989525, + 0.03717821091413498, + 0.038746509701013565, + 0.039593569934368134, + 0.03972383961081505, + 0.039150889962911606, + 0.03779970109462738, + 0.035621996968984604, + 0.03255964443087578, + 0.02850959077477455, + 0.023392658680677414, + 0.017187068238854408, + 0.009930881671607494, + 0.0017449809238314629, + -0.007188004907220602, + -0.016532257199287415, + -0.025919398292899132, + -0.03493283689022064, + -0.04301399365067482, + -0.04981778934597969, + -0.05492917075753212, + -0.05798962339758873, + -0.058883730322122574, + -0.057538289576768875, + -0.054029375314712524, + -0.04862340912222862, + -0.04163308069109917, + -0.03345431387424469, + -0.024548104032874107, + -0.015384724363684654, + -0.006341226864606142, + 0.00212565204128623, + 0.009745866060256958, + 0.016286764293909073, + 0.02158285304903984, + 0.025599641725420952, + 0.02835202030837536, + 0.029892880469560623, + 0.03031541407108307, + 0.029827125370502472, + 0.028603749349713326, + 0.026748450472950935, + 0.024536848068237305, + 0.022074704989790916, + 0.019484052434563637, + 0.016973264515399933, + 0.014549735002219677, + 0.012274011969566345, + 0.010244936682283878, + 0.008381111547350883, + 0.006704459898173809, + 0.005218306090682745, + 0.003894102992489934, + 0.002736474387347698, + 0.0017330343835055828, + 0.0008834604523144662, + 0.0003177469770889729, + -0.000021613906938000582, + -0.00009432623483007774, + 0.00016677248640917242, + 0.0007024998194538057, + 0.0014614538522437215, + 0.0023572701029479504, + 0.0032511777244508266, + 0.003997177351266146, + 0.004417821299284697, + 0.00433176988735795, + 0.003626125166192651, + 0.0021550203673541546, + -0.00010774892871268094, + -0.003165279282256961, + -0.00692893797531724, + -0.011241703294217587, + -0.015862595289945602, + -0.020551927387714386, + -0.025036867707967758, + -0.029022151604294777, + -0.032254282385110855, + -0.03448161110281944, + -0.03556093946099281, + -0.03538192808628082, + -0.03391067683696747, + -0.031152494251728058, + -0.027209879830479622, + -0.022276608273386955, + -0.016492435708642006, + -0.010093878023326397, + -0.003379432950168848, + 0.003490068018436432, + 0.010193170048296452, + 0.016522545367479324, + 0.022338978946208954, + 0.027346987277269363, + 0.03153179958462715, + 0.03477586805820465, + 0.03699425980448723, + 0.03823353722691536, + 0.038488175719976425, + 0.03780016675591469, + 0.036257609724998474, + 0.03392278030514717, + 0.03092036582529545, + 0.027322567999362946, + 0.023211563006043434, + 0.01872825063765049, + 0.013921362347900867, + 0.00888963881880045, + 0.0038117114454507828, + -0.0012901672162115574, + -0.006272943690419197, + -0.010992765426635742, + -0.015349358320236206, + -0.019192634150385857, + -0.02238272875547409, + -0.02487220987677574, + -0.026571450755000114, + -0.027380170300602913, + -0.027374815195798874, + -0.026525486260652542, + -0.024914221838116646, + -0.0227154903113842, + -0.019974539056420326, + -0.016880717128515244, + -0.013673752546310425, + -0.010424132458865643, + -0.007319374941289425, + -0.004532162565737963, + -0.002108615357428789, + -0.0001712697121547535, + 0.0013422303600236773, + 0.0023737389128655195, + 0.0028965778183192015, + 0.003086735960096121, + 0.003017019247636199, + 0.002692296402528882, + 0.002296107355505228, + 0.0019009712850674987, + 0.00157968292478472, + 0.0014618898276239634, + 0.0015307099092751741, + 0.0018787324661388993, + 0.002484821481630206, + 0.0033381737302988768, + 0.004456277005374432, + 0.005723420064896345, + 0.007118016481399536, + 0.008593657985329628, + 0.010018531233072281, + 0.011384917423129082, + 0.01260013971477747, + 0.0135801387950778, + 0.014344456605613232, + 0.014808240346610546, + 0.014917010441422462, + 0.014749240130186081, + 0.014230244792997837, + 0.013388674706220627, + 0.012207577005028725, + 0.010697792284190655, + 0.008926967158913612, + 0.006850246340036392, + 0.004526016768068075, + 0.002025420079007745, + -0.0006687762215733528, + -0.0034592309966683388, + -0.006289043463766575, + -0.0090842479839921, + -0.01174951996654272, + -0.014226689003407955, + -0.016411643475294113, + -0.018236741423606873, + -0.01962258107960224, + -0.0204753577709198, + -0.020811498165130615, + -0.02058994397521019, + -0.019792405888438225, + -0.01847105659544468, + -0.016657309606671333, + -0.01438299659639597, + -0.011798814870417118, + -0.008955304510891438, + -0.005942991003394127, + -0.0028925046790391207, + 0.00013044751540292054, + 0.0029736817814409733, + 0.005614141002297401, + 0.007990441285073757, + 0.009967421181499958, + 0.011601829901337624, + 0.012832620181143284, + 0.013630756177008152, + 0.014064420945942402, + 0.014100281521677971, + 0.013813881203532219, + 0.013246022164821625, + 0.012426899746060371, + 0.011428897269070148, + 0.010254038497805595, + 0.008967381902039051, + 0.007641326170414686, + 0.006297801621258259, + 0.004957611672580242, + 0.003644630080088973, + 0.0023940145038068295, + 0.0012539272429421544, + 0.00018824462313205004, + -0.0007787689100950956, + -0.0016059748595580459, + -0.002327817725017667, + -0.002912260591983795, + -0.003369593759998679, + -0.003745544934645295, + -0.003977683838456869, + -0.0041328356601297855, + -0.004230013117194176, + -0.0042273253202438354, + -0.004223248455673456, + -0.004190229345113039, + -0.004153022076934576, + -0.004148231819272041, + -0.004143955186009407, + -0.004187499638646841, + -0.004258197266608477, + -0.004363060928881168, + -0.0044950637966394424, + -0.00459266034886241, + -0.004707552958279848, + -0.004781600087881088, + -0.004767229780554771, + -0.004693519324064255, + -0.004533201921731234, + -0.004233711864799261, + -0.003813481889665127, + -0.003281978890299797, + -0.002632081275805831, + -0.0018585736397653818, + -0.0009877459378913045, + -0.00005516186138265766, + 0.0009382101125083864, + 0.0019428451778367162, + 0.0029294751584529877, + 0.0038741540629416704, + 0.004731513559818268, + 0.005520807579159737, + 0.006165868137031794, + 0.006654818542301655, + 0.007003858685493469, + 0.007166251074522734, + 0.007172148674726486, + 0.007023656740784645, + 0.006700810045003891, + 0.006224640645086765, + 0.005624195095151663, + 0.004919699393212795, + 0.004098205361515284, + 0.003212966024875641, + 0.002293657511472702, + 0.0013375221751630306, + 0.00038770350511185825, + -0.000546175695490092, + -0.001447486225515604, + -0.0022705683950334787, + -0.0030300018843263388, + -0.0036925808526575565, + -0.004225991200655699, + -0.004665951710194349, + -0.004966020584106445, + -0.0051406193524599075, + -0.005209493916481733, + -0.0051243361085653305, + -0.004942192230373621, + -0.004662062041461468, + -0.004271931946277618, + -0.0038309621158987284, + -0.003315791953355074, + -0.002766168210655451, + -0.0022129372227936983, + -0.0016421842155978084, + -0.0010882740607485175, + -0.0005640691961161792, + -0.0000688298387103714, + 0.00036227054079063237, + 0.0007350974483415484, + 0.0010656827362254262, + 0.0013328194618225098, + 0.0015424391021952033, + 0.0017008384456858039, + 0.0018006975296884775, + 0.0018664848757907748, + 0.0019050268456339836, + 0.0019099237397313118, + 0.001885999576188624, + 0.0018565485952422023, + 0.0018178698373958468, + 0.001761562773026526, + 0.0017041201936081052, + 0.0016486846143379807, + 0.001592142041772604, + 0.00152500974945724, + 0.0014535989612340927, + 0.0013842376647517085, + 0.0012955303536728024, + 0.0012019453570246696, + 0.0011036575306206942, + 0.0009941556490957737, + 0.0008651234093122184, + 0.000716626294888556, + 0.0005683329072780907, + 0.0004015006707049906, + 0.00021844409639015794, + 0.00004061350045958534, + -0.00015730439918115735, + -0.00036356053897179663, + -0.0005503413267433643, + -0.0007417589076794684, + -0.0009340787655673921, + -0.0011096716625615954, + -0.001270393142476678, + -0.001409811433404684, + -0.0015296423807740211, + -0.0016209796303883195, + -0.0016814206028357148, + -0.0017154155066236854, + -0.001709475414827466, + -0.0016713179647922516, + -0.0015980778262019157, + -0.001486977911554277, + -0.0013514283346012235, + -0.001183380838483572, + -0.0009950431995093822, + -0.0007867193198762834, + -0.0005593508831225336, + -0.0003307049337308854, + -0.0000936594296945259, + 0.00013677576498594135, + 0.00035018264316022396, + 0.0005619105650112033, + 0.0007484822999686003, + 0.0009001256548799574, + 0.0010371789103373885, + 0.0011477003572508693, + 0.0012175600277259946, + 0.0012583795469254255, + 0.0012719230726361275, + 0.0012526416685432196, + 0.0012124591739848256, + 0.001149954623542726, + 0.001059133093804121, + 0.0009538555168546736, + 0.0008431633468717337, + 0.000712535111233592, + 0.000577307480853051, + 0.0004496477486100048, + 0.000312136864522472, + 0.00018430876662023365, + 0.00006338558887364343, + -0.00005638658331008628, + -0.00015338511730078608, + -0.0002477032830938697, + -0.0003314810455776751, + -0.00039463440771214664, + -0.0004513421154115349, + -0.0004923142259940505, + -0.0005181693122722208, + -0.0005344091914594173, + -0.0005412126192823052, + -0.0005386915290728211, + -0.0005279628676362336, + -0.000509631703607738, + -0.0004817850422114134, + -0.0004525120311882347, + -0.0004224327567499131, + -0.00038764486089348793, + -0.00035012979060411453, + -0.00031327962642535567, + -0.0002750449348241091, + -0.0002373643801547587, + -0.00020273275731597096, + -0.00016591105668339878, + -0.0001300916774198413, + -0.00009608975960873067, + -0.00006268122524488717, + -0.00003191079667885788, + 0.0000044981629798712675, + 0.000039168488001450896, + 0.00006684673280688003, + 0.00010066030517918989, + 0.0001335376437054947, + 0.00016079902707133442, + 0.0001900819333968684, + 0.00021639710757881403, + 0.00023808384139556438, + 0.00025884335627779365, + 0.0002764824021141976, + 0.00028750693309120834, + 0.0002957492251880467, + 0.0002994622045662254, + 0.0002949846675619483, + 0.00028688323800452054, + 0.0002754826273303479, + 0.0002584447502158582, + 0.0002345455577597022, + 0.00020762185158673674, + 0.00017860395018942654, + 0.00014591931540053338, + 0.00011081412230851129, + 0.00007281907892320305, + 0.00003684169496409595, + 0.0000013135278322806698, + -0.00003526258660713211, + -0.0000678859869367443, + -0.00009907161438604817, + -0.00012897938722744584, + -0.00015269157302100211, + -0.00017189506615977734, + -0.0001888242259155959, + -0.00020062265684828162, + -0.00020623621821869165, + -0.00020827390835620463, + -0.00020804473024327308, + -0.0002013516059378162, + -0.00019068071560468525, + -0.00017818270134739578, + -0.00016053767467383295, + -0.0001421216584276408, + -0.00012168560351710767, + -0.00009898384450934827, + -0.00007798622391419485, + -0.0000549906435480807, + -0.00003252015449106693, + -0.00001172564134321874, + 0.000008831233571982011, + 0.00002685720937734004, + 0.00004291907316655852, + 0.00005735097875003703, + 0.0000758138921810314, + 0.00009733468323247507, + 0.0001418615283910185, + 0.00022478841128759086, + 0.0003642242809291929, + 0.0005755504826083779, + 0.0008659312152303755, + 0.0012296834029257298, + 0.0016464313957840204, + 0.002080549718812108, + 0.0024834044743329287, + 0.0027978355064988136, + 0.0029674156103283167, + 0.002942809835076332, + 0.0026962871197611094, + 0.002213698346167803, + 0.0015111195389181376, + 0.0006289160810410976, + -0.00037086501833982766, + -0.0014135083183646202, + -0.002417236566543579, + -0.003303554141893983, + -0.004007026553153992, + -0.004481036681681871, + -0.004700296558439732, + -0.004664285574108362, + -0.0043913740664720535, + -0.003922166768461466, + -0.0033049145713448524, + -0.0025937396567314863, + -0.0018424857407808304, + -0.0010979777434840798, + -0.00040036329301074147, + 0.00022301104036159813, + 0.0007556756027042866, + 0.0011892952024936676, + 0.0015246305847540498, + 0.0017671933164820075, + 0.0019263825379312038, + 0.002012114506214857, + 0.0020345267839729786, + 0.002004882786422968, + 0.0019321892177686095, + 0.0018244427628815174, + 0.0016898991307243705, + 0.001535235671326518, + 0.0013657311210408807, + 0.0011868266155943274, + 0.0010030688717961311, + 0.000816129962913692, + 0.0006283161928877234, + 0.00043941623880527914, + 0.0002516864624340087, + 0.00006565167132066563, + -0.00011763894144678488, + -0.000294118479359895, + -0.00045968161430209875, + -0.0006084764027036726, + -0.0007331118686124682, + -0.0008275621221400797, + -0.0008850740850903094, + -0.0009013736853376031, + -0.0008753154543228447, + -0.0008081153500825167, + -0.000704723468516022, + -0.0005731310229748487, + -0.0004233625950291753, + -0.0002677026204764843, + -0.00011795140744652599, + 0.00001551479181216564, + 0.00012362294364720583, + 0.000200030961423181, + 0.0002424274425720796, + 0.00025138596538454294, + 0.00022974108287598938, + 0.00018481886945664883, + 0.0001222056889673695, + 0.000050486054533394054, + -0.00002300324194948189, + -0.0000914562406251207, + -0.00014914273924659938, + -0.0001926620170706883, + -0.0002199616574216634, + -0.00023071510076988488, + -0.00022544297098647803, + -0.00020604743622243404, + -0.0001752915559336543, + -0.00013554884935729206, + -0.00009011552901938558, + -0.00004152444307692349, + 0.000007444885795848677, + 0.00005471400072565302, + 0.00009838065307121724, + 0.00013690197374671698, + 0.00016937432519625872, + 0.0001950852747540921, + 0.0002138623094651848, + 0.0002258625318063423, + 0.0002314710000064224, + 0.00023141448036767542, + 0.00022606320271734148, + 0.00021651799033861607, + 0.000203296251129359, + 0.00018698486383073032, + 0.00016795344708953053, + 0.00014625593030359596, + 0.0001221306447405368, + 0.00009569257235853001, + 0.00006694428157061338, + 0.00003624985401984304, + 0.000004105184416403063, + -0.00002874046731449198, + -0.00006125024810899049, + -0.00009231694275513291, + -0.0001205253429361619, + -0.00014473703049588948, + -0.0001636003580642864, + -0.0001762575702741742, + -0.00018230329442303628, + -0.00018129929958377033, + -0.00017364621453452855, + -0.00016003585187718272, + -0.00014133854710962623, + -0.0001188987007481046, + -0.00009413390944246203, + -0.00006828759069321677, + -0.00004278729829820804, + -0.000018785895008477382, + 0.000002849154952855315, + 0.000021395730072981678, + 0.00003647943594842218, + 0.000047991445171646774, + 0.000055926659115357324, + 0.00006058276630938053, + 0.00006235229375306517, + 0.00006166934326756746, + 0.000058974641433451325, + 0.000054811844165669754, + 0.000049710204621078447, + 0.00004397162047098391, + 0.00003801724233198911, + 0.0000322054693242535, + 0.000026626190447132103, + 0.000021541298337979242, + 0.000017025269698933698, + 0.000013027336535742506, + 0.00000965723393164808, + 0.0000068065442064835224, + 0.000004420210643729661, + 0.0000024100797872961266, + 7.856652359805594e-7, + -5.178564492780424e-7, + -0.000001557097448312561, + -0.0000023435495677404106, + -0.0000028316094358160626, + -0.000003066635144932661, + -0.000003080599753957358, + -0.0000028362690045469208, + -0.0000023863899514253717, + -0.0000018075656953442376, + -0.0000011654555009954493, + -5.522441597349825e-7, + -6.313563716275894e-8, + 2.0919672749641904e-7, + 1.9164949094374606e-7, + -1.7541485419769742e-7, + -9.114615977523499e-7, + -0.000001986766164918663, + -0.0000033638639251876157, + -0.000004959982561558718, + -0.000006671358733001398, + -0.000008369482202397194, + -0.000009930137821356766, + -0.000011260765859333333, + -0.000012229401363583747, + -0.000012797574527212419, + -0.000012904557479487266, + -0.000012535643691080622, + -0.000011723206625902094, + -0.000010502219993213657, + -0.000008931274351198226, + -0.000007088889105943963, + -0.00000507995673615369, + -0.00000298760323858005, + -8.898940109247633e-7, + 0.0000011100881920356187, + 0.0000029580064619949553, + 0.000004595041900756769, + 0.000005965905074845068, + 0.00000706643413650454, + 0.000007862980055506341, + 0.000008363772394659463, + 0.000008590125617047306, + 0.00000854965765029192, + 0.000008282238923129626, + 0.000007822071893315297, + 0.0000071994572863332, + 0.0000064584419305901974, + 0.000005622226581181167, + 0.00000473496038466692, + 0.000003824064151558559, + 0.0000029042400910839206, + 0.0000020098277673241682, + 0.0000011520832003952819, + 3.3805471844061685e-7, + -4.0424322378385114e-7, + -0.0000010729744417403708, + -0.0000016606624058113084, + -0.00000215424302041356, + -0.000002550332510509179, + -0.0000028443816972867353, + -0.0000030307614906632807, + -0.0000031141844374360517, + -0.000003102054506598506, + -0.0000029955288027849747, + -0.0000028112385734857526, + -0.0000025615784124966012, + -0.000002258425638501649, + -0.000001926337517943466, + -0.000001577806074237742, + -0.0000012264049473742489, + -8.948696290644875e-7, + -5.920300054640393e-7, + -3.21149514093122e-7, + -9.81741052896723e-8, + 7.946199076513949e-8, + 2.1088089852128178e-7, + 2.9937149292891263e-7, + 3.5243982665633666e-7, + 3.705268625253666e-7, + 3.6442619943954924e-7, + 3.4485427136132785e-7, + 3.129154038106208e-7, + 2.77085973721114e-7, + 2.4413390065092244e-7, + 2.152671925159666e-7, + 1.9599390554958518e-7, + 1.8576993454644253e-7, + 1.8467677875833033e-7, + 1.937235794002845e-7, + 2.0900162667203404e-7, + 2.3041825158998108e-7, + 2.542506365443842e-7, + 2.7756755116570275e-7, + 3.0001663731127337e-7, + 3.175524909693195e-7, + 3.2954159223663737e-7, + 3.3565328294571373e-7, + 3.3273121857746446e-7, + 3.2332383170796675e-7, + 3.068570038067264e-7, + 2.829502818713081e-7, + 2.540821810725902e-7, + 2.2044380898478266e-7, + 1.8309107474578923e-7, + 1.4332968589769735e-7, + 1.0160270136339022e-7, + 6.00739866740696e-8, + 1.8996635375856386e-8, + -2.1003879524528202e-8, + -5.794823465521404e-8, + -9.196440231562519e-8, + -1.2213939726279932e-7, + -1.4741102916104865e-7, + -1.6769583055520343e-7, + -1.821600790208322e-7, + -1.9074627743975725e-7, + -1.933969571155103e-7, + -1.9017598162918148e-7, + -1.8160110926146444e-7, + -1.6784419187843014e-7, + -1.5007654496912437e-7, + -1.2909123370263842e-7, + -1.058635490380766e-7, + -8.155681996413477e-8, + -5.720228557493101e-8, + -3.3670492172177546e-8, + -1.2025829221329332e-8, + 7.01391167368115e-9, + 2.3049899766647286e-8, + 3.560823103043731e-8, + 4.4564615109266015e-8, + 4.9964317128115e-8, + 5.1953257695913635e-8, + 5.093517785326185e-8, + 4.735041869707857e-8, + 4.171984713252641e-8, + 3.457408226381631e-8 +] + + +const lpc = praatBurgMethod(new Float32Array(data), 10) +const roots = findRoots(lpc) +console.log(lpc, roots) \ No newline at end of file