package com.github.davidmoten.ar;

import rx.Observable;
import rx.functions.Action1;
import rx.functions.Func1;

import com.fastdtw.timeseries.TimeSeries;

public class MicrophoneMain {
	public static void main(String[] args) {
		Audio.microphone()
				.window(100)
				.flatMap(
						new Func1<Observable<Integer>, Observable<TimeSeries>>() {

							@Override
							public Observable<TimeSeries> call(
									Observable<Integer> buffer) {
								return Audio.timeSeries(buffer, 256, 156, 20,
										13);
							}
						})
				// for each
				.forEach(new Action1<TimeSeries>() {

					@Override
					public void call(TimeSeries t) {
						System.out.println(t.size());
					}
				});
	}
}

@@ -28,16 +28,40 @@
 en.ar;%0A%0A
+import java.util.List;%0A%0A
 import r
@@ -270,20 +270,15 @@
 ne()
-%0A%09%09%09%09.window
+.buffer
 (100
@@ -292,23 +292,16 @@
 flatMap(
-%0A%09%09%09%09%09%09
 new Func
@@ -302,26 +302,20 @@
 w Func1%3C
-Observable
+List
 %3CInteger
@@ -351,18 +351,16 @@
 %7B%0A%0A%09%09%09%09%09
-%09%09
 @Overrid
@@ -361,18 +361,16 @@
 verride%0A
-%09%09
 %09%09%09%09%09pub
@@ -405,28 +405,12 @@
 all(
-%0A%09%09%09%09%09%09%09%09%09Observable
+List
 %3CInt
@@ -421,26 +421,24 @@
 %3E buffer) %7B%0A
-%09%09
 %09%09%09%09%09%09return
@@ -459,40 +459,55 @@
 ies(
+Observable.from(
 buffer
+)
 , 256,
- 156, 20,%0A%09%09%09%09%09%09%09%09%09%09
+%0A%09%09%09%09%09%09%09%09156, 20, 
 13);
@@ -512,22 +512,18 @@
 );%0A%09%09%09%09%09
-%09%09%7D%0A%09%09
+%7D%0A
 %09%09%09%09%7D)%0A%09

add microphone main