@Override public boolean hasNext() { if (next != null) return true; next = nextSampleChunk(); return next != null; }
@Override public boolean hasNext() { if (next != null) return true; next = nextSampleChunk(); return next != null; }
@Override public SampleChunk next() { if (next == null) next = nextSampleChunk(); final SampleChunk ret = next; next = null; if (ret == null) throw new NoSuchElementException(); return ret; }
@Override public SampleChunk next() { if (next == null) next = nextSampleChunk(); final SampleChunk ret = next; next = null; if (ret == null) throw new NoSuchElementException(); return ret; }
/** * {@inheritDoc} * * @see org.openimaj.audio.AudioStream#nextSampleChunk() */ @Override public SampleChunk nextSampleChunk() { try { final SampleChunk s = this.stream.nextSampleChunk(); return (s != null ? this.process(s) : null); } catch (final Exception e) { e.printStackTrace(); return null; } }
/** * {@inheritDoc} * * @see org.openimaj.audio.AudioStream#nextSampleChunk() */ @Override public SampleChunk nextSampleChunk() { try { final SampleChunk s = this.stream.nextSampleChunk(); return (s != null ? this.process(s) : null); } catch (final Exception e) { e.printStackTrace(); return null; } }
SampleChunk sc = stream.nextSampleChunk(); return stream.nextSampleChunk();
SampleChunk sc = stream.nextSampleChunk(); return stream.nextSampleChunk();
final SampleChunk sc = this.stream.nextSampleChunk();
final SampleChunk sc = this.stream.nextSampleChunk();
/** * Train the annotator on the given streams. The streams are annotated with * the appropriate annotation, and sample chunks (and therefore buffers) are * gathered from the streams into batches to train the annotator. * * @param streams * The annotated streams */ public void train(final List<IndependentPair<AudioStream, ANNOTATION>> streams) { // Convert all the incoming streams into AnnotatedObject instances // where the sample buffer for each final List<Annotated<SampleBuffer, ANNOTATION>> list = new ArrayList<Annotated<SampleBuffer, ANNOTATION>>(); for (final IndependentPair<AudioStream, ANNOTATION> stream : streams) { SampleChunk sc = null; while ((sc = stream.firstObject().nextSampleChunk()) != null) { final SampleBuffer sb = sc.getSampleBuffer(); final AnnotatedObject<SampleBuffer, ANNOTATION> a = AnnotatedObject.create(sb, stream.secondObject()); list.add(a); } } // Train the annotator for the streams this.annotator.train(list); }
sc = this.streams.get(stream).nextSampleChunk();
/** * Train the annotator on the given streams. The streams are annotated with * the appropriate annotation, and sample chunks (and therefore buffers) are * gathered from the streams into batches to train the annotator. * * @param streams * The annotated streams */ public void train(final List<IndependentPair<AudioStream, ANNOTATION>> streams) { // Convert all the incoming streams into AnnotatedObject instances // where the sample buffer for each final List<Annotated<SampleBuffer, ANNOTATION>> list = new ArrayList<Annotated<SampleBuffer, ANNOTATION>>(); for (final IndependentPair<AudioStream, ANNOTATION> stream : streams) { SampleChunk sc = null; while ((sc = stream.firstObject().nextSampleChunk()) != null) { final SampleBuffer sb = sc.getSampleBuffer(); final AnnotatedObject<SampleBuffer, ANNOTATION> a = AnnotatedObject.create(sb, stream.secondObject()); list.add(a); } } // Train the annotator for the streams this.annotator.train(list); }
toUse.nextSampleChunk(); toUse.nextSampleChunk(); toUse.nextSampleChunk(); final SampleChunk sc = toUse.nextSampleChunk(); final double[] d = sc.getSampleBuffer().asDoubleArray();
toUse.nextSampleChunk(); toUse.nextSampleChunk(); toUse.nextSampleChunk(); final SampleChunk sc = toUse.nextSampleChunk(); final double[] d = sc.getSampleBuffer().asDoubleArray();
final String label = asl.secondObject(); SampleChunk s = as.nextSampleChunk(); SampleBuffer b = s.getSampleBuffer(); s = as.nextSampleChunk(); if( s == null ) break;
final SampleChunk sc = audioStream.nextSampleChunk();
final SampleChunk sc = audioStream.nextSampleChunk();
/** * * @param as * @throws Exception */ public PowerCepstrumVis( AudioStream as ) throws Exception { FImage img = new FImage( 1000, 600 ); PowerCepstrumTransform pct = new PowerCepstrumTransform(); SampleChunk sc = null; while( (sc = as.nextSampleChunk()) != null ) { pct.process( sc ); float[][] c = pct.getLastCepstrum(); for( int i = 0; i < c[0].length; i++ ) img.setPixel( img.getWidth()-1, i, c[0][i]/50f ); img.shiftLeftInplace(); DisplayUtilities.displayName( img, "Power Cepstrum" ); } }
/** * * @param as * @throws Exception */ public PowerCepstrumVis( AudioStream as ) throws Exception { FImage img = new FImage( 1000, 600 ); PowerCepstrumTransform pct = new PowerCepstrumTransform(); SampleChunk sc = null; while( (sc = as.nextSampleChunk()) != null ) { pct.process( sc ); float[][] c = pct.getLastCepstrum(); for( int i = 0; i < c[0].length; i++ ) img.setPixel( img.getWidth()-1, i, c[0][i]/50f ); img.shiftLeftInplace(); DisplayUtilities.displayName( img, "Power Cepstrum" ); } }