IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Android process audio for guitar tuner
johnmarson
post Mar 28 2013, 11:38
Post #1





Group: Members
Posts: 1
Joined: 28-March 13
Member No.: 107428



Just wondering what is the best way to process audio so I can output what note is being read in. I am doing a guitar tuner for a college assignment and I am new to Android development. I have seen the Android example on recording sounds on from the Google API, but I was wondering where to go from there? I understand I have to do a Furior Transform or something to get the frequency, just wondering if anybody has any advice on how to do this. Once we can get the correct frequency displayed on screen we have a bulk of our project done. Thanks for any help.
Go to the top of the page
+Quote Post
probedb
post Mar 28 2013, 17:28
Post #2





Group: Members
Posts: 1244
Joined: 6-September 04
Member No.: 16817



Just go do some research, I had to use a thing called a library to do essentially what you're doing smile.gif My dissertation was taking a recording of a bass guitar (monophonic only) and turning it into a musical score.

The hard work of your project (from what I understand from what you've written) is working out what frequency is being played so you're essentially asking us to do the assignment.
Go to the top of the page
+Quote Post
DonP
post Mar 28 2013, 18:42
Post #3





Group: Members (Donating)
Posts: 1471
Joined: 11-February 03
From: Vermont
Member No.: 4955



THere's a tuner plugin for rockbox, which I'm guessing is open source.
Go to the top of the page
+Quote Post
saratoga
post Mar 28 2013, 22:28
Post #4





Group: Members
Posts: 5000
Joined: 2-September 02
Member No.: 3264



QUOTE (johnmarson @ Mar 28 2013, 05:38) *
Just wondering what is the best way to process audio so I can output what note is being read in. I am doing a guitar tuner for a college assignment and I am new to Android development. I have seen the Android example on recording sounds on from the Google API, but I was wondering where to go from there? I understand I have to do a Furior Transform or something to get the frequency, just wondering if anybody has any advice on how to do this. Once we can get the correct frequency displayed on screen we have a bulk of our project done. Thanks for any help.



Googling 'Android FFT' brings up a 100 line block of code for computing the FFT in java on Android. You could look at that.
Go to the top of the page
+Quote Post
db1989
post Mar 28 2013, 22:48
Post #5





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



To help you on your forthcoming searches, itís a Fourier transform, not Furior. tongue.gif
Go to the top of the page
+Quote Post
Dynamic
post Mar 31 2013, 09:25
Post #6





Group: Members
Posts: 822
Joined: 17-September 06
Member No.: 35307



In addition to finding out about the frequency resolution of Fourier Transforms, you might want to look into Phase Locked Loops (PLL) and the methods used in all-electronic guitar tuners if you wish to get within '1 cent' (1/100th of a semitone = ratio 1:2^(1/1200)) of the correct pitch.
Go to the top of the page
+Quote Post
MikeT
post Aug 24 2013, 01:51
Post #7





Group: Members
Posts: 2
Joined: 21-August 13
Member No.: 109732



The most obvious solution would be to read in a buffer of data, run an FFT to get the data in the frequency domain then analyse the response. You will find peaks in the frequency response corresponding to the tones. If you're targeting Android then you may at first consider FFT implementations in Java.

If you use a buffer length that is a power of 2 (e.g. 128, 256, 512, 1024, 2048 etc) then the FFT is quite easy to implement and since it does not depend on external libraries, you will find that array index based C and C++ solutions will port very easily over to Java. Solutions that use pointers will require some modification.

Here's a link to someone who ported the example from Numerical Recipies in C to Java:
http://blog.datasingularity.com/?p=53

There are some other Java FFT ports that I have identified for you but have never used:
http://www.wikijava.org/wiki/The_Fast_Four...va_%28part_1%29
http://introcs.cs.princeton.edu/java/97data/FFT.java.html

You will find that discontinuities at the ends of the buffer will create artifacts in the frequency response, so you may want to multiply the buffer with a window function before running the FFT to reduce this problem. You can find a list of window functions at http://en.wikipedia.org/wiki/Window_function. Since your buffer will be fixed length, you can pre-compute this and store in a table the same length as your input buffer. Run over your input buffer and multiply by each value by the corresponding value in the window function table to reduce artifacts coming from the edges of the buffer.

If you find that performance is not very good in Java, you may consider a JNI call to one in ARM assembly language. page 303 of the following free book provides a high performance assembly language implementation of the FFT that will run many orders of magnitude faster than a Java version. It will take you a bit of time to set it up, so I wouldn't bother with this until you have everything working and you find that it needs to go faster.

http://read.pudn.com/downloads154/ebook/68...-and-design.pdf

If you only need to isolate a handful of frequencies then you may also consider an array of Goertzel filters or an array of IIR band-pass filters. These will run much faster than the FFT if you are only interested in a few frequencies. IIR filters are a bit more controllable than Goerzel filters which you can read about here:
http://en.wikipedia.org/wiki/Goertzel_algorithm

If you need to design an IIR filter, then you can use SciPi, SciLab or Gnu Octave, or a simpler option is to use MicroModeler DSP, which will also generate the IIR code for the filter in C which you could then port to Java:
http://www.micromodeler.com

They also have a tutorial on IIR filters here which seems very easy to understand, although I would recommend starting from their earlier tutorials if you are new to the subject:
http://www.micromodeler.com/articles/Intro...onToDSP/IIR.jsp

Hope this helps you and good luck.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st October 2014 - 08:21