You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old Guitar Tuner in Python - 2007-11-29, 16:41

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
I need a free guitar tuner for my 6680, but looks like none of the existing ones is compatible.
So I'd like to write it by myself.

I collected some documentation with google, so I know that I need to perform a Fast Fourier Transformation on the captured sound; being pys60 not able to process real-time microphone input, I'll have to record small chunks of sound to WAV file and analyze them.

I found a python example, but I can't figure out how FFT fucntion works.

I also found that probably pymedia or numpy or numarray modules would be suitable for this task, but I can't understand if they are available for pys60. Any idea?

I guess it should be enough to pass to the FFT function above just a simple array containing all raw samples contained in the WAV file, putting to "0" the imaginary part.... Is this correct?!?

Any help would be appreciated...
Reply With Quote

#2 Old Re: Guitar Tuner in Python - 2007-11-29, 22:46

Join Date: Dec 2006
Posts: 2,094
Sorcery-ltd's Avatar
Sorcery-ltd
Offline
Forum Nokia Champion
I haven't had time to get into python programming yet so I can't help with the module availability.

However, FFTs I can help with. That must really be the slowest FFT in the world, even without having to run it in Python. You should just be able to pass it the raw sample data though and the algorithm accepts real numbers (note, this version almost certainly won't work on integers properly, fractional parts will be used in the calculations, not sure how Python handles that).

That transforms your data from the time domain to the frequency domain. After that the sample with the greatest magnitude should correspond to the frequecy of the note you are playing - working out what that frequency is will be slightly less easy I suspect.

I had a quick google for guitar tuners (I'd quite like one too) and assuming it's still available this one:
http://www.handango.com/ampp/store/P...oductId=199274
Is only $6.29 and supports the 6680. That's nearly free. Particularly compared to the time it would take you to develop it to this level.

While I'm all for Python and rapid prototyping I think you might find the delays involved in trying to do the FFT like that make the application a bit less usable than you'd like.

Sorcery
Reply With Quote

#3 Old Re: Guitar Tuner in Python - 2007-11-29, 22:54

Join Date: Dec 2006
Posts: 2,094
Sorcery-ltd's Avatar
Sorcery-ltd
Offline
Forum Nokia Champion
P.S. If you do still want to go down the free open source tuner route I think an FFT extension module for Python could be really useful. If no-one else does one I might make that my next hobby project... I'll probably have time before the end of next year at least! If someone else wants to do it first I'd be happy to help with debugging.
Reply With Quote

#4 Old Re: Guitar Tuner in Python - 2007-11-30, 11:58

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
Quote:
Originally Posted by Sorcery-ltd View Post
I haven't had time to get into python programming yet so I can't help with the module availability.

However, FFTs I can help with. That must really be the slowest FFT in the world, even without having to run it in Python. You should just be able to pass it the raw sample data though and the algorithm accepts real numbers (note, this version almost certainly won't work on integers properly, fractional parts will be used in the calculations, not sure how Python handles that).

That transforms your data from the time domain to the frequency domain. After that the sample with the greatest magnitude should correspond to the frequecy of the note you are playing - working out what that frequency is will be slightly less easy I suspect.
Sorry, I can't understand: are you talking about you writing a python module which implements FFT? Or you already did? Or you just wrote the algorithm in another language? Or you just THOUGHT the algorithm?!?
Ah, wait... maybe you are talking about the source I posted??
In that case... maybe you can explain better how I should use that function?

Quote:
I had a quick google for guitar tuners (I'd quite like one too) and assuming it's still available this one:
http://www.handango.com/ampp/store/P...oductId=199274
Is only $6.29 and supports the 6680. That's nearly free. Particularly compared to the time it would take you to develop it to this level.

While I'm all for Python and rapid prototyping I think you might find the delays involved in trying to do the FFT like that make the application a bit less usable than you'd like.

Sorcery
Cool finding... but I think it would be more interesting to use my need for a guitar tuner to learn python programming.

Quote:
Originally Posted by Sorcery-ltd View Post
P.S. If you do still want to go down the free open source tuner route I think an FFT extension module for Python could be really useful. If no-one else does one I might make that my next hobby project... I'll probably have time before the end of next year at least! If someone else wants to do it first I'd be happy to help with debugging.
Don't forget not to reinvent the wheel (or... well, just reinvent it if you like, I know amateur programmers usually like reinventing algorithms just to enjoy programming ): numarray, numpy, scipy modules already exist and are opensource...
Reply With Quote

#5 Old Re: Guitar Tuner in Python - 2007-11-30, 12:13

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
@cassioli:

You should implement FFT in C++ for making a fast python extension module !
There's a very large choice of source code on FFT ...

BR
Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#6 Old Re: Guitar Tuner in Python - 2007-11-30, 14:23

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
Quote:
Originally Posted by cyke64 View Post
@cassioli:

You should implement FFT in C++ for making a fast python extension module !
There's a very large choice of source code on FFT ...

BR
Cyke64
I don't know c++, that's why I'm looking for python modules...
Anyway I guess I do NOT need such a fast algorithm: for guitar tuning, analyzing a sample of just 1 second or 2 sholuld be enough.
Reply With Quote

#7 Old Re: Guitar Tuner in Python - 2007-11-30, 14:46

Join Date: Dec 2006
Posts: 2,094
Sorcery-ltd's Avatar
Sorcery-ltd
Offline
Forum Nokia Champion
Hi,

Quote:
Ah, wait... maybe you are talking about the source I posted??
Yes, that was it, sorry for the confusion. What you posted was a beautifully simple but extremely inefficient implementation of the FFT algorithm. It was also using real numbers rather than fixed point (what you actually want is a Discrete Fourier Transform or DFT) which is even slower since they aren't supported natively on ARM. I'm not saying don't use that source, just be aware that it will be very slow, even for a short sample I'd guess!

Quote:
You should implement FFT in C++ for making a fast python extension module !
This is what I was suggesting I'd do for my next project (if I ever find some time). In fact a signal processing module would be quite good I think. I would only plan to port some open source math library code to Symbian and put some Python wrappers (bindings?) around it.

Then you could just have functions to get the current sound frequency in Python for guitar tuner and all the audio stuff could be done in C++ in real time.

Sorcery
Reply With Quote

#8 Old Re: Guitar Tuner in Python - 2007-11-30, 16:27

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Have you tried Musician?

I quickly found a link at http://www.allaboutsymbian.com/softw...m/Musician.php. I'm not sure if this is the author webpage.


LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#9 Old Re: Guitar Tuner in Python - 2007-11-30, 16:53

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by lfd View Post
Have you tried Musician?

I quickly found a link at http://www.allaboutsymbian.com/softw...m/Musician.php. I'm not sure if this is the author webpage.


LFD
It's not really the same thing that Casioli want to do
He want a real time sampler what he play with his instrument so he need a FFT !
The software you link is a very simple sound emitter of fixed freq.

Read the entire thread before commenting

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#10 Old Re: Guitar Tuner in Python - 2007-11-30, 17:51

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Hello

So It means a new module for real time tunning of Guitar!
Great! Waiting

Best Regards
croozeus
Last edited by croozeus : 2007-12-02 at 15:26. Reason: Corrected: playing to tunning :-)
Reply With Quote

#11 Old Re: Guitar Tuner in Python - 2007-11-30, 21:51

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
Quote:
Originally Posted by croozeus View Post
Hello

So It means a new module for real time playing of Guitar!
Great! Waiting

Best Regards
croozeus
for playing?!? No! For TUNING!

lfd, a program like that one is as simple that... I already wrote it, in OPL, for UIQ. But it is useless for me, I'm not able to compare guitar sounds to phone-generated sounds. I thought about making the phone play a pre-recorded guitar (tuned ) sound... but I never implementd it.

Having a REAL tuner would be much better!
Reply With Quote

#12 Old Re: Guitar Tuner in Python - 2008-02-02, 01:06

Join Date: Feb 2008
Posts: 1
alfem
Offline
Registered User
Hi !

I'm really interested in realtime pitch identification, but not for a guitar tuner.

I'd like to develop a voice pitch mouse controller, for disabled people.

Unfortunately, I haven't found something useful (python related)
Reply With Quote

#13 Old Re: Guitar Tuner in Python - 2008-02-02, 12:20

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
thanks for giving me a new clue to do a google search!

So I found tcSnack python module, which allows pitch detection!
http://www.speech.kth.se/snack/man/s...ython-man.html

But I couldnt find a pys60 port....
Reply With Quote

#14 Old Re: Guitar Tuner in Python - 2008-09-29, 18:00

Join Date: Jul 2008
Posts: 10
z22
Offline
Registered User
I am developing a strobe tuner emulation using PyS60 and a Python extension for audio steaming, FFT, and calculating the phase for the strobe display. Right now its working except for pitch detection. Once everything is cleaned up I will post the sources. Anyway, it looks like this:
http://img87.imageshack.us/img87/279...hot0001ec5.png
Reply With Quote

#15 Old Re: Guitar Tuner in Python - 2008-09-29, 19:17

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
cool.
I stay tuned.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help installing Python libraries on S60 ericroijen Python 11 2009-07-18 11:43
Could we have a Guitar Tuner? resolectric General Discussion 12 2008-10-23 22:34
[announce] PyUIQ. Python for UIQ 2.1 and 3.x OscarBernabeu Python 35 2008-01-17 10:12
[announce] the first Mobile Python book is now available ! cyke64 Python 1 2008-01-08 10:58
[announce] Mobile Python book soon in Sept 2007 ! cyke64 Python 11 2007-10-03 20:46

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia