Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alco6 authored and Babilinski committed Jun 12, 2024
1 parent 908b025 commit 762267f
Show file tree
Hide file tree
Showing 868 changed files with 143,328 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
.vscode/
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IMPORTANT: PLEASE READ THIS NOTICE CAREFULLY BEFORE USING THE MAGIC LEAP 2 DEVELOPER RESOURCES PUBLISHED ON THIS WEBSITE.

Welcome, and thank you for exploring our Magic Leap 2 developer resources. Please note that your use of the ML2 developer resources in this repository is governed by the Magic Leap 2 Software License Agreement, the latest version of which is available at https://www.magicleap.com/software-license-agreement-ml2(the "ML2 LICENSE AGREEMENT").

By downloading any of the ML2 developer resources, YOU REPRESENT YOU HAVE READ, UNDERSTAND, AND AGREE TO BE BOUND BY THE TERMS AND CONDITIONS OF THE ML2 LICENSE AGREEMENT, and the materials contained this repository are deemed SDK Materials (as defined in the ML2 License Agreement). IF YOU DO NOT AGREE TO THE ML2 LICENSE AGREEMENT, THEN YOU MAY NOT CONTINUE WITH THE DOWNLOAD OR USE OF THE DEVELOPER RESOURCES PUBLISHED ON THIS WEBSITE.
132 changes: 67 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,96 @@
# TextToSpeech
# Magic Leap 2 Text-to-Speech Utility

This project shows how to use Text To speech Android functionality in ML2.
This project demonstrates how to use Android's Text-to-Speech functionality on the Magic Leap 2. The repository contains the Android Project used to create the plugin file, a sample Unity project and the Magic Leap TTS Utility Package.

## Repository Structure

- **TTSAndroidProject**
- Contains the Android Studio project and Java source code to build the AAR plugin that makes the Android TTS calls.
- Developers can modify the `ttsutil` module as needed.
- After building, the AAR files will be output under `TTSAndroidProject/ttsutil/build/outputs/aar/`.

## Getting started
- **UnityTTSUtilPkg**
- Directory for the Unity Package that includes the prebuilt plugin and the entry point for the TTS API calls (`TextToSpeechUtility`).
- The package can be imported into existing Unity projects.
- The sample can be imported via the Unity Package Manager.

To make it easy for you to get started with GitLab, here's a list of recommended next steps.
- **UnityTTSProject**
- Unity Project directory configured for Magic Leap 2.
- Contains a sample scene that demonstrates the use of the Text-to-Speech Utility through a simple `TextToSpeechSample` script.

Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
### Features

## Add your files
- Initialize and dispose of the TTS engine.
- Set the language of the TTS engine.
- Speak text with options to queue or flush the current speech (`QUEUE_FLUSH` and `QUEUE_ADD`).
- Check if the TTS engine is currently speaking.
- Stop the current speech.

- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
## Package Installation

```
cd existing_repo
git remote add origin https://gitlab.magicleap.io/sabanqueri/texttospeech.git
git branch -M main
git push -uf origin main
```

## Integrate with your tools

- [ ] [Set up project integrations](https://gitlab.magicleap.io/sabanqueri/texttospeech/-/settings/integrations)

## Collaborate with your team
This section includes instructions on importing the Magic Leap TTS Utility into an existing project.

- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
### Import the Package

## Test and Deploy
1. **Import the Package using git URL**
- Open your Unity project.
- Navigate to `Window` > `Package Manager`.
- Click the `+` button, select `Add package from git URL...`, and enter the URL for this package repository.

Use the built-in continuous integration in GitLab.

- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)

***
```xml
https://github.com/magicleap/MagicLeapTTSUtility.git?path=/UnityTTSUtilPkg
```

# Editing this README
#### Importing the Sample Scene

When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
1. **Open Package Manager**:
- Open your Unity project.
- Navigate to the Unity Editor menu, select `Window` > `Package Manager`.

## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
2. **Locate the Magic Leap TTS Utility Package**:
- In the Package Manager window, find the `Magic Leap TTS Utility` package.

## Name
Choose a self-explaining name for your project.
3. **Import the Sample Scene**:
- Click on the `Magic Leap TTS Utility` package in the list to view its details.
- In the details panel, navigate to the `Samples` tab.
- Select import next to `Sample Scene`.
- Once the import process is complete, the sample scene files will be added to your project's `Assets/Samples/` directory.

## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
#### Basic API Usage

## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
```csharp
// Initialize the Text-to-Speech system
TextToSpeechUtility.Initialize();

## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
// Check if the system is speaking
bool isSpeaking = TextToSpeechUtility.IsSpeaking();

## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
// Speak a text
TextToSpeechUtility.Speak("Hello, world!", TextToSpeechUtility.TTSQueueMode.QUEUE_MODE_FLUSH);

## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
// Change language (optional)
TextToSpeechUtility.SetLanguage(TextToSpeechUtility.SupportedLanguage.English_US);

## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
// Stop speaking
TextToSpeechUtility.StopSpeaking();

## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
// Dispose when done
TextToSpeechUtility.DisposeTts();
```

## Contributing
State if you are open to contributions and what your requirements are for accepting them.
## Building the AAR Plugin

For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
1. **Open the Android Project:**
- Navigate to `TTSAndroidProject` and open the project in Android Studio.

You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
2. **Build the AAR:**
- Build the project to generate the AAR file.
- The output will be located at `TTSAndroidProject/ttsutil/build/outputs/aar/`.

## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
3. **Import the AAR:**
- Rename the generated AAR file to `ttsutil.aar`
- Replace the existing plugin located inside the package's `UnityTTSUtilPkg/Plugins/Android/` directory.

## License
For open source projects, say how it is licensed.
## Copyright

## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
Copyright (c) 2023-present Magic Leap, Inc. All Rights Reserved. Use of this file is governed by the Developer Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
15 changes: 15 additions & 0 deletions TTSAndroidProject/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions TTSAndroidProject/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions TTSAndroidProject/.idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions TTSAndroidProject/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions TTSAndroidProject/.idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions TTSAndroidProject/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions TTSAndroidProject/.idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions TTSAndroidProject/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions TTSAndroidProject/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions TTSAndroidProject/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
38 changes: 38 additions & 0 deletions TTSAndroidProject/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.example.ttsandroidproject"
minSdk 29
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.example.ttsandroidproject'
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
21 changes: 21 additions & 0 deletions TTSAndroidProject/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.ttsandroidproject;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.example.ttsandroidproject", appContext.getPackageName());
}
}
16 changes: 16 additions & 0 deletions TTSAndroidProject/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TTSAndroidProject"
tools:targetApi="31" />

</manifest>
Loading

0 comments on commit 762267f

Please sign in to comment.