pre-implemented FFT routine

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

pre-implemented FFT routine

Post by mrn »

yea,FFT is used everywhere, so I thought..
(i know, whenever i start a thread with these words somebody locks it, so....)
.. i thought it would be really smart to have fft precompiled
and offered as a luaplayer routine, in the same way as the battery or control functions are implemented.

fft (real, imag, N, inverse)

this would let us have many-many audio apps,
not to mention, if we would have pre-compiled DCT ...
u know what i am spaking about
h,
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I used FFT for my speech project many years ago. I knew about it. It required a huge amount of calculation to perform a relative large range of sound samples. I don't know if PSP could handle that much amount of calculation, sines and cosines and all. A table of sines and cosines helps to reduce the calculation but enough memory in PSP?
Geo Massar
Retired Engineer
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

No. Do not worry. for a 256, 512, or even 1024 -point FFT (as normally used in audio processing) you need to store only a piece of a cosine wave in a vector (which is of a length of the FFT-size). So, only some hundreds of Bytes. Then, you just pick up the numbers by downsampling this cosine wave by 2,4,8,16,etc when doing the butterfly multiplications...

Here is a really simple and fast FFT routine written in C.
http://www.jjj.de/fft/int_fft.c

I used it some yrs ago, simple to implement..
Hope, it is not a big problem to put it into our Luaplayer.
mrn
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

If it were pre-implemented for Lua Player, it would be handy for speech translation, text-to-speech (easy) for the blind and speech-to-text (not so easy) for the deaf.

I sure hope 32MB RAM is big enough for the task.
Geo Massar
Retired Engineer
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

Most games and programs won't need it. I think the best idea would be to enhance Lua Player to load self-made PRX modules. A good place for it would be System/Library and write access from Lua Player scripts should be intercepted, to ensure that no script can create and execute unsafe code, which could damage the PSP. Then it is up to the user to manual copy libraries to the Library folder from sources she trust and some useful libs could be included in the standard Lua Player distribution and loaded on demand.
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

This library idea sounds great, I can provide some good fixed-point /floating-point FFT/DCT routines...
but unfortunately i do not have the time to learn how to create libraries for Luaplayer. Is there sbody willing to do that?

one of the fastest floating-point versions:
http://www.fftw.org/
..and this one was a fixed-point FFT:
http://www.jjj.de/fft/int_fft.c
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

Most games and programs won't need it.
What I have been thinkin adout since the beginning is to have a FULL-FEATURED VIRTUAL OS
like OSi or PSPWindows. The reason to have everything inside is that exiting luaplayer
and loading a PdfReader takes lots of time, than imagine searching sthng in a dictianary,
and listening to a song later... impossible without having EVERYTHING INSINDE.

If beside the Lua-games there would be a
- sound recorder,
-Mp3-player,
-video player,
-notepad,
-dictionary,
-calendar
-file browser (like mc or vc .)
-offline browser...

inside this -virtual os- , Lua could become the MOST POPULAR THING for PSP.
But this start-exit-start-exit thing is slow and people get frustrated!
THIS IS WHY I wanted Mic input, FFT, DCT, etcetcetc...

It is our chance to make Lua as it could be before...
(I am already working on a really fast end easy-to-use text editor
and am shure that there would be enough people interested in porting
multimedia apps into Lua. Just check out the num of visitors of this thread.)

if you do not agree with me, pls try to explain why instead of locking this trhread. thats'it..
Last edited by mrn on Sun Dec 04, 2005 9:38 pm, edited 1 time in total.
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

Sorry, the following is mostly off-topic. Skip if you're only interesting in fft.

Indeed, the idea of dynamically loading relevant libraries have sprung to my mind several times, I even worked out a great interface for it in my head and then forgot it. (as in interface design and architecture, not code) It allows extensibility without being slow (as in being interpreted). I'm right with you there, Shine.

Mrn, I didn't lock your thread because I disagreed with your ideas, I locked your thread because you were asking questions and bringing forth ideas that had already been debated and dismissed several times all over the forums.

I do believe that most of us have at least played with the idea of a full-fledged application environment within LuaPlayer. I know I have: that's my original vision with Lowser (tho' Lowser's a ridiculously simple (and badly written) app at the moment). Lowser and UIKit are supposed to bring an easy multitasked GUI and event toolkit (if I ever have the time to code it, that is).
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

(tho' Lowser's a ridiculously simple (and badly written) app at the moment)
Can not we just take the code of PSPWin, replace the icons, sound etc.
with some Crystal-like iconset, more unique sounds, and put everything what we have inside?

The author of PSPWin no more works on it, he already switched to PSPda.

But I more believe in a Lua based Virtual OS, than in a precompiled package like PSPPda,
thanks to its modularity, easy-to-modification, and.. since it is really
interesting to add your own apps to an OS even if you are a beginner .)

The locked forum ... Let's forget it .)
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

hey, i just implemented fft in lua.
For N= 256 we need 40msec, which means 25 FFTs per second.
Quite slow for real-time audio processing.

Just a note: for speech recognition we need to process ~50 frames per sec,
where at least one FFT per frame (of course, plus a lot of other operations) is required. mrn
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

Most games and programs won't need it.
2D games maybe not. But fast 3D rendering: yess.
Check this out:
http://ieeexplore.ieee.org/xpl/abs_free ... 343844&a_i

images in the middle of this page:
http://www.viskom.oeaw.ac.at/~luis/Weru ... search.htm
m.
Post Reply