# Set up your development environment

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/)
- [Set up your development environment](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/1-prerequisites/)
- [Download and test the model](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/2-testing-model/)
- [Convert Stable Audio Open Small model to LiteRT](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/3-converting-model/)
- [Build LiteRT](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/4-building-litert/)
- [Create a simple program for Android target](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/5-creating-simple-program-for-android/)
- [Create a simple program for macOS target](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/6-creating-simple-program-for-macos/)
- [Next Steps](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/_next-steps/)

In this Learning Path, you’ll learn how to convert the Stable Audio Open Small model to the LiteRT (.tflite) format, then build a simple test program to generate audio on a mobile device.

Your first task is to prepare a development environment with the required software:

- Android NDK: version r27b or newer.
- Python: version 3.10 or newer (tested with 3.10).
- CMake: version 3.16.0 or newer (tested with 3.28.1).

## Create workspace directory

Create a separate directory for all the dependencies and repositories that this Learning Path uses.

Export the `WORKSPACE` variable to point to this directory, which you will use in the following steps:

```bash
mkdir my-workspace
export WORKSPACE=$PWD/my-workspace
```

## Install Python 3.10

Download and install [Python version 3.10](https://www.python.org/downloads/release/python-3100/) using the following commands:

```bash
sudo apt install -y python3.10 python3.10-venv
```

```bash
brew install python@3.10
brew link python@3.10 --force
```

You can verify the installation and check the version with:

```bash
python3.10 --version
```

## Install CMake

CMake is an open-source tool that automates the build process for software projects, helping to generate platform-specific build configurations.

```bash
sudo apt update
sudo apt install cmake g++ git
```

```bash
brew install cmake
```

You can verify the installation and check the version with:

```bash
cmake --version
```

See the [CMake install guide](https://learn.arm.com/install-guides/cmake/) for troubleshooting instructions.

## Install Bazel

Bazel is an open-source build tool which you will use to build LiteRT libraries.

```bash
cd $WORKSPACE
export BAZEL_VERSION=7.4.1
wget https://github.com/bazelbuild/bazel/releases/download/{$BAZEL_VERSION}/bazel-{$BAZEL_VERSION}-installer-linux-x86_64.sh
sudo bash bazel-7.4.1-installer-linux-x86_64.sh
export PATH="/usr/local/bin:$PATH"
```

```bash
cd $WORKSPACE
export BAZEL_VERSION=7.4.1
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/{$BAZEL_VERSION}/bazel-{$BAZEL_VERSION}-installer-darwin-arm64.sh"
sudo bash bazel-7.4.1-installer-darwin-arm64.sh
export PATH="/usr/local/bin:$PATH"
```

You can verify the installation and check the version with:

```bash
bazel --version
```

## Install Android SDK and NDK

To build a native Android application you will need to install the Android SDK:

```bash
cd $WORKSPACE
sudo apt install openjdk-21-jdk openjdk-21-jre unzip
wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip
unzip -o commandlinetools-linux-13114758_latest.zip
mkdir -p $WORKSPACE/Android/Sdk
export ANDROID_HOME=$WORKSPACE/Android
export ANDROID_SDK_HOME=$ANDROID_HOME/Sdk
$WORKSPACE/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_HOME --install "platform-tools" "platforms;android-35" "build-tools;35.0.0"
```

```bash
cd $WORKSPACE
wget https://dl.google.com/android/repository/commandlinetools-mac-13114758_latest.zip
unzip -o commandlinetools-linux-13114758_latest.zip
mkdir -p $WORKSPACE/Android/Sdk
export ANDROID_HOME=$WORKSPACE/Android
export ANDROID_SDK_HOME=$ANDROID_HOME/Sdk
$WORKSPACE/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_HOME --install "platform-tools" "platforms;android-35" "build-tools;35.0.0"
```

To run the model on Android, install Android Native Development Kit (Android NDK):

```bash
cd $WORKSPACE
wget https://dl.google.com/android/repository/android-ndk-r27b-linux.zip
unzip android-ndk-r27b-linux.zip
```

```bash
cd $WORKSPACE
wget https://dl.google.com/android/repository/android-ndk-r27b-darwin.zip
unzip android-ndk-r27b-darwin.zip
```

For easier access and execution of Android NDK tools, add these to the `PATH` and set the `NDK_PATH` variable:

```bash
export NDK_PATH=$WORKSPACE/android-ndk-r27b/
export ANDROID_NDK_HOME=$NDK_PATH
export PATH=$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
```

```bash
export NDK_PATH=$WORKSPACE/android-ndk-r27b/
export ANDROID_NDK_HOME=$NDK_PATH
export PATH=$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin/:$PATH
```

Now that your development environment is ready and all the prerequisites are installed, you can move on to test the Stable Audio Open Small model.
