@@ -0,0 +1,72 @@
0.0, 0.2813196240585917
5.0, 0.2738946376435743
10.0, 0.28125791421247615
15.0, 0.2808237672733707
20.0, 0.28747471083713516
25.0, 0.2807225152846918
30.0, 0.27218609090320073
35.0, 0.2907101634266232
40.0, 0.28514005320181784
45.0, 0.28070633767713987
50.0, 0.28323365039734266
55.0, 0.2811357010610313
60.0, 0.28632290744754113
65.0, 0.28659455590703886
70.0, 0.28610032756533865
75.0, 0.2867264074437241
80.0, 0.28600894854622266
85.0, 0.2803113862015682
90.0, 0.2799663520717029
95.0, 0.29220628864848897
100.0, 0.2882496018818051
105.0, 0.2860615192114068
110.0, 0.28606048033259435
115.0, 0.29298332519507
120.0, 0.2824629741813457
125.0, 0.29497290100105483
130.0, 0.29257000898389673
135.0, 0.2918182188825708
140.0, 0.28525260068565583
145.0, 0.2864817051708524
150.0, 0.2895168130495473
155.0, 0.2926057951152674
160.0, 0.29306403530356345
165.0, 0.2931235432180284
170.0, 0.2900472126428058
175.0, 0.2931704585384919
180.0, 0.287092146824554
185.0, 0.2920736720527665
190.0, 0.29653354503430274
195.0, 0.29518584633125594
200.0, 0.28842321246308483
205.0, 0.2930148266548713
210.0, 0.2950484319738234
215.0, 0.2952621473734639
220.0, 0.2951168951634142
225.0, 0.2882340967835221
230.0, 0.29960195280313157
235.0, 0.288925409710992
240.0, 0.29508459799706016
245.0, 0.294991293217605
250.0, 0.2938368201260288
255.0, 0.2854190644042347
260.0, 0.2876938896857672
265.0, 0.29427595789972555
270.0, 0.2940867214177262
275.0, 0.2937353333659752
280.0, 0.2935749607180174
285.0, 0.285062757754245
290.0, 0.28491244010743205
295.0, 0.28469276838486146
300.0, 0.2927486439926944
305.0, 0.29502936632517235
310.0, 0.2896289653716747
315.0, 0.292120982630312
320.0, 0.29155918985438145
325.0, 0.28329892702007947
330.0, 0.2887222535884746
335.0, 0.289743423314196
340.0, 0.29330990216486713
345.0, 0.28870750218080665
350.0, 0.29095180290214584
355.0, 0.28547792926827226
@@ -0,0 +1,72 @@
0.0, 0.2826996792349919
5.0, 0.2919047041739259
10.0, 0.2905826158304629
15.0, 0.2874237601537633
20.0, 0.2854470399589077
25.0, 0.2822181175674736
30.0, 0.2818393650624203
35.0, 0.2891606885357304
40.0, 0.2823143454797045
45.0, 0.29004182810746715
50.0, 0.29005144408712913
55.0, 0.2885382841985395
60.0, 0.29103914650537716
65.0, 0.2818379909665273
70.0, 0.289411425907419
75.0, 0.28160308720155985
80.0, 0.28605283267930987
85.0, 0.2898059581773502
90.0, 0.28966099737668854
95.0, 0.2896162252397417
100.0, 0.2862036255989309
105.0, 0.2827400705486231
110.0, 0.2892830680236387
115.0, 0.28219250872321633
120.0, 0.29107996474688824
125.0, 0.2914992241622744
130.0, 0.2939106889595967
135.0, 0.28779563254697677
140.0, 0.2852111794386625
145.0, 0.2904224585605355
150.0, 0.2883757909380484
155.0, 0.29395324479575236
160.0, 0.29515664525709134
165.0, 0.2941789501018216
170.0, 0.2897745679087741
175.0, 0.2875791177098947
180.0, 0.2961777437199723
185.0, 0.2965484469151728
190.0, 0.2967992854854016
195.0, 0.29705308848375706
200.0, 0.2909105313865949
205.0, 0.29498384299245245
210.0, 0.2955174831851536
215.0, 0.2939267525042214
220.0, 0.2997370165465509
225.0, 0.2997057075229026
230.0, 0.29124426709799983
235.0, 0.2938883103088215
240.0, 0.29338535416730627
245.0, 0.28979212393567316
250.0, 0.2939417010105914
255.0, 0.2940024435153299
260.0, 0.2978349175936726
265.0, 0.2978791718166731
270.0, 0.2984694127708987
275.0, 0.29872343061744505
280.0, 0.29836051891427456
285.0, 0.2906689621672281
290.0, 0.29421170319139195
295.0, 0.2899272820215527
300.0, 0.2931247795037696
305.0, 0.29690828583890444
310.0, 0.30118993050626147
315.0, 0.32086448075723245
320.0, 0.2906511220638702
325.0, 0.29156367252537785
330.0, 0.2897200216681524
335.0, 0.2945034275571159
340.0, 0.29488143453102017
345.0, 0.2885615974095596
350.0, 0.30984650639363015
355.0, 0.2873636199021433
@@ -1,11 +1,100 @@
2,3,0.17191844414965998
3,4,0.19386090539952558
3,6,0.24162609186479472
3,7,0.05621067049770454
4,1,0.20624452238838667
4,2,0.0984372537023129
4,5,0.031637284815968274
4,6,0.06889710028256466
4,7,0.06509028992146852
5,4,0.2173638404473929
9,9,0.16296214238352127
0,0,0.5108871553083699
0,1,0.5083778735177807
0,2,0.08949751170344114
0,3,0.11970939089599826
0,4,0.08409662247758265
0,5,0.09243365973508129
0,6,0.014321939523696953
0,7,0.01423946027925646
0,8,0.01430239912162905
0,9,0.014333134676781637
1,0,0.11824467429519755
1,1,0.09623261918407444
1,2,0.08430972445365842
1,3,0.08074445140396619
1,4,0.009194147338796185
1,5,0.0032604598385064763
1,6,0.144037396533297
1,7,0.09009938920570616
1,8,0.07263265465290406
1,9,0.07083786987633035
2,0,0.06766073502643219
2,1,0.07133791899890486
2,2,0.07686927542946746
2,3,0.08328527236544898
2,4,0.009093729678115293
2,5,0.009067117214905102
2,6,0.0742815780242487
2,7,0.07402162843900709
2,8,0.07408985581124221
2,9,0.08774933347902657
3,0,0.0670234781651785
3,1,0.06947082980659272
3,2,0.042626198131208014
3,3,0.024511755404607156
3,4,0.09923138931219834
3,5,0.07718186985547235
3,6,0.0698122541896223
3,7,0.11253948807934723
3,8,0.0815278059491629
3,9,0.11076981936711136
4,0,0.009279317739920268
4,1,0.008904000049272538
4,2,0.0111690728565864
4,3,0.3794558687177814
4,4,0.37237699466314084
4,5,0.0752410218316796
4,6,6.961818714932545E-6
4,7,0.08274854632820326
4,8,0.09358350760371852
4,9,0.10542496955243728
5,0,0.05915140412478655
5,1,0.004798133774586431
5,2,0.004204619593468884
5,3,0.004163800484140082
5,4,0.004005442700296732
5,5,0.3579374064217296
5,6,0.0038557979897043833
5,7,0.004013350083219919
5,8,0.004121021005977945
5,9,0.13831189644486927
6,0,0.044422233751442296
6,1,0.16222589482381417
6,2,0.14152884722317247
6,3,0.04392004279696129
6,4,0.16894073852164068
6,5,0.02669371375748879
6,6,0.005158321119750562
6,7,0.004102977155569154
6,8,0.004030661205998652
6,9,0.14754286437688147
7,0,0.11530303253640403
7,1,0.16514910437171818
7,2,0.17338193596276028
7,3,0.19560370375215255
7,4,0.12053040685049617
7,5,0.0720952243930557
7,6,0.017247566771695647
7,7,0.10975413776664894
7,8,0.09228877540986989
7,9,0.0731810535833844
8,0,0.009916635565698748
8,1,6.961818714932545E-6
8,2,0.13850346641134498
8,3,0.12311421389545149
8,4,0.11308256530148937
8,5,0.04100045141097816
8,6,0.12166935970022366
8,7,0.054464139378846164
8,8,0.03994105429479066
8,9,0.07614585872939213
9,0,0.022105599401086716
9,1,0.020886112419630825
9,2,0.03629662524107817
9,3,0.04534830788705854
9,4,0.1580026971165359
9,5,0.07711747764589313
9,6,0.06430735405422952
9,7,0.011825967403878672
9,8,0.06556242487297885
9,9,0.05969603149345039
@@ -23,7 +23,7 @@ public class GuiWithoutActor {
final double visualMultiplyer;

public static void main(String[] args) throws LineUnavailableException, IOException {
new GuiWithoutActor(10, 10, 1000, 1000, 44100, "measurement.csv", 3);
new GuiWithoutActor(10, 10, 1000, 1000, 48000, "measurement.csv", 3);
}

public GuiWithoutActor(int width, int height, int measureTime, int measureFreq, int sampleRate, String fileName, int visualMultiplyer)
@@ -32,7 +32,7 @@ public GuiWithoutActor(int width, int height, int measureTime, int measureFreq,

Map<ComparablePoint, Double> map = new TreeMap<>();
@SuppressWarnings("resource")
Measurer m = new Measurer(sampleRate);
Measurer m = new Measurer(48000);
MapWriter writer = new MapWriter(map);

if(new File(fileName).exists()) {
@@ -0,0 +1,30 @@
package de.sfn_kassel.sound_locate.audio;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;

@Deprecated
public class Latency {
private final AudioFormat af;
private final int sampleRate;

private final SourceDataLine out;
private final TargetDataLine in;

public Latency(int sampleRate) throws LineUnavailableException {
this.sampleRate = sampleRate;
af = new AudioFormat(sampleRate, 16, 1, true, true);

out = AudioSystem.getSourceDataLine(af);
in = AudioSystem.getTargetDataLine(af);


}

public static void main(String[] args) throws LineUnavailableException {
new Latency(44100);
}
}
@@ -27,14 +27,6 @@ public static void main(String[] args) throws LineUnavailableException, IOExcept
motor.moveTo(0, 50);
motor.close();
}

public void moveTo(double pos, double speed) throws LineUnavailableException {
if (pos == position) {
return;
}

doSteps(pos - position, speed, position);
}

public StepperMotor(int sampleRate) throws LineUnavailableException {
af = new AudioFormat(sampleRate, 16, 2, true, true);
@@ -43,13 +35,21 @@ public StepperMotor(int sampleRate) throws LineUnavailableException {
this.sampleRate = sampleRate;
}

public void moveTo(double pos, double speed) throws LineUnavailableException {
if (pos == position) {
return;
}

doSteps(pos - position, speed, position);
}

private void startplay(byte[] toneBuffer) throws LineUnavailableException {
clip.open(af, toneBuffer, 0, toneBuffer.length);
clip.addLineListener(new LineListener() {

@Override
public void update(LineEvent event) {
// System.out.println(event);
// System.out.println(event);
if (event.getType() == LineEvent.Type.STOP) {
runnig = false;
}
@@ -60,7 +60,8 @@ public void update(LineEvent event) {
}

public void doSteps(double steps, double speed, double start) throws LineUnavailableException {
byte[] toneBuffer = createSinWaveBuffer(speed, Math.abs(steps), start,steps < 0 ? .5 * Math.PI : -.5 * Math.PI);
byte[] toneBuffer = createSinWaveBuffer(speed, Math.abs(steps), start,
steps < 0 ? .5 * Math.PI : -.5 * Math.PI);
startplay(toneBuffer);
waitToFinsh();
position += steps;
@@ -83,7 +84,7 @@ private byte[] createSinWaveBuffer(double freq, double steps, double start, doub
int samples = (int) Math.ceil((steps / freq) * 2 * sampleRate);
double[] output = new double[samples];
for (int i = 0; i < output.length; i += 2) {
double time = ((double)i / sampleRate) / 2;
double time = ((double) i / sampleRate) / 2;
double angle = 2 * Math.PI * time * freq;
output[i] = Math.sin(angle + start);
output[i + 1] = Math.sin(angle + relativeAngle + start);
@@ -0,0 +1,4 @@
0,0,0.10205192271109402
0,1,0.07546039812793082
0,2,0.14002041688914132
0,3,0.10601346756680596
@@ -0,0 +1,7 @@
set yrange[0:]

plot "goodMicMeasurement1.csv" w lp
replot "goodMicMeasurement2.csv" w lp
replot "goodMicMeasurement3.csv" w lp

pause -1