Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

can i unpack audio inside the code module?

DSP related issues, mathematics, processing and techniques

can i unpack audio inside the code module?

Postby Freddymusic » Mon Jan 05, 2015 8:43 pm

So i have 2 stereo audio in one pack. When the sounds go into the code module, i want to "unpack" in the code module becouse i want to merge the filter code with the follower code. I use a lot of pack-unpack module now and maybe i could save some cpu power in my vocoder. I am not FS user i work with SM. Is it possible with the FS? THX :)
freddymusic.hu
User avatar
Freddymusic
 
Posts: 30
Joined: Mon Apr 16, 2007 4:57 pm

Re: can i unpack audio inside the code module?

Postby KG_is_back » Mon Jan 05, 2015 9:25 pm

No, it is not possible to separate/shuffle channels inside code module. That is true both for SM and FS, since the code component wasn't updated since then.

It is however possible in assembler and there are several ways to do that, depending on what you are looking for. Also some ways are much cheaper on CPU than the pack/unpack primitives. Problem is, Code is harder to look at/debug in assembler (even crashes are very likely when you are not careful).

I can provide more specific answers, if you specify more precisely what you are trying to do exactly.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: can i unpack audio inside the code module?

Postby Freddymusic » Tue Jan 06, 2015 1:21 am

this is a vocoder example. Maybe i can replace the pack/unpack module with an ASM, but if i want to merge the filter with the follower isn't possible for me just in asm. The merge isn't important for me, but i think if i replace the pack/ unpack modules it will be faster.
http://www.tbklub.hu/bitsonic/capture.jpg
freddymusic.hu
User avatar
Freddymusic
 
Posts: 30
Joined: Mon Apr 16, 2007 4:57 pm

Re: can i unpack audio inside the code module?

Postby KG_is_back » Tue Jan 06, 2015 2:04 am

Indeed situation like this can be significantly improved using ASM instead of pack/unpack.

There is an instruction called "shufps". It has the ability to shuffle SSE channels in any way desired.

this ASM code should do the trick:
Code: Select all
streamin in1;
streamin in2;
streamout out1;
streamout out2;

movaps xmm0,in1;
movaps xmm1,xmm0;
movaps xmm2,in2;
shufps xmm0,xmm2,68;
shufps xmm1,xmm2,238;
movaps out1,xmm0;
movaps out2,xmm1;


As you can see, the code has two inputs. channels of the second input are being put into third and fourth channels of the outputs respectively. This way, you can make use of all 4 channels in your envelope follower, effectively reducing its size to half.

If you are interested in optimizing your code within schematics (possibly even by using assembler) you may have a look at few articles at http://flowstone.guru/. There is also a download section with dozens of useful Flowstone schematics and also links to some of the best osm schematics.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: can i unpack audio inside the code module?

Postby Freddymusic » Tue Jan 06, 2015 10:10 am

Thank you Kirk, i hope i can make it in an optimized asm.
freddymusic.hu
User avatar
Freddymusic
 
Posts: 30
Joined: Mon Apr 16, 2007 4:57 pm

Re: can i unpack audio inside the code module?

Postby KG_is_back » Tue Jan 06, 2015 3:26 pm

From what I can see from the image, the code is close to optimal already. With assembler you may save some unnecessary reading from/to memory by removing several intermediate variables. I still have the synthmaker free version, so possibly I can help you a little more.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia


Return to DSP

Who is online

Users browsing this forum: No registered users and 56 guests