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:
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:
mkdir my-workspace
export WORKSPACE=$PWD/my-workspace
Download and install Python version 3.10 using the following commands:
sudo apt install -y python3.10 python3.10-venv
brew install python@3.10
brew link python@3.10 --force
You can verify the installation and check the version with:
python3.10 --version
CMake is an open-source tool that automates the build process for software projects, helping to generate platform-specific build configurations.
sudo apt update
sudo apt install cmake g++ git
brew install cmake
You can verify the installation and check the version with:
cmake --version
See the CMake install guide for troubleshooting instructions.
Bazel is an open-source build tool which you will use to build LiteRT libraries.
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"
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:
bazel --version
To build a native Android application you will need to install the Android SDK:
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"
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):
cd $WORKSPACE
wget https://dl.google.com/android/repository/android-ndk-r27b-linux.zip
unzip android-ndk-r27b-linux.zip
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:
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
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.