Added speech example
This commit is contained in:
108
.idea/workspace.xml
generated
108
.idea/workspace.xml
generated
@@ -14,15 +14,19 @@
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Added audio recorder files and speech callbacks">
|
||||
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Moved files to appropriate directory.">
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/build.gradle" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/proguard-rules.pro" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/src/androidTest/java/com/fitbot/ExampleInstrumentedTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/src/main/AndroidManifest.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/fitbot/src/test/java/com/fitbot/ExampleUnitTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/local.properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/fitbot/MainActivity.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/fitbot/TextSetter.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/src/main/com/fitbot/MainActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/MainActivity.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/src/main/com/fitbot/audio/AudioAnalyser.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/audio/AudioAnalyser.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/src/main/com/fitbot/audio/AudioRecorder.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/audio/AudioRecorder.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/src/main/com/fitbot/speech/ISpeechCallback.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/speech/ISpeechCallback.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/src/main/com/fitbot/speech/SpeechGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/speech/SpeechGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/code/src/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/build.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/code/src/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/AndroidManifest.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/speech/SpeechGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot/speech/SpeechGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/app/res/activity_main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/fitbot/consumer-rules.pro" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -32,6 +36,12 @@
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[/Users/lucawarm/.android/avd/Pixel_3a_API_34_extension_level_7_arm64-v8a.avd]" />
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="ExternalProjectsManager">
|
||||
<system id="GRADLE">
|
||||
<state>
|
||||
@@ -80,10 +90,76 @@
|
||||
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
|
||||
<property name="cidr.known.project.marker" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="project.structure.last.edited" value="SDKs" />
|
||||
<property name="memory.settings.postsync.last.time.stamp" value="1713530910930" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.1322751" />
|
||||
<property name="project.structure.side.proportion" value="0.3937198" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
|
||||
<property name="settings.editor.selected.configurable" value="emulator" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Fitbot" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="false" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
|
||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
@@ -110,7 +186,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713529491491</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="3" />
|
||||
<task id="LOCAL-00003" summary="Moved files to appropriate directory.">
|
||||
<created>1713530847982</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713530847982</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -131,6 +214,7 @@
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Changes" />
|
||||
<MESSAGE value="Added audio recorder files and speech callbacks" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added audio recorder files and speech callbacks" />
|
||||
<MESSAGE value="Moved files to appropriate directory." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Moved files to appropriate directory." />
|
||||
</component>
|
||||
</project>
|
@@ -34,6 +34,6 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'com.aldebaran:qisdk:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk-design:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk-design:1.7.5'
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fitbot.fitbot">
|
||||
package="com.fitbot">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
|
@@ -2,9 +2,17 @@ package com.fitbot.speech;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import com.aldebaran.qi.sdk.builder.SayBuilder;
|
||||
import com.aldebaran.qi.sdk.object.conversation.Phrase;
|
||||
import com.aldebaran.qi.sdk.object.conversation.Say;
|
||||
import com.aldebaran.qi.sdk.object.locale.Language;
|
||||
import com.aldebaran.qi.sdk.object.locale.Locale;
|
||||
import com.aldebaran.qi.sdk.object.locale.Region;
|
||||
|
||||
|
||||
public class SpeechGenerator {
|
||||
|
||||
private QiContext qiContext; // The QiContext object
|
||||
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
|
||||
@@ -82,6 +90,10 @@ public class SpeechGenerator {
|
||||
*/
|
||||
public void speak()
|
||||
{
|
||||
Say say = new SayBuilder().with(qiContext)
|
||||
.withPhrase(speechBuffer.toString())
|
||||
.withLocale(new Locale(languageIso639_1))
|
||||
.build();
|
||||
speechCallback.onSpeechGenerated(speechBuffer.toString());
|
||||
}
|
||||
|
||||
|
1
fitbot/.gitignore
vendored
Normal file
1
fitbot/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
34
fitbot/build.gradle
Normal file
34
fitbot/build.gradle
Normal file
@@ -0,0 +1,34 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
}
|
21
fitbot/proguard-rules.pro
vendored
Normal file
21
fitbot/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@@ -0,0 +1,25 @@
|
||||
package com.fitbot;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.fitbot.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
5
fitbot/src/main/AndroidManifest.xml
Normal file
5
fitbot/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fitbot">
|
||||
|
||||
</manifest>
|
17
fitbot/src/test/java/com/fitbot/ExampleUnitTest.java
Normal file
17
fitbot/src/test/java/com/fitbot/ExampleUnitTest.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.fitbot;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
8
local.properties
Normal file
8
local.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Fri Apr 19 14:48:28 CEST 2024
|
||||
sdk.dir=/Users/lucawarm/Library/Android/sdk
|
Reference in New Issue
Block a user