Unet audio is a great educational tool for using and testing Unet implementations using UnetStack. Unet audio uses your computer’s sound card as an acoustic modem. Almost the entire functionality of UnetStack is available in Unet audio, so you can easily develop and test Unet Agents, try out communications algorithms, and even test your scripts and programs written to interact with UnetStack without needing any extra hardware.

Unet audio

Unet audio binds to your computer’s operating system and uses the built-in audio services to send and receive audio from the sound card. This means that some of the libraries used by Unet audio need to be compiled for the specific operating system and architecture.

Until UnetStack 3 Community release v3.4.3, Unet audio was only supported on Linux and macOS on the Intel x86 architecture. However, with the release of Apple Silicon, and the popularity of Mac computers with the M1/2/3 chips, we have been working to make Unet audio available on the ARM architecture.

We are happy to announce that Unet audio is now available on macOS running on Apple Silicon, from Unet Community v3.4.4 onwards.

Setup Unet audio on Macs with Apple Silicon

Unet audio comes as a part of UnetStack 3 Community releases. You can download the latest release from the UnetStack 3 downloads section.

Pre-requisites

UnetStack 3 requires Java 8 to be installed on your computer. With the macOS on Apple Silicon, you can run Java 8 compiled for x86 architecture using Rosetta 2 or run Java 8 compiled for ARM (aarch64) architecture natively.

Unet audio additionally requires portaudio to be installed on your computer. Homebrew is a great package manager for macOS, and you can use it to install portaudio.

The architecture of Java 8 that you have installed on your computer will determine which version of portaudio you need to use. The following table shows the compatibility between the architecture of the Mac, Java 8, and portaudio:

Computer CPU Java 8 Architecture Portaudio Architecture
Intel x86 x86 x86
Apple Silicon (aarch64) aarch64 aarch64
Apple Silicon (Rosetta) x86 x86

Java

We recommend using the aarch64 version of Java 8 and other dependencies on your Apple Silicon Mac. Azul Systems provides a great build of Java 8 for ARM, and you can download it from here. If you use the sdkman tool, you can install the ARM version of Java 8 using the following command:

1
sdk install java 8.0.322-zulu

To check which version of Java 8 you are using, you can run the following command:

1
2
3
> java -version
openjdk version "1.8.0_`XXX`"
OpenJDK Runtime Environment (Zulu 8.`A`.`B`.`C`-CA-macos-aarch64)

Homebrew and Portaudio

The version of portaudio installed by Homebrew will depend on the version of Homebrew that was installed on your computer. By default, Homebrew installs the native (ARM) version, but it is possible to have an x86 version of Homebrew installed (with Rosetta 2). Check which version of Homebrew you are using by running the following command:

1
2
> which brew
/opt/homebrew/bin/brew

An x86 version of Homebrew will return /usr/local/bin/brew instead. If you are running an x86 version of Homebrew, we recommend that you switch to the native version of Homebrew.

Once you are using the native version of Homebrew, you can install portaudio using the following command:

1
> brew install portaudio

You can ensure that the correct version of portaudio is installed by running the following command:

1
2
> file /opt/homebrew/lib/libportaudio.dylib
/opt/homebrew/lib/libportaudio.dylib: Mach-O 64-bit dynamically linked shared library arm64

Note the arm64 in the output.

Running Unet audio

Once you have installed the correct version of Java 8 and portaudio, you can run Unet audio by unzipping the UnetStack 3 Community release and running the following command in the unet-v3.4.4 directory:

1
bin/unet audio

Accepting Security Permissions on macOS for running Unet audio

When you run Unet audio for the first time, macOS will flag the dynamic libraries that Unet audio uses as being from an unidentified developer.

Unet audio Security

You will need to permit running these libraries. You can do this by going to System Preferences -> Security & Privacy -> General and clicking on Allow Anyway next to the message that says that the libraries were blocked from running.

Unet audio Security

When you run Unet audio again, you will be prompted to permit running the libraries. Click on Open to permit running the libraries.

Unet audio Security

You might have to run the bin/unet audio command again after permitting the libraries to run. You should only have to do this once, and Unet audio will run without any issues after that.


Photo by Ales Nesetril on Unsplash