Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've got an audio library for Silverlight that is in need of some acceleration on slower machines. Specifically, this library makes extensive and repeated use of the FFT transform as a part of its acoustic echo cancellation and noise reduction algorithms, and I'm wondering if it would make any sense to use the GPU for this (as described, for instance, here: http://www.inf.fu-berlin.de/lehre/SS10/SP-Par/download/fft1.pdf).

I know that Silverlight 5 provides a fairly simple port of Microsoft's XNA framework, but unfortunately, I'm a complete novice to 3D coding in general, and XNA in particular. It seems to me like it should be theoretically possible to use some combination of vertex and/or pixel shaders to work this magic, but before I go too far down this road, I wanted to get some expert opinions on a few questions:

(1) SL5's XNA implementation throws the output of its pipeline onto a single "DrawingSurface". I had been thinking that this is where I might be able to read the results of the calculations (kind of how you could use a WriteableBitmap to read the results of pixel shader calculations in SL4). But I can't figure out how I would do that: there's no "GetPixels()" method, or anything like that. In regular XNA 4.0, the VertexBuffer has a GetData() method, as do the Texture2D and Texture3D classes, but those methods are missing in the SL5 version. Does anyone know of any way to actually read the results of shader outputs? Or is the GPU a write-only device in SL5?

(2) It seems like the real problem with GPU calculations is reading the results quickly. Assuming I can solve problem #1, does anyone know whether an FFT would be amenable to this sort of solution?

(3) Silverlight 5 is limited to HLSL Level 2, which has a number of serious limitations, so far as instructions, registers, available functions, and so forth. Is it at all reasonable to expect to be able to port an FFT or some portion thereof over to this?

Thanks in advance.

share|improve this question
1  
can you describe the math operations you have to do? is it needed to be a realtime effect? can be delayed? you have to use a render target to draw your calcs, and GetData to retrieve them, are you sure that texture have no getdata? –  Blau Oct 8 '11 at 11:11
    
I'm doing realtime audio enhancement, using Google's WebRTC stack (which I've ported to C#). This includes acoustic echo cancellation, noise reduction, and automatic gain control, among others. There's a lot of floating point math involved, most of it having to do with converting the signals from the time domain to the frequency domain, which is done using a Fast Fourier Transform. By the nature of the beast, it needs to be realtime. And according to MSDN (msdn.microsoft.com/en-us/library/…), no Texture.GetData() method. –  Ken Smith Oct 8 '11 at 15:36
    
Uupps... with silverlight a Texture has no GetData... i have been looking for a workaround but no success... i recommend you to post in Shawn's post about xna and silverlight... blogs.msdn.com/b/shawnhar/archive/2011/10/05/… he may give some solution –  Blau Oct 8 '11 at 20:39
1  
This doesn't answer your question, but D3D11 has ID3DX11FFT interface, which greatly simplifies the amount of work you have to do –  bobobobo Oct 10 '11 at 23:22
    
@bobobobo - Well, you're right, that doesn't help. But it does make me jealous. If I could access that on Silverlight, it would speed up my code pretty significantly, I suspect. Oh well... –  Ken Smith Oct 10 '11 at 23:59
show 1 more comment

2 Answers 2

up vote 3 down vote accepted

According to Shawn Hargreaves (from MS), this isn't supported in Silverlight 5. His unofficial guess as to why is that (a) it would be difficult to get it working consistently across all GPU drivers, and (b) for all but a tiny class of demo-ware-style problems, it wouldn't make any sense.

Oh well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.