You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.out.println("Argument usage (all fields are optional):\n"
75
82
+ "input=<file or dir> output=<songs dir> duration=<seconds to process> synctime=<offset start time in seconds> tap=<true/false> hard=<true/false>");
@@ -220,33 +227,37 @@ public void AddCommonBPMs(TFloatArrayList common, TFloatArrayList times, float d
220
227
221
228
publicstaticfloattappedOffset;
222
229
publicintgetTappedBPM(Stringfilename) {
223
-
AudioPlayerap = minim.loadFile(filename, 2048);
230
+
// now we load the whole song so we don't have to worry about streaming a variable mp3 with timing inaccuracies
231
+
System.out.println("Loading whole song for tapping...");
232
+
AudioSamplefullSong = minim.loadSample(filename);
224
233
System.out.println("\n********************************************************************\n\nPress [ENTER] to start song, then press [ENTER] to tap to the beat.\nIt will complete after 30 entries.\nDon't worry about hitting the first beat, just start anytime.\n\n********************************************************************");
225
234
TFloatArrayListpositions = newTFloatArrayList();
226
235
Scannerin = newScanner(System.in);
227
236
try {
228
237
in.nextLine();
229
-
} catch(Exceptione) { }
230
-
longmilli = System.nanoTime();
231
-
ap.play();
232
-
milli = (System.nanoTime() + milli) / 2;
238
+
} catch(Exceptione) { }
239
+
// get the most accurate start time as possible
240
+
longnano = System.nanoTime();
241
+
fullSong.trigger();
242
+
nano = (System.nanoTime() + nano) / 2;
233
243
try {
234
244
for(inti=0;i<30;i++) {
235
-
while(System.in.available()==0) { }
245
+
in.nextLine();
246
+
// get two playtime values & average them together for accuracy
0 commit comments