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
stream routing matrix in dsp code!?
28 posts
• Page 1 of 3 • 1, 2, 3
stream routing matrix in dsp code!?
hi all, i would need some help with this stream routing matrix written in FS dsp code,
as you know i did a cablepatcher, but its problem is that it recompiles with every patching process which results in audioclicks and dropouts, sure you could trigger a clear audio for a short time everytime the wiring changes, but this still would have audio dropouts (just without crackles and noises) when changing the wiring...
so i decided to work on a dsp code based routing matrix to avoid using busses and recompiling which would allow you to rewire while playing sound..
best way way to do this? maybe some better solutions in assembler using loops or jmpz? or using the new mem features..
as you know i did a cablepatcher, but its problem is that it recompiles with every patching process which results in audioclicks and dropouts, sure you could trigger a clear audio for a short time everytime the wiring changes, but this still would have audio dropouts (just without crackles and noises) when changing the wiring...
so i decided to work on a dsp code based routing matrix to avoid using busses and recompiling which would allow you to rewire while playing sound..
best way way to do this? maybe some better solutions in assembler using loops or jmpz? or using the new mem features..
Last edited by Nubeat7 on Sun Aug 02, 2015 6:43 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
I think what you are trying to do is not that hard at all. It's like using few dozens of "multiply" primitive (the same thing done in code can be done with a combination of green stuff and multipliers and wireless nodes). Maybe it would save some CPU (blue comparator vs blue multiplier), but hard to say. KG wrote about these cycles per operation type?
But... Using the code/asm, you could use hop, depending on how fast the reconnection should be. ASM would give you the advantage of switching between channels internally (in hoped version as well).
The best for you would be to have dynamic amount of inputs/outputs, depending on how many you would like to use. But this reminds me, that KG posted somewhere how to disable ASM processing prior to wire when wire is not used; it was suposed to be similar to selectors, just without the recompiling part on schematic side.
But... Using the code/asm, you could use hop, depending on how fast the reconnection should be. ASM would give you the advantage of switching between channels internally (in hoped version as well).
The best for you would be to have dynamic amount of inputs/outputs, depending on how many you would like to use. But this reminds me, that KG posted somewhere how to disable ASM processing prior to wire when wire is not used; it was suposed to be similar to selectors, just without the recompiling part on schematic side.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stream routing matrix in dsp code!?
i don't think that you want to use multipliers when you have 20 sources, 30 targets and 50 connections,
the multiplexers i think are pretty cheap (also if you have 50 with 30 outputs??), but not sure about the sources array?
anyway i did some optimizing on the array assign and reading (thx KG for your ASM optimization tutorial), i think the reading also could be hopped,
while doing this i got the idea to use the mem in for the source connection inputs after these would be an array of int values any way but after feeding it into a mem they are float values and would need to get converted to integers..
the multiplexers i think are pretty cheap (also if you have 50 with 30 outputs??), but not sure about the sources array?
anyway i did some optimizing on the array assign and reading (thx KG for your ASM optimization tutorial), i think the reading also could be hopped,
while doing this i got the idea to use the mem in for the source connection inputs after these would be an array of int values any way but after feeding it into a mem they are float values and would need to get converted to integers..
Last edited by Nubeat7 on Sun Aug 02, 2015 6:44 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
1.6% per sum of 100 actively working multipliers (i5 2.6gHz) in this design.
Mono4 could be maybe faster.
Mono4 could be maybe faster.
- Attachments
-
- test.fsm
- (1.86 KiB) Downloaded 1321 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stream routing matrix in dsp code!?
But maybe you are right. Test2 consumes 100% (as expected).
Selector prevents crashing (in earlier FS versions). Sound on -> selector on -> selector off -> sound off. This solution (via delay) saved many of my SM projects in the past.
Selector prevents crashing (in earlier FS versions). Sound on -> selector on -> selector off -> sound off. This solution (via delay) saved many of my SM projects in the past.
- Attachments
-
- test2.fsm
- (5.86 KiB) Downloaded 1272 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stream routing matrix in dsp code!?
ok i've found a way to convert the index mem to integer when reading it, i think thats the fastest way to do it.
just one question, would there be maybe a faster or better way to directly create a index array which already stores the indexes as integers? what i mean is that there is still the conversion from the memin array values (floats) with the fistp opcode..
atm i use the "int to mem" primitive but maybe i could do this in assambler too in some faster way as the primitive does it and also have the values already as integers?
i also still don't know if the whole idea is really the fastest way?
any suggestion would be great.
just one question, would there be maybe a faster or better way to directly create a index array which already stores the indexes as integers? what i mean is that there is still the conversion from the memin array values (floats) with the fistp opcode..
atm i use the "int to mem" primitive but maybe i could do this in assambler too in some faster way as the primitive does it and also have the values already as integers?
i also still don't know if the whole idea is really the fastest way?
any suggestion would be great.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
Nubeat7 wrote:atm i use the "int to mem" primitive but maybe i could do this in assambler too in some faster way as the primitive does it and also have the values already as integers?
I have module that dirrectly sotrs integers into mem (the values in the mem are 32bit integers instead of 32bit floats).
It is in the Clock Core at FS guru.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: stream routing matrix in dsp code!?
thanks KG, got it, i used this now:
its no conversion needed anymore just the movaps..
is this the right way or is there a shorter way to just assign Idx[0] already in the first read array part?
- Code: Select all
push eax;mov eax,I0[0];shl eax,4;movaps xmm0,c[eax];pop eax;
movaps Idx,xmm0;
push eax;mov eax,Idx[0];shl eax,4;movaps xmm0,s[eax];pop eax;
movaps sco0,xmm0;
its no conversion needed anymore just the movaps..
is this the right way or is there a shorter way to just assign Idx[0] already in the first read array part?
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: stream routing matrix in dsp code!?
Nubeat7 wrote:thanks KG, got it, i used this now:
- Code: Select all
push eax;mov eax,I0[0];shl eax,4;movaps xmm0,c[eax];pop eax;
movaps Idx,xmm0;
push eax;mov eax,Idx[0];shl eax,4;movaps xmm0,s[eax];pop eax;
movaps sco0,xmm0;
its no conversion needed anymore just the movaps..
is this the right way or is there a shorter way to just assign Idx[0] already in the first read array part?
This is the fastest way. Only thing you can improve is to delete unneeded pops and pushes. The pop in the first part and push in the second part are not needed. Most likely push and pop are not needed at all - you need to have it there only if you need the previous value of eax later in the code.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: stream routing matrix in dsp code!?
thank you KG for having a look at it, also thanks for your great tutorial on asm, this helped a lot
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
28 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 25 guests