Published on

Free software and a lovely meditation bell

Authors

Whenever I get into arguments with people about Android versus iOS, one of my go-to reasons I give for choosing Android is that there is much more free software for Android and the whole ecosystem is much more open (you don't have to get anyone's permission or jump through any hoops to install and distritute apps). One of the benefits of free software is that you can inspect it and modify it to suit your needs. Even though I like to give lip service to free software like this, I have actually not went through this process myself that often. So I decided to change that!

There's an Android app called Meditation Assistant that I like to use to track and time meditation sessions. Unfortunately I found out that custom sounds were not functioning on Android 11. Since the default sounds are not very pleasant in my opinion, I decided to do something about it, and make my favorite meditation bell a default sound in the app, until the creator fixes the problem with custom sounds.

The source code was easy to find, each F-Droid listing is actually required to contain a link to the source code.

$ git clone https://code.rocketnine.space/tslocum/meditationassistant/src/branch/master

Next I had to download and install Android Studio. Luckily it was available through the AUR, so it was simply a matter of running:

$ yay -S android-studio

To find where the default audio files are located in the source tree, I used a tool called ncdu. Normally you would use this tool to find large files to free up disk space, but it also works to find relatively tiny files which are nonetheless much larger than source files:

Next I could simply use grep to find where this file was used in the source code:

$ grep -r bell_indian .
grep: ./.git/index: binary file matches
./MeditationAssistant/src/main/java/sh/ftp/rocketninelabs/meditationassistant/MeditationSounds.java:            case "bell_indian":
./MeditationAssistant/src/main/java/sh/ftp/rocketninelabs/meditationassistant/MeditationSounds.java:                return R.raw.bell_indian;
./MeditationAssistant/src/main/java/sh/ftp/rocketninelabs/meditationassistant/MeditationSounds.java:            case "bell_indian":
./MeditationAssistant/src/main/res/values/arrays.xml:        <item>bell_indian</item>

I wanted to use this lovely meditation bell sound. There was a little crackle at the start and end, I removed those with Audacity and I added a fade in and fade out.

After editing the source files I found, placing the resulting .ogg audio file in the directory I found and hitting Build in Android Studio and hoping for the best, I got an .apk file which I could simply install after transferring it to my phone. The result:

Freedom!