+
\ No newline at end of file
diff --git a/src/app/src/main/com/fitbot/audio/AudioAnalyser.java b/src/app/src/main/com/fitbot/audio/AudioAnalyser.java
new file mode 100644
index 0000000..3d64c3f
--- /dev/null
+++ b/src/app/src/main/com/fitbot/audio/AudioAnalyser.java
@@ -0,0 +1,10 @@
+package com.fitbot.audio;
+
+import android.app.Activity;
+import android.media.MediaRecorder;
+
+public class AudioAnalyser extends Activity {
+
+
+
+}
diff --git a/src/app/src/main/com/fitbot/audio/AudioRecorder.java b/src/app/src/main/com/fitbot/audio/AudioRecorder.java
index 407870e..e2f84c3 100644
--- a/src/app/src/main/com/fitbot/audio/AudioRecorder.java
+++ b/src/app/src/main/com/fitbot/audio/AudioRecorder.java
@@ -1,13 +1,8 @@
package com.fitbot.audio;
-import android.app.Activity;
import android.media.MediaRecorder;
-import java.io.FileInputStream;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Future;
-
-public class AudioRecorder extends Activity {
+public class AudioRecorder {
private MediaRecorder recorder;
@@ -23,13 +18,9 @@ public class AudioRecorder extends Activity {
recorder = new MediaRecorder();
- File file = new File()
-
- FileInputStream stream = new FileInputStream();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- recorder.setOutputFile(stream.getFD());
// Attempt to prepare and start the audio recorder
try {
@@ -40,8 +31,6 @@ public class AudioRecorder extends Activity {
e.printStackTrace();
}
- recorder.set
-
return this;
}
@@ -54,4 +43,5 @@ public class AudioRecorder extends Activity {
recorder = null;
}
+
}
diff --git a/src/app/src/main/com/fitbot/speech/ISpeechCallback.java b/src/app/src/main/com/fitbot/speech/ISpeechCallback.java
new file mode 100644
index 0000000..48ccdf9
--- /dev/null
+++ b/src/app/src/main/com/fitbot/speech/ISpeechCallback.java
@@ -0,0 +1,8 @@
+package com.fitbot.speech;
+
+/**
+ * Interface for a callback that is called when speech is generated
+ */
+public interface ISpeechCallback {
+ void onSpeechGenerated(String speech);
+}
diff --git a/src/app/src/main/com/fitbot/speech/SpeechGenerator.java b/src/app/src/main/com/fitbot/speech/SpeechGenerator.java
new file mode 100644
index 0000000..5990244
--- /dev/null
+++ b/src/app/src/main/com/fitbot/speech/SpeechGenerator.java
@@ -0,0 +1,89 @@
+package com.fitbot.speech;
+
+import java.util.Arrays;
+import java.util.Locale;
+
+public class SpeechGenerator {
+
+ private ISpeechCallback speechCallback = (content) -> {}; // Default empty callback
+ private StringBuilder speechBuffer = new StringBuilder(); // Buffer to store the speech content
+ private String languageIso639_1; // ISO 639-1 language code
+
+ /**
+ * Constructor that sets the language of the speech to be generated
+ * @param languageIso639_1 The ISO 639-1 language code, e.g. "en" for English
+ */
+ public SpeechGenerator(String languageIso639_1)
+ {
+ if ( !Arrays.asList(Locale.getISOLanguages()).contains(languageIso639_1) )
+ throw new IllegalArgumentException("Invalid language code");
+ this.languageIso639_1 = languageIso639_1;
+ }
+
+ /**
+ * Default constructor, sets the language to English
+ */
+ public SpeechGenerator()
+ {
+ this("en");
+ }
+
+
+ /**
+ * Set the language of the speech to be generated
+ * @param languageIso639_1 The ISO 639-1 language code, e.g. "en" for English
+ * @return An instance of the SpeechGenerator class
+ */
+ public SpeechGenerator language(String languageIso639_1)
+ {
+ this.languageIso639_1 = languageIso639_1;
+ return this;
+ }
+
+ /**
+ * Appends the provided text to the speech buffer
+ * @param text The text to append
+ * @return An instance of the SpeechGenerator class
+ */
+ public SpeechGenerator print(String text)
+ {
+ speechBuffer.append(text);
+ return this;
+ }
+
+ /**
+ * Appends the provided text to the speech buffer, followed by a newline character
+ * @param text The text to append
+ * @return An instance of the SpeechGenerator class
+ */
+ public SpeechGenerator println(String text)
+ {
+ return print(text).print("\n");
+ }
+
+ /**
+ * Get the contents of the speech buffer
+ */
+ public String getBuffer()
+ {
+ return speechBuffer.toString();
+ }
+
+ /**
+ * Clear the contents of the speech buffer
+ */
+ public void clearBuffer()
+ {
+ speechBuffer = new StringBuilder();
+ }
+
+ /**
+ * Print the contents of the speech buffer to the console
+ */
+ public void speak()
+ {
+ speechCallback.onSpeechGenerated(speechBuffer.toString());
+ }
+
+
+}