Click here to Skip to main content
15,881,380 members
Home / Discussions / Android
   

Android

 
AnswerRe: Method not returning expected value Pin
Davidw196924-Feb-17 16:52
Davidw196924-Feb-17 16:52 
AnswerRe: Method not returning expected value Pin
Richard MacCutchan23-Feb-17 3:58
mveRichard MacCutchan23-Feb-17 3:58 
GeneralRe: Method not returning expected value Pin
Davidw196924-Feb-17 16:53
Davidw196924-Feb-17 16:53 
QuestionAndroid and C# Web Services Pin
Member 1155786814-Feb-17 22:41
Member 1155786814-Feb-17 22:41 
SuggestionRe: Android and C# Web Services Pin
Richard Deeming15-Feb-17 2:39
mveRichard Deeming15-Feb-17 2:39 
QuestionAndroid: High Pass filter Pin
Himanshu Bhutani13-Feb-17 1:36
Himanshu Bhutani13-Feb-17 1:36 
QuestionRe: Android: High Pass filter Pin
David Crow13-Feb-17 2:41
David Crow13-Feb-17 2:41 
AnswerRe: Android: High Pass filter Pin
Nick_314159265415-Apr-17 3:55
Nick_314159265415-Apr-17 3:55 
I suggest that you add logging to your application using the default android log utility. This will make your investigation much easier. Using a debugger - as somebody else suggested - is a very valid approach, but where you are looking at real-time effects (which may or may not be relevant) there's no substitute for logging. You can do this as follows:

Add this import to your MainActivity and Filter classes:
Java
import android.util.Log;

Then add this static variable as a class variable to each:
Java
private static final String TAG = "Himanshu";


Now add some logging like this:

Java
while ((read = in.read(buff)) > 0) {
    Log.i(TAG, "Raw audio: " + read);    // *** Nick's suggested log point. ***               
    out.write(buff, 0, read);
}
out.flush();
byte[] audioBytes = out.toByteArray();
final FloatBuffer fb = ByteBuffer.wrap(audioBytes).asFloatBuffer();
final float[] dst = new float[fb.capacity()];
fb.get(dst);

Filter filter = new Filter(15000,44100, Filter.PassType.Highpass,1);
for (int i = 0; i <dst.length; i++) {
    filter.Update(dst[i]);
    dst[i] = filter.getValue();
    Log.i(TAG, "Filtered audio: " + dst[i]);   // *** Nick's suggested log point. ***
}

etc etc..

In order to view your log you need to use adb. If you work in a windows environment you'd do this in a DOS command shell:
adb logcat Himanshu:* *:s -v time

Issue the above logcat command BEFORE starting your app and triggering the audio record & playback. This command is saying: Capture all log messages (.i, .d, .v, .w, .e etc.. i.e. of category: Information, Debug, Verbose, Warning and Error) and do NOT capture any other log messages, show log timestamps.

I didn't check all of the places in your code where that would also shed light on the problem. It's your code and I'm sure that you can quickly identify these places.

Actually I would have done a couple of other things also before going quite so far as you have:

1. Confirm that you can play audio samples, do this by creating a simple square wave, storing it in memory and squirting it out. You can use PCM at 16 kSamples/sec and a ~200 Hz waveform.

2. Capture recorded audio to a file and check that this is valid audio.

One other thing to mention is that you are using the AMR Narrow Band voice codec. This is not a generic audio encoding algorithm. AMR (NB) has been highly optimised for voice telephony, and as is the case for such codecs. This may be important because these codecs do not handle tones at all well and music isn't very well supported. I'm not sure what kind of audio you are dealing with. You may want to consider an alternative audio encoding format such as MP3 or plain/differential PCM.
QuestionAndroid Day of Week Calculator Pin
Pavlex49-Feb-17 9:50
Pavlex49-Feb-17 9:50 
AnswerRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:02
David Crow9-Feb-17 10:02 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:09
Pavlex49-Feb-17 10:09 
GeneralRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:12
David Crow9-Feb-17 10:12 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:15
Pavlex49-Feb-17 10:15 
SuggestionRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:23
David Crow9-Feb-17 10:23 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:32
Pavlex49-Feb-17 10:32 
GeneralRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:36
David Crow9-Feb-17 10:36 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:38
Pavlex49-Feb-17 10:38 
GeneralRe: Android Day of Week Calculator Pin
Richard MacCutchan9-Feb-17 21:07
mveRichard MacCutchan9-Feb-17 21:07 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 21:39
Pavlex49-Feb-17 21:39 
GeneralRe: Android Day of Week Calculator Pin
Richard MacCutchan9-Feb-17 22:20
mveRichard MacCutchan9-Feb-17 22:20 
GeneralRe: Android Day of Week Calculator Pin
David Crow10-Feb-17 2:08
David Crow10-Feb-17 2:08 
GeneralRe: Android Day of Week Calculator Pin
Richard MacCutchan10-Feb-17 2:46
mveRichard MacCutchan10-Feb-17 2:46 
GeneralMobile and o/s application development Pin
JimmiJames337-Feb-17 5:42
professionalJimmiJames337-Feb-17 5:42 
QuestionRe: Mobile and o/s application development Pin
David Crow7-Feb-17 6:15
David Crow7-Feb-17 6:15 
QuestionAndroid Popup Window Pin
Pavlex42-Feb-17 8:09
Pavlex42-Feb-17 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.