0

I'm new to Android threads and I'm trying to figure out which is the correct/best approach to record and estimate pitch in a separate thread in Android.

I need to

  • start recording/estimating from the UI thread
  • receive the pitch from the background thread to the UI thread
  • stop recording/estimating from the UI thread

Can you help me, please?

Kaushik NP
  • 6,733
  • 9
  • 31
  • 60
Adriano Di Giovanni
  • 1,445
  • 1
  • 16
  • 34

1 Answers1

0

First, I recommend you to take a look on the AsyncTask's documentation to know how to do something in an other thread detached of the UI thread.

Then, see theisenp's answer to record something with the microphone.

Note: Remember to check if you need any kind of permission in your manifest, for example:

<uses-permission android:name="android.permission.RECORD_AUDIO" ></uses-permission>

Hope it helps you!

Community
  • 1
  • 1
Loic P.
  • 691
  • 6
  • 18
  • I read docs for AsyncTask, Handler, Thread, Executor, Service and related classes. I also read a lot of stuff on the web. Above all, this [article](http://techtej.blogspot.it/2011/03/android-thread-constructspart-4.html) helped me understanding differences between the various approaches to multithreading. I'd like to know from you how'd you implement a pitch detector using AudioRecord in a separate thread. – Adriano Di Giovanni Feb 20 '17 at 17:47