/** * Get a single datagram from a particular time location, given in the timeline's sampling rate. * * @param targetTimeInSamples * the requested position, in samples. Must be non-negative and less than the total duration of the timeline. * * @return the datagram starting at or overlapping the given time, or null if end-of-file was encountered * @throws IOException * , BufferUnderflowException if no datagram could be created from the data at the given time. */ public Datagram getDatagram(long targetTimeInSamples) throws IOException { Pair<ByteBuffer, Long> p = getByteBufferAtTime(targetTimeInSamples); ByteBuffer bb = p.getFirst(); return getNextDatagram(bb); }
/** * Get a single datagram from a particular time location, given in the timeline's sampling rate. * * @param targetTimeInSamples * the requested position, in samples. Must be non-negative and less than the total duration of the timeline. * * @return the datagram starting at or overlapping the given time, or null if end-of-file was encountered * @throws IOException * , BufferUnderflowException if no datagram could be created from the data at the given time. */ public Datagram getDatagram(long targetTimeInSamples) throws IOException { Pair<ByteBuffer, Long> p = getByteBufferAtTime(targetTimeInSamples); ByteBuffer bb = p.getFirst(); return getNextDatagram(bb); }
double avgEnergySession = computeAverageEnergy(wavFiles, session.getFirst(), session.getSecond(), stepsComplete * stepProgress + session.getFirst() * stepProgress / wavFiles.length, stepsComplete wavFiles[session.getFirst()].lastModified(), session.getSecond() - session.getFirst(), avgEnergySession); sessionEnergies.add(avgEnergySession); for (int i = session.getFirst(); i < session.getSecond(); i++) { amplitudeFactors[i] = factor;
double avgEnergySession = computeAverageEnergy(wavFiles, session.getFirst(), session.getSecond(), stepsComplete * stepProgress + session.getFirst() * stepProgress / wavFiles.length, stepsComplete wavFiles[session.getFirst()].lastModified(), session.getSecond() - session.getFirst(), avgEnergySession); sessionEnergies.add(avgEnergySession); for (int i = session.getFirst(); i < session.getSecond(); i++) { amplitudeFactors[i] = factor;
logger.debug("Startup times:"); for (Pair<MaryModule, Long> p : startupTimes) { logger.debug(p.getFirst().name() + ": " + p.getSecond() + " ms");
logger.debug("Startup times:"); for (Pair<MaryModule, Long> p : startupTimes) { logger.debug(p.getFirst().name() + ": " + p.getSecond() + " ms");
String parsedfullText = returnedPair.getFirst(); ArrayList<Integer> pairIntList = returnedPair.getSecond();
private List<Polynomial> fitPolynomialsToSyllables(Sentence s, double[] logF0, int polynomOrder) { List<Polynomial> poly = new ArrayList<Polynomial>(); for (Syllable syl : s) { Pair<Integer, Integer> syllableIndices = getSyllableIndicesInSentenceArray(s, syl, logF0.length); // System.out.println(" -- from "+iSylStart+" to "+iSylEnd + " out of " + logF0.length); double[] sylLogF0 = new double[syllableIndices.getSecond() - syllableIndices.getFirst()]; System.arraycopy(logF0, syllableIndices.getFirst(), sylLogF0, 0, sylLogF0.length); // Now that we have the log F0 curve corresponding to the syllable, fit polynomial: double[] coeffs = Polynomial.fitPolynomial(sylLogF0, polynomOrder); if (coeffs != null) { poly.add(new Polynomial(coeffs)); } else { poly.add(null); } } return poly; }
/** * Get a single datagram from a particular time location, given in the timeline's sampling rate. * * @param targetTimeInSamples * the requested position, in samples. Must be non-negative and less than the total duration of the timeline. * * @return the datagram starting at or overlapping the given time, or null if end-of-file was encountered * @throws IOException * , BufferUnderflowException if no datagram could be created from the data at the given time. */ public Datagram getDatagram(long targetTimeInSamples) throws IOException { Pair<ByteBuffer, Long> p = getByteBufferAtTime(targetTimeInSamples); ByteBuffer bb = p.getFirst(); return getNextDatagram(bb); }
private double[] fillApproxFromPolynomials(Sentence s, List<Polynomial> polynomials, int len) { double[] approx = new double[len]; Arrays.fill(approx, Double.NaN); Iterator<Polynomial> polyIt = polynomials.iterator(); for (Syllable syl : s) { Polynomial poly = polyIt.next(); if (poly == null) { continue; } System.out.print(" (" + syl.getFirstUnitIndex() + "-" + syl.getSyllableNucleusIndex() + "-" + syl.getLastUnitIndex() + ")"); Pair<Integer, Integer> syllableIndices = getSyllableIndicesInSentenceArray(s, syl, len); double[] sylPred = poly.generatePolynomialValues(syllableIndices.getSecond() - syllableIndices.getFirst(), 0, 1); System.arraycopy(sylPred, 0, approx, syllableIndices.getFirst(), sylPred.length); } System.out.println(); return approx; }
int[] sentenceIDs = pair.getFirst(); byte[][] vectorArray = pair.getSecond(); cfp = new InMemoryCFProvider(vectorArray, sentenceIDs);
logger.debug("Startup times:"); for (Pair<MaryModule, Long> p : startupTimes) { logger.debug(p.getFirst().name() + ": " + p.getSecond() + " ms");