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
tula's DSP modules
41 posts
• Page 3 of 5 • 1, 2, 3, 4, 5
Re: tula's DSP modules
TheOm wrote:There is actually an even simpler method to get a sign mask in dsp code:
- Code: Select all
float signbit = -0;
Awesome! Thanks for sharing! I agree to Spogg: I love this topic
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Polarity Splitter
Another one of those very simple modules. The polarity splitter sends the positive and negative parts of the waveform to its own streams. This might be useful to combine different waveforms in order to use as an lfo, or something like that. I doubt that there is any application for a sound oscillator, but if you find one: please share!
- Attachments
-
- polarity_splitter.fsm
- (7.52 KiB) Downloaded 984 times
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Bit Depth Reducer
Reducing the bit depth lowers the quality of the waveform, which is wanted in effects like a bit crusher. However, it uses rndint() and this turns out to be expensive (100+ cycles per sample). If someone knows how to round fractions without that function (and without Assembler) and to be more lightweight, I'm all yours!
p.s. my ears are so bad, that I only start hearing differences from 7 to 6 bits. Everything above 7 bits sounds the same to me.
p.s. my ears are so bad, that I only start hearing differences from 7 to 6 bits. Everything above 7 bits sounds the same to me.
- Attachments
-
- bit_depth_reducer.fsm
- (41.85 KiB) Downloaded 1024 times
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: tula's DSP modules
tulamide wrote:Reducing the bit depth lowers the quality of the waveform, which is wanted in effects like a bit crusher. However, it uses rndint() and this turns out to be expensive (100+ cycles per sample). If someone knows how to round fractions without that function (and without Assembler) and to be more lightweight, I'm all yours!
p.s. my ears are so bad, that I only start hearing differences from 7 to 6 bits. Everything above 7 bits sounds the same to me.
one possibility on how to round numbers is to subtract modulo 1. This is loosely equivalent to ruby's ".floor" method.
- Code: Select all
y=x-x%1;
However, that one is also similarly expensive...
There is one way to do it but it only works for positive numbers - add and then subtract 2^23.
- Code: Select all
out=(in+8388608)-8388608;
Since 32bit float only represents number to 23 significant digits, if you add 2^23 you force it to round off everything below the decimal point. However, it only works for positive numbers - you will have to treat positive and negative numbers separately and then combine them or only round the absolute value and use bitwise trickery to transfer the sign. By a suspiciously lucky coincidence, your previous two schematics actually implement both of those methods.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: tula's DSP modules
- Code: Select all
streamin in;
streamin bits;
streamout out;
float Round = 1e07;
out = ( (in * bits) - Round + Round ) / bits;
Easy! Just subtract and add a very small value and it will be rounded. I dont really know the exact technical details of this, but its just something I learned, and it saves a ton of CPU as well. To further reduce the CPU, you can use assembler (and this is why its great), and instead of the divide function you can use the reciprocal function (which is not as exact as dividing but perfectly fine in this case), so you get 1/bits, then you multiply it with the rest of the function.
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: tula's DSP modules
Have fun!
- Attachments
-
- FastStreamBitcrusher(noASM).fsm
- (3.17 KiB) Downloaded 1074 times
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: tula's DSP modules
martinvicanek wrote:Have fun!
Very cool!
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: Bit Depth Reducer
tulamide wrote:I only start hearing differences from 7 to 6 bits. Everything above 7 bits sounds the same to me.
At 12 bits and lower I can start to hear the quantisation as a kind of background noise. Listen to the attached version on headphones and play in the bass register.
This was apparent on the old DX7 on single sine waves in the bass registers, especially as the bass decayed away. The system ran at 12 bits. On the DX7 it was made worse by multiplexing the operator (there was only one hardware operator).
Still loving this topic
Spogg
- Attachments
-
- bit_depth_reducer spogg 1.fsm
- (249.79 KiB) Downloaded 995 times
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: tula's DSP modules
martinvicanek wrote:Have fun!
I can't because I don't understand what you did there
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: tula's DSP modules
Guys, thank you all so much! It is overwhelming.
Spogg: Thanks for your (better) readout knob and Martin's ADSR (I didn't know about that one!), and I have a clue regarding Martin's solution. It is pretty much the same principle that KG laid out as second possibility. Rounding by overloading the float bits.
Martin: Impressive. CPU cycles down to approx. 22 (I have to compare them on my system, everything else wouldn't make much sense). However, Adam is very close to you!
Adam: Very nice trick! Just using the subtract/add trick, it already fell down to approx. 28 cycles. If I provide 1/bits externally and multiply, I expect your code to be on par or maybe even faster than Martin's!! Also, I learned from your code, that I can enter numbers in scientific notation. I didn't know that. Thank you!
KG: I love how detailed you explain the things. That really helps me a lot. It rings my sense of logic. I'm pretty sure that both, Adam's and Martin's solutions are somehow based on the same trick of overloading the accuracy of the float datatype.
Please don't stop providing such useful help, hints and hacks!
Spogg: Thanks for your (better) readout knob and Martin's ADSR (I didn't know about that one!), and I have a clue regarding Martin's solution. It is pretty much the same principle that KG laid out as second possibility. Rounding by overloading the float bits.
Martin: Impressive. CPU cycles down to approx. 22 (I have to compare them on my system, everything else wouldn't make much sense). However, Adam is very close to you!
Adam: Very nice trick! Just using the subtract/add trick, it already fell down to approx. 28 cycles. If I provide 1/bits externally and multiply, I expect your code to be on par or maybe even faster than Martin's!! Also, I learned from your code, that I can enter numbers in scientific notation. I didn't know that. Thank you!
KG: I love how detailed you explain the things. That really helps me a lot. It rings my sense of logic. I'm pretty sure that both, Adam's and Martin's solutions are somehow based on the same trick of overloading the accuracy of the float datatype.
Please don't stop providing such useful help, hints and hacks!
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
41 posts
• Page 3 of 5 • 1, 2, 3, 4, 5
Who is online
Users browsing this forum: No registered users and 38 guests