PyBass [Bass Audio API] on Android Trials

This is the Bass Audio Library, suggested by my friend Adam a while ago This is Pybass the ctypes implementation of Bass Audio

I contributed in the past to various developments on the Pybass scripts such as VST implementation.

This is my initial tests in working with PyBass on Android. I am using a rooted phone to copy over the file to /data/data on the internal storage. Please be sure you download the bass library for Android.

The only line you will need to change in your file is the path to Keep in mind a shared object file will not execute from your sdcard it has to be on the internal storage. This has to do with Android security.

The test python script I ran was:

from pybass import *

def onEndPlay(handle, buffer, length, user):
    print("playing finished.")

if __name__ == "__main__":
    BASS_Init(1, 44100, 0, 0, 0)
    handle = BASS_StreamCreateFile(False, b'/sdcard/test.mp3', 0, 0, 0)
    BASS_ChannelSetSync(handle, BASS_SYNC_END, 0, onEndPlay, 0)
    play_handle(handle, False)

I ran this from the sdcard using a shell script (see below) the shell script allows me to execute python from the adb shell terminal window

#! /system/bin/sh
export EXTERNAL_STORAGE=/mnt/sdcard
export LANG=en
export PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6
export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/tmp
export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.googlecode.pythonforandroid/files/python/lib:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
cd $PW
/data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@"

the command was


Here is the result

and yes there was audio playing off of my phone.