This is the Bass Audio Library, suggested by my friend Adam a while ago https://www.un4seen.com/. This is Pybass https://sourceforge.net/projects/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 libbass.so 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 pybass.py file is the path to libbass.so. 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 * @SYNCPROC 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) BASS_Free()
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 standalone_python.sh
#! /system/bin/sh PW=`pwd` 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 PYTHON_EGG_CACHE=$TEMP 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
sh standalone_python.sh test.py
Here is the result and yes there was audio playing off of my phone. Enjoy! Resources https://www.un4seen.com/ https://sourceforge.net/projects/pybass/ https://code.google.com/p/python-for-android/wiki/RunPythonFromShell https://code.google.com/p/python-for-android/