File: README-SoundTouch-Android.html

package info (click to toggle)
audacity 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 129,312 kB
  • sloc: ansic: 373,350; cpp: 276,880; sh: 56,060; python: 18,922; makefile: 10,309; lisp: 8,365; xml: 1,888; perl: 1,798; java: 1,551; asm: 545; pascal: 395; sed: 58; awk: 35
file content (118 lines) | stat: -rw-r--r-- 6,998 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>SoundTouch in Android</title>
  <meta http-equiv="Content-Type"
 content="text/html; charset=windows-1252">
  <meta http-equiv="Content-Language" content="en-us">
  <meta name="author" content="Olli Parviainen">
  <meta name="description"
 content="Readme file for SoundTouch library Android compilation">
  <style> <!-- .normal { font-family: Arial }
  --></style>
</head>
<body class="normal">
<hr>
<h1>SoundTouch in Android</h1>
<hr>
<h2>Compiling SoundTouch for Android</h2>
<p>SoundTouch source code package contains &quot;Android-lib&quot; example project that compiles SoundTouch 
    source codes into Android native library, and gives an example of JNI interface 
    for invoking 
    the native SoundTouch routines from an Android application written in Java.</p>
<p style="font-weight: 700">Software prerequisites:</p>
<ul>
    <li>Android SDK environment for developing your own Android application. Visit the <a href="http://developer.android.com/index.html">Android developers' site</a> 
        for more information about the Android SDK and developing Android applications.</li>
    <li>Android NDK compiler kit for compiling native library binaries. The Android NDK 
        is <a href="http://developer.android.com/tools/sdk/ndk/index.html">
        available for download</a> at the Android developer tools site.</li>
    <li>In case you're working in Windows environment, install
        <a href="http://cygwin.com/install.html">
        Cygwin</a> to run the Android NDK/SDK compiler scripts</li>
    <li>Latest SoundTouch source code package available at <a href="http://soundtouch.surina.net/sourcecode.html">
        soundtouch.surina.net</a>.</li>
</ul>
<p><b>Hint: </b>As installing and configuring all the components for an Android SDK/NDK 
    environment requires fair effort, it&#39;s good idea to create a dedicated Virtual 
    Machine environment for the Android development environment installation. 
    Having the Android developer environment setup in dedicated Virtual Machine 
    allows keeping all these settings isolated from your other PC operations, and 
    eases taking backup snapshots of your full development environment.</p>
<p><b>Compiling</b></p>
<p>
    To compile the SoundTouch library source codes into an Android native library, 
    open Cygwin/bash shell, go to directory <b>&quot;soundtouch/source/Android-lib/jni&quot;</b> and invoke the NDK 
    compiler with following command:</p>
<pre>    $NDK/ndk-build</pre>
<p>This will build the ARMv5 and ARMv7 versions of SoundTouch library (including 
    also the example JNI 
    interface, see below) into the &quot;libs&quot; subdirectory.</p>
<p>Notice that to allow Cygwin/bash to locate the NDK compile scripts, you 
    need to define the location of the NDK installation defined in environment 
    variable &quot;NDK&quot;. That's easiest done by adding the NDK path definition at end of 
    your <b>~/.bash_profile</b> file, for instance as follows:</p>
<pre>    NDK=/cygdrive/d/Android/android-ndk-r6</pre>
<hr />
<h2>
    Android floating-point performance considerations</h2>
<p>
        Default build target for
        Android NDK is ARMv5 CPU generation, as that works in 
        all ARM-based Android devices.<p>
        This has a pitfall though: For ideal sound quality SoundTouch should be compiled 
        to use floating-point algorithms, however, all low-end Android devices do not 
        have floating-point hardware in their CPUs, and hence the default ARMv5 compilation uses software-emulation for floating-point calculations instead of 
        hardware floating-point to allow running the binary executables also in low-end devices.<p>
        The floating point software-emulation is however several tens of times slower 
        than real hardware-level floating-point calculations, making 
        floating-point-intensive applications such as SoundTouch infeasible with low-end 
        devices.<p>
        As workaround, the SoundTouch Android compilation builds two separate versions 
        of the library:<ul>
        <li>ARMv5 version that compiles SoundTouch using integer algorithm version. The integer 
            algorithm version compromises the sound quality but provides good performance also 
            with low-end 
            devices without hardware floating-point support in the CPU level.</li>
        <li>ARMv7 version that compiles SoundTouch using hardware floating-point algorithms. 
            These algorithms provide ideal sound quality yet do not work in simpler CPU 
            models.</li>
    </ul>
    <p>
        These two library compilations are already defined in file &quot;<b>jni/Application.mk</b>&quot; 
        so that these two separate library targets are automatically built under the &quot;<b>libs</b>&quot; 
        directory. As far as you include both these compiled library versions into your 
        application delivery, the Android devices can automatically select the right 
        library version based on the available device&#39;s capabilities.<p>
        Please yet be aware that depending on capabilities of the Android devices you 
        will need to provide the SoundTouch routines with samples in either integer or 
        floating-point format, so build your interface routines to take this into 
        account.<hr />
<h2>
    Calling SoundTouch native routines from Android application</h2>
    <p>The NDK tools build the SoundTouch c++ routines into a native binary library, while 
    Android applications are written in Java language. To call the SoundTouch and other c/c++ 
    routines from an Android java application code, you'll need to use Java Native 
    Interface (JNI).</p>
    <p>
        The SoundTouch source code package provides source code example how to 
        use JNI to call native c++ routines from a Java class through the following 
        source code file pair:<ul>
        <li><b>Android-lib/jni/soundtouch-jni.cpp</b>: This file contains c/c++ routine that 
            calls SoundTouch library routine to return the library version string to the main 
            Android application. The NDK compiles this file along with the SoundTouch 
            routines into the native binary library.</li>
        <li><b>Android-lib/src/net/surina/soundtouch/SoundTouch.java</b>: This file provides 
            a Java interface class to load the native library and to invoke the native routine implemented in 
            the file <b>soundtouch-jni.cpp</b></li>
    </ul>
<p>
        Feel free to examine and extend the provided cpp/java source code example file pair to 
        implement and integrate the desired SoundTouch library capabilities into your Android application.</p>
<hr />
    <p style="text-align: center"><i>Copyright &copy; Olli Parviainen</i></p>
    <!--
$Id: README-SoundTouch-Android.html 165 2012-12-28 19:55:23Z oparviai $
-->
</body>
</html>