├── .classpath
├── .project
├── AndroidManifest.xml
├── bin
├── AndroidManifest.xml
├── VisualAudio.apk
├── classes.dex
├── classes
│ ├── ca
│ │ └── uol
│ │ │ └── aig
│ │ │ └── fftpack
│ │ │ ├── Complex1D.class
│ │ │ ├── ComplexDoubleFFT.class
│ │ │ ├── ComplexDoubleFFT_Mixed.class
│ │ │ ├── RealDoubleFFT.class
│ │ │ ├── RealDoubleFFT_Even.class
│ │ │ ├── RealDoubleFFT_Even_Odd.class
│ │ │ ├── RealDoubleFFT_Mixed.class
│ │ │ ├── RealDoubleFFT_Odd.class
│ │ │ └── RealDoubleFFT_Odd_Odd.class
│ └── com
│ │ └── example
│ │ └── visualaudio
│ │ ├── BuildConfig.class
│ │ ├── MainActivity$1.class
│ │ ├── MainActivity$RecordAudioTask.class
│ │ ├── MainActivity.class
│ │ ├── R$attr.class
│ │ ├── R$dimen.class
│ │ ├── R$drawable.class
│ │ ├── R$id.class
│ │ ├── R$layout.class
│ │ ├── R$menu.class
│ │ ├── R$string.class
│ │ ├── R$style.class
│ │ └── R.class
├── dexedLibs
│ └── android-support-v4-4b51c22cf17a378f1bd1686ef1916f3b.jar
├── res
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ └── drawable-xxhdpi
│ │ └── ic_launcher.png
└── resources.ap_
├── gen
└── com
│ └── example
│ └── visualaudio
│ ├── BuildConfig.java
│ └── R.java
├── ic_launcher-web.png
├── libs
└── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── layout
│ └── activity_main.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
├── ca
└── uol
│ └── aig
│ └── fftpack
│ ├── Complex1D.java
│ ├── ComplexDoubleFFT.java
│ ├── ComplexDoubleFFT_Mixed.java
│ ├── RealDoubleFFT.java
│ ├── RealDoubleFFT_Even.java
│ ├── RealDoubleFFT_Even_Odd.java
│ ├── RealDoubleFFT_Mixed.java
│ ├── RealDoubleFFT_Odd.java
│ └── RealDoubleFFT_Odd_Odd.java
└── com
└── example
└── visualaudio
└── MainActivity.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | VisualAudio
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bin/VisualAudio.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/VisualAudio.apk
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes.dex
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/Complex1D.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/Complex1D.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/ComplexDoubleFFT.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/ComplexDoubleFFT.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/ComplexDoubleFFT_Mixed.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/ComplexDoubleFFT_Mixed.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Even.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Even.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Even_Odd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Even_Odd.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Mixed.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Mixed.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Odd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Odd.class
--------------------------------------------------------------------------------
/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Odd_Odd.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/ca/uol/aig/fftpack/RealDoubleFFT_Odd_Odd.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/MainActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/MainActivity$RecordAudioTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/MainActivity$RecordAudioTask.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/MainActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$dimen.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$id.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$menu.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$string.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R$style.class
--------------------------------------------------------------------------------
/bin/classes/com/example/visualaudio/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/classes/com/example/visualaudio/R.class
--------------------------------------------------------------------------------
/bin/dexedLibs/android-support-v4-4b51c22cf17a378f1bd1686ef1916f3b.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/dexedLibs/android-support-v4-4b51c22cf17a378f1bd1686ef1916f3b.jar
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/bin/resources.ap_
--------------------------------------------------------------------------------
/gen/com/example/visualaudio/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.example.visualaudio;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/gen/com/example/visualaudio/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.example.visualaudio;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /** Default screen margins, per the Android Design guidelines.
15 |
16 | Customize dimensions originally defined in res/values/dimens.xml (such as
17 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
18 |
19 | */
20 | public static final int activity_horizontal_margin=0x7f040000;
21 | public static final int activity_vertical_margin=0x7f040001;
22 | }
23 | public static final class drawable {
24 | public static final int ic_launcher=0x7f020000;
25 | }
26 | public static final class id {
27 | public static final int action_settings=0x7f080002;
28 | public static final int imgView=0x7f080001;
29 | public static final int startStopBtn=0x7f080000;
30 | }
31 | public static final class layout {
32 | public static final int activity_main=0x7f030000;
33 | }
34 | public static final class menu {
35 | public static final int main=0x7f070000;
36 | }
37 | public static final class string {
38 | public static final int action_settings=0x7f050001;
39 | public static final int app_name=0x7f050000;
40 | public static final int hello_world=0x7f050002;
41 | }
42 | public static final class style {
43 | /**
44 | Base application theme, dependent on API level. This theme is replaced
45 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
46 |
47 |
48 | Theme customizations available in newer API levels can go in
49 | res/values-vXX/styles.xml, while customizations related to
50 | backward-compatibility can go here.
51 |
52 |
53 | Base application theme for API 11+. This theme completely replaces
54 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
55 |
56 | API 11 theme customizations can go here.
57 |
58 | Base application theme for API 14+. This theme completely replaces
59 | AppBaseTheme from BOTH res/values/styles.xml and
60 | res/values-v11/styles.xml on API 14+ devices.
61 |
62 | API 14 theme customizations can go here.
63 | */
64 | public static final int AppBaseTheme=0x7f060000;
65 | /** Application theme.
66 | All customizations that are NOT specific to a particular API-level can go here.
67 | */
68 | public static final int AppTheme=0x7f060001;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/ic_launcher-web.png
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lnmcc/VisualAudio/20609293d459e7f225ec10ee9913fd68008455be/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | VisualAudio
5 | Settings
6 | Hello world!
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/ca/uol/aig/fftpack/Complex1D.java:
--------------------------------------------------------------------------------
1 | package ca.uol.aig.fftpack;
2 | /**
3 | * Construct a 1-D complex data sequence.
4 | */
5 | public class Complex1D
6 | {
7 | /**
8 | * x[i] is the real part of i-th complex data.
9 | */
10 | public double x[];
11 | /**
12 | * y[i] is the imaginary part of i-th complex data.
13 | */
14 | public double y[];
15 | }
16 |
--------------------------------------------------------------------------------
/src/ca/uol/aig/fftpack/ComplexDoubleFFT.java:
--------------------------------------------------------------------------------
1 | package ca.uol.aig.fftpack;
2 | /**
3 | * FFT transform of a complex periodic sequence.
4 | * @author Baoshe Zhang
5 | * @author Astronomical Instrument Group of University of Lethbridge.
6 | */
7 | public class ComplexDoubleFFT extends ComplexDoubleFFT_Mixed
8 | {
9 | /**
10 | * norm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward transform
12 | * (bt) will multiply the input sequence by norm_factor.
13 | */
14 | public double norm_factor;
15 | private double wavetable[];
16 | private int ndim;
17 |
18 | /**
19 | * Construct a wavenumber table with size n for Complex FFT.
20 | * The sequences with the same size can share a wavenumber table. The prime
21 | * factorization of n together with a tabulation of the trigonometric functions
22 | * are computed and stored.
23 | *
24 | * @param n the size of a complex data sequence. When n is a multiplication of small
25 | * numbers (4, 2, 3, 5), this FFT transform is very efficient.
26 | */
27 | public ComplexDoubleFFT(int n)
28 | {
29 | ndim = n;
30 | norm_factor = n;
31 | if(wavetable == null || wavetable.length !=(4*ndim+15))
32 | {
33 | wavetable = new double[4*ndim + 15];
34 | }
35 | cffti(ndim, wavetable);
36 | }
37 |
38 | /**
39 | * Forward complex FFT transform.
40 | *
41 | * @param x 2*n real double data representing n complex double data.
42 | * As an input parameter, x is an array of 2*n real
43 | * data representing n complex data. As an output parameter, x represents n
44 | * FFT'd complex data. Their relation as follows:
45 | *
46 | * x[2*i] is the real part of i-th complex data;
47 | *
48 | * x[2*i+1] is the imaginary part of i-the complex data.
49 | *
50 | */
51 | public void ft(double x[])
52 | {
53 | if(x.length != 2*ndim)
54 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
55 | cfftf(ndim, x, wavetable);
56 | }
57 |
58 | /**
59 | * Forward complex FFT transform.
60 | *
61 | * @param x an array of n Complex data
62 | */
63 | public void ft(Complex1D x)
64 | {
65 | if(x.x.length != ndim)
66 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
67 | double[] y = new double[2*ndim];
68 | for(int i=0; ift(double[]).
83 | *
84 | * @param x 2*n real double data representing n complex double data.
85 | *
86 | * As an input parameter, x is an array of 2*n
87 | * real data representing n complex data. As an output parameter, x represents
88 | * n FFT'd complex data. Their relation as follows:
89 | *
90 | * x[2*i] is the real part of i-th complex data;
91 | *
92 | * x[2*i+1] is the imaginary part of i-the complex data.
93 | *
94 | */
95 | public void bt(double x[])
96 | {
97 | if(x.length != 2*ndim)
98 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
99 | cfftb(ndim, x, wavetable);
100 | }
101 |
102 | /**
103 | * Backward complex FFT transform. It is the unnormalized inverse transform of ft(Complex1D[]).
104 | *
105 | *
106 | * @param x an array of n Complex data
107 | */
108 | public void bt(Complex1D x)
109 | {
110 | if(x.x.length != ndim)
111 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
112 | double[] y = new double[2*ndim];
113 | for(int i=0; i=l1)
313 | {
314 | for(j=1; jidp) idlj-=idp;
367 | war=wtable[idlj-2+iw1];
368 | wai=wtable[idlj-1+iw1];
369 | for(ik=0; ik5)
639 | {
640 | wtable[i1-1+2*n]=wtable[i-1+2*n];
641 | wtable[i1+2*n]=wtable[i+2*n];
642 | }
643 | }
644 | l1=l2;
645 | }
646 |
647 | }
648 |
649 | /*---------------------------------------------------------
650 | cffti: Initialization of Real forward FFT
651 | --------------------------------------------------------*/
652 | void cffti(int n, double wtable[])
653 | {
654 | if(n==1) return;
655 | cffti1(n, wtable);
656 | } /*cffti*/
657 |
658 | }
659 |
--------------------------------------------------------------------------------
/src/ca/uol/aig/fftpack/RealDoubleFFT.java:
--------------------------------------------------------------------------------
1 | package ca.uol.aig.fftpack;
2 | /**
3 | * FFT transform of a real periodic sequence.
4 | * @author Baoshe Zhang
5 | * @author Astronomical Instrument Group of University of Lethbridge.
6 | */
7 | public class RealDoubleFFT extends RealDoubleFFT_Mixed
8 | {
9 | /**
10 | * norm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward transform
12 | * (bt) will multiply the input sequence by norm_factor.
13 | */
14 | public double norm_factor;
15 | private double wavetable[];
16 | private int ndim;
17 |
18 | /**
19 | * Construct a wavenumber table with size n.
20 | * The sequences with the same size can share a wavenumber table. The prime
21 | * factorization of n together with a tabulation of the trigonometric functions
22 | * are computed and stored.
23 | *
24 | * @param n the size of a real data sequence. When n is a multiplication of small
25 | * numbers (4, 2, 3, 5), this FFT transform is very efficient.
26 | */
27 | public RealDoubleFFT(int n)
28 | {
29 | ndim = n;
30 | norm_factor = n;
31 | if(wavetable == null || wavetable.length !=(2*ndim+15))
32 | {
33 | wavetable = new double[2*ndim + 15];
34 | }
35 | rffti(ndim, wavetable);
36 | }
37 |
38 | /**
39 | * Forward real FFT transform. It computes the discrete transform of a real data sequence.
40 | *
41 | * @param x an array which contains the sequence to be transformed. After FFT,
42 | * x contains the transform coeffients used to construct n complex FFT coeffients.
43 | *
44 | * The real part of the first complex FFT coeffients is x[0]; its imaginary part
45 | * is 0. If n is even set m = n/2, if n is odd set
46 | * m = n/2, then for
47 | *
48 | * k = 1, ..., m-1
49 | * the real part of k-th complex FFT coeffients is x[2*k-1];
50 | *
51 | * the imaginary part of k-th complex FFT coeffients is x[2*k-2].
52 | *
53 | * If n is even,
54 | * the real of part of (n/2)-th complex FFT coeffients is x[n]; its imaginary part is 0.
55 | * The remaining complex FFT coeffients can be obtained by the symmetry relation:
56 | * the (n-k)-th complex FFT coeffient is the conjugate of n-th complex FFT coeffient.
57 | *
58 | */
59 | public void ft(double x[])
60 | {
61 | if(x.length != ndim)
62 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
63 | rfftf(ndim, x, wavetable);
64 | }
65 |
66 | /**
67 | * Forward real FFT transform. It computes the discrete transform of a real data sequence.
68 | *
69 | * @param x an array which contains the sequence to be transformed. After FFT,
70 | * x contains the transform coeffients used to construct n complex FFT coeffients.
71 | *
72 | * @param y the first complex (n+1)/2 (when n is odd) or (n/2+1) (when
73 | * n is even) FFT coeffients.
74 | * The remaining complex FFT coeffients can be obtained by the symmetry relation:
75 | * the (n-k)-th complex FFT coeffient is the conjugate of n-th complex FFT coeffient.
76 | *
77 | */
78 | public void ft(double x[], Complex1D y)
79 | {
80 | if(x.length != ndim)
81 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
82 | rfftf(ndim, x, wavetable);
83 |
84 | if(ndim%2 == 0)
85 | {
86 | y.x = new double[ndim/2 + 1];
87 | y.y = new double[ndim/2 + 1];
88 | }
89 | else
90 | {
91 | y.x = new double[(ndim+1)/2];
92 | y.y = new double[(ndim+1)/2];
93 | }
94 |
95 |
96 | y.x[0] = x[0];
97 | y.y[0] = 0.0D;
98 | for(int i=1; i<(ndim+1)/2; i++)
99 | {
100 | y.x[i] = x[2*i-1];
101 | y.y[i] = x[2*i];
102 | }
103 | if(ndim%2 == 0)
104 | {
105 | y.x[ndim/2] = x[ndim-1];
106 | y.y[ndim/2] = 0.0D;
107 | }
108 |
109 | }
110 |
111 | /**
112 | * Backward real FFT transform. It is the unnormalized inverse transform of ft(double[]).
113 | *
114 | * @param x an array which contains the sequence to be transformed. After FFT,
115 | * x contains the transform coeffients. Also see the comments of ft(double[])
116 | * for the relation between x and complex FFT coeffients.
117 | */
118 | public void bt(double x[])
119 | {
120 | if(x.length != ndim)
121 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
122 | rfftb(ndim, x, wavetable);
123 | }
124 | /**
125 | * Backward real FFT transform. It is the unnormalized inverse transform of ft(Complex1D, double[]).
126 | *
127 | * @param x an array which contains the sequence to be transformed. When n is odd, it contains the first
128 | * (n+1)/2 complex data; when n is even, it contains (n/2+1) complex data.
129 | * @param y the real FFT coeffients.
130 | *
131 | * Also see the comments of ft(double[]) for the relation
132 | * between x and complex FFT coeffients.
133 | */
134 | public void bt(Complex1D x, double y[])
135 | {
136 | if(ndim%2 == 0)
137 | {
138 | if(x.x.length != ndim/2+1)
139 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
140 | }
141 | else
142 | {
143 | if(x.x.length != (ndim+1)/2)
144 | throw new IllegalArgumentException("The length of data can not match that of the wavetable");
145 | }
146 |
147 | y[0] = x.x[0];
148 | for(int i=1; i<(ndim+1)/2; i++)
149 | {
150 | y[2*i-1]=x.x[i];
151 | y[2*i]=x.y[i];
152 | }
153 | if(ndim%2 == 0)
154 | {
155 | y[ndim-1]=x.x[ndim/2];
156 | }
157 | rfftb(ndim, y, wavetable);
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/src/ca/uol/aig/fftpack/RealDoubleFFT_Even.java:
--------------------------------------------------------------------------------
1 | package ca.uol.aig.fftpack;
2 | /**
3 | * cosine FFT transform of a real even sequence.
4 | * @author Baoshe Zhang
5 | * @author Astronomical Instrument Group of University of Lethbridge.
6 | */
7 | public class RealDoubleFFT_Even extends RealDoubleFFT_Mixed
8 | {
9 | /**
10 | * norm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward transform
12 | * (bt) will multiply the input sequence by norm_factor.
13 | */
14 | public double norm_factor;
15 | private double wavetable[];
16 | private int ndim;
17 |
18 | /**
19 | * Construct a wavenumber table with size n.
20 | * The sequences with the same size can share a wavenumber table. The prime
21 | * factorization of n together with a tabulation of the trigonometric functions
22 | * are computed and stored.
23 | *
24 | * @param n the size of a real data sequence. When (n-1) is a multiplication of small
25 | * numbers (4, 2, 3, 5), this FFT transform is very efficient.
26 | */
27 | public RealDoubleFFT_Even(int n)
28 | {
29 | ndim = n;
30 | norm_factor = 2*(n-1);
31 | if(wavetable == null || wavetable.length !=(3*ndim+15))
32 | {
33 | wavetable = new double[3*ndim + 15];
34 | }
35 | costi(ndim, wavetable);
36 | }
37 |
38 | /**
39 | * Forward cosine FFT transform. It computes the discrete sine transform of
40 | * an odd sequence.
41 | *
42 | * @param x an array which contains the sequence to be transformed. After FFT,
43 | * x contains the transform coeffients.
44 | */
45 | public void ft(double x[])
46 | {
47 | cost(ndim, x, wavetable);
48 | }
49 |
50 | /**
51 | * Backward cosine FFT transform. It is the unnormalized inverse transform of ft.
52 | *
53 | * @param x an array which contains the sequence to be transformed. After FFT,
54 | * x contains the transform coeffients.
55 | */
56 | public void bt(double x[])
57 | {
58 | cost(ndim, x, wavetable);
59 | }
60 |
61 |
62 | /*-------------------------------------------------------------
63 | cost: cosine FFT. Backward and forward cos-FFT are the same.
64 | ------------------------------------------------------------*/
65 | void cost(int n, double x[], final double wtable[])
66 | {
67 | int modn, i, k;
68 | double c1, t1, t2;
69 | int kc;
70 | double xi;
71 | int nm1;
72 | double x1h;
73 | int ns2;
74 | double tx2, x1p3, xim2;
75 |
76 |
77 | nm1=n-1;
78 | ns2=n / 2;
79 | if(n-2<0) return;
80 | else if(n==2)
81 | {
82 | x1h=x[0]+x[1];
83 | x[1]=x[0]-x[1];
84 | x[0]=x1h;
85 | }
86 | else if(n==3)
87 | {
88 | x1p3=x[0]+x[2];
89 | tx2=x[1]+x[1];
90 | x[1]=x[0]-x[2];
91 | x[0]=x1p3+tx2;
92 | x[2]=x1p3-tx2;
93 | }
94 | else
95 | {
96 | c1=x[0]-x[n-1];
97 | x[0]+=x[n-1];
98 | for(k=1; knorm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward transform
12 | * (bt) will multiply the input sequence by norm_factor.
13 | */
14 | public double norm_factor;
15 | protected double wavetable[];
16 | protected int ndim;
17 |
18 | /**
19 | * Construct a wavenumber table with size n.
20 | * The sequences with the same size can share a wavenumber table. The prime
21 | * factorization of n together with a tabulation of the trigonometric functions
22 | * are computed and stored.
23 | *
24 | * @param n the size of a real data sequence. When n is a multiplication of small
25 | * numbers(4, 2, 3, 5), this FFT transform is very efficient.
26 | */
27 | public RealDoubleFFT_Even_Odd(int n)
28 | {
29 | ndim = n;
30 | norm_factor = 4*n;
31 | if(wavetable == null || wavetable.length !=(3*ndim+15))
32 | {
33 | wavetable = new double[3*ndim + 15];
34 | }
35 | cosqi(ndim, wavetable);
36 | }
37 |
38 | /**
39 | * Forward FFT transform of quarter wave data. It computes the coeffients in
40 | * cosine series representation with only odd wave numbers.
41 | *
42 | * @param x an array which contains the sequence to be transformed. After FFT,
43 | * x contains the transform coeffients.
44 | */
45 | public void ft(double x[])
46 | {
47 | cosqf(ndim, x, wavetable);
48 | }
49 |
50 | /**
51 | * Backward FFT transform of quarter wave data. It is the unnormalized inverse transform
52 | * of ft.
53 | *
54 | * @param x an array which contains the sequence to be tranformed. After FFT, x contains
55 | * the transform coeffients.
56 | */
57 | public void bt(double x[])
58 | {
59 | cosqb(ndim, x, wavetable);
60 | }
61 |
62 | /*----------------------------------------------------------------------
63 | cosqf1: further processing of forward cos-FFT with odd wave numbers.
64 | ----------------------------------------------------------------------*/
65 | void cosqf1(int n, double x[], double wtable[])
66 | {
67 | int modn, i, k;
68 | int kc, np2, ns2;
69 | double xim1;
70 |
71 | ns2=(n+1)/ 2;
72 | np2=n+2;
73 | for(k=1; k=l1)
588 | {
589 | for(j=1; j=l1)
672 | {
673 | for(k=0; k=l1)
703 | {
704 | for(j=1; j=l1)
761 | {
762 | for(k=0; k=l1)
794 | {
795 | for(j=1; j=l1)
880 | {
881 | for(j=1; jnorm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward
12 | * transform (bt) will multiply the input sequence by norm_factor.
13 | */
14 | public double norm_factor;
15 | private double wavetable[];
16 | private int ndim;
17 |
18 |
19 | /**
20 | * Construct a wavenumber table with size n.
21 | * The sequences with the same size can share a wavenumber table. The prime
22 | * factorization of n together with a tabulation of the trigonometric functions
23 | * are computed and stored.
24 | *
25 | * @param n the size of a real data sequence. When (n+1) is a multiplication of small
26 | * numbers (4, 2, 3, 5), this FFT transform is very efficient.
27 | */
28 | public RealDoubleFFT_Odd(int n)
29 | {
30 | ndim = n;
31 | norm_factor = 2*(n+1);
32 | int wtable_length = 2*ndim + ndim/2 + 3 + 15;
33 | if(wavetable == null || wavetable.length != wtable_length)
34 | {
35 | wavetable = new double[wtable_length];
36 | }
37 | sinti(ndim, wavetable);
38 | }
39 | /**
40 | * Forward sine FFT transform. It computes the discrete sine transform of
41 | * an odd sequence.
42 | *
43 | * @param x an array which contains the sequence to be transformed. After FFT,
44 | * x contains the transform coeffients.
45 | */
46 | public void ft(double x[])
47 | {
48 | sint(ndim, x, wavetable);
49 | }
50 | /**
51 | * Backward sine FFT transform. It is the unnormalized inverse transform of ft.
52 | *
53 | * @param x an array which contains the sequence to be transformed. After FFT,
54 | * x contains the transform coeffients.
55 | */
56 | public void bt(double x[])
57 | {
58 | sint(ndim, x, wavetable);
59 | }
60 |
61 | /*---------------------------------------
62 | sint1: further processing of sine FFT.
63 | --------------------------------------*/
64 |
65 | void sint1(int n, double war[], double wtable[])
66 | {
67 | final double sqrt3=1.73205080756888;
68 | int modn, i, k;
69 | double xhold, t1, t2;
70 | int kc, np1, ns2;
71 | int iw1, iw2, iw3;
72 | double[] wtable_p1 = new double[2*(n+1)+15];
73 | iw1=n / 2;
74 | iw2=iw1+n+1;
75 | iw3=iw2+n+1;
76 |
77 | double[] x = new double[n+1];
78 |
79 | for(i=0; inorm_factor can be used to normalize this FFT transform. This is because
11 | * a call of forward transform (ft) followed by a call of backward transform
12 | * (bt) will multiply the input sequence by norm_factor.
13 | */
14 |
15 | /**
16 | * Construct a wavenumber table with size n.
17 | * The sequences with the same size can share a wavenumber table. The prime
18 | * factorization of n together with a tabulation of the trigonometric functions
19 | * are computed and stored.
20 | *
21 | * @param n the size of a real data sequence. When n is a multiplication of small
22 | * numbers (4, 2, 3, 5), this FFT transform is very efficient.
23 | */
24 | public RealDoubleFFT_Odd_Odd(int n)
25 | {
26 | super(n);
27 | }
28 |
29 | /**
30 | * Forward FFT transform of quarter wave data. It computes the coeffients in
31 | * sine series representation with only odd wave numbers.
32 | *
33 | * @param x an array which contains the sequence to be transformed. After FFT,
34 | * x contains the transform coeffients.
35 | */
36 | public void ft(double x[])
37 | {
38 | sinqf(ndim, x, wavetable);
39 | }
40 |
41 | /**
42 | * Backward FFT transform of quarter wave data. It is the unnormalized inverse transform
43 | * of ft.
44 | *
45 | * @param x an array which contains the sequence to be tranformed. After FFT, x contains
46 | * the transform coeffients.
47 | */
48 | public void bt(double x[])
49 | {
50 | sinqb(ndim, x, wavetable);
51 | }
52 |
53 | /*-----------------------------------------------
54 | sinqf: forward sine FFT with odd wave numbers.
55 | ----------------------------------------------*/
56 | void sinqf(int n, double x[], double wtable[])
57 | {
58 | int k;
59 | double xhold;
60 | int kc, ns2;
61 |
62 | if(n==1) return;
63 | ns2=n / 2;
64 | for(k=0; k {
71 |
72 | @Override
73 | protected Void doInBackground(Void... params) {
74 | try {
75 | int bufferSize = AudioRecord.getMinBufferSize(frequency,
76 | channelConfig, audioFormat);
77 | Log.v("bufSize", String.valueOf(bufferSize));
78 | AudioRecord audioRecord = new AudioRecord(
79 | MediaRecorder.AudioSource.MIC, frequency,
80 | channelConfig, audioFormat, bufferSize);
81 |
82 | short[] audioBuffer = new short[blockSize];
83 | double[] toTrans = new double[blockSize];
84 |
85 | audioRecord.startRecording();
86 |
87 | while (started) {
88 | int result = audioRecord.read(audioBuffer, 0, blockSize);
89 |
90 | for (int i = 0; i < blockSize && i < result; i++) {
91 | toTrans[i] = (double) audioBuffer[i] / Short.MAX_VALUE;
92 | }
93 | fftTrans.ft(toTrans);
94 | publishProgress(toTrans);
95 | }
96 | audioRecord.stop();
97 | } catch (Throwable t) {
98 | Log.e("AudioRecord", "Recording failed");
99 | }
100 | return null;
101 | }
102 |
103 | @Override
104 | protected void onProgressUpdate(double[]... values) {
105 |
106 | canvas.drawColor(Color.BLACK);
107 | for (int i = 0; i < values[0].length; i++) {
108 | int x = i;
109 | int downy = (int) (100 - (values[0][i] * 10));
110 | int upy = 100;
111 |
112 | canvas.drawLine(x, downy, x, upy, paint);
113 | }
114 | imgView.invalidate();
115 | }
116 | }
117 |
118 | @Override
119 | public boolean onCreateOptionsMenu(Menu menu) {
120 | // Inflate the menu; this adds items to the action bar if it is present.
121 | getMenuInflater().inflate(R.menu.main, menu);
122 | return true;
123 | }
124 |
125 | }
126 |
--------------------------------------------------------------------------------