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
Copy & Paste Funtcion
29 posts
• Page 2 of 3 • 1, 2, 3
Re: Copy & Paste Funtcion
Thanks Trog, Will read up on your trigger tutorials on SM forums.( ALOT of info there! )
And about the INF, you are right im getting the INF out of my RMS module. Essentially its just fed the signal and outputs to a M2F. Which then reads the INF. So I know my rms module is to blame!
I guess its trying to divide by 0 when the signal drops , so I just added 0.0000001 to the division in DSP.
It seems to work now
And my copy paste module now uses a .txt file
Nice and Easy! lol, there's me trying to dive headfirst in the deep-end when there is a paddling pool right next to me!
And about the INF, you are right im getting the INF out of my RMS module. Essentially its just fed the signal and outputs to a M2F. Which then reads the INF. So I know my rms module is to blame!
I guess its trying to divide by 0 when the signal drops , so I just added 0.0000001 to the division in DSP.
It seems to work now
And my copy paste module now uses a .txt file
Nice and Easy! lol, there's me trying to dive headfirst in the deep-end when there is a paddling pool right next to me!
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: Copy & Paste Funtcion
Drnkhobo wrote:Nice and Easy! lol, there's me trying to dive headfirst in the deep-end when there is a paddling pool right next to me!
He he, well I see now a lot of familiar name appearing here - old SM'ers come to play with the new toys. So I guess the paddling pool has come closer!
Looking forward to this - we will learn as much as we teach, I am sure - trade some trigger skills for some Ruby tips!
Played a bit now with the FS3 demo (oops - got a bit late, tired eyes at work today!). Pretty much everything I tried of my old things have worked great so far, so I think getting some of those tutorials over here shouldn't be too hard - just replace the odd component here and there with the nice shiny new ones, and ready o go!
NB) For RMS the conversion is best to be done in DSP code - the Mono2Float can only read approx.100 samples per second maximum, and missing so many samples will distort the reading very badly (often the highest peaks will just go past without registering). Keep your eye out for the new module packs that get posted up - there's sure to be an audio pack with a decent RMS convertor for audio in there somewhere. If not, I'll have a rummage in my old schematics, it is something I have used in many old designs.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Copy & Paste Funtcion
NB) For RMS the conversion is best to be done in DSP code - the Mono2Float can only read approx.100 samples per second maximum. . .
I dont understand Trog, my mono to float is AFTER the rms, and how else can I get float data from a stream?
(I tried in DSP module but it didnt work. Having said that, I dont really know much of the DSP's own little language so maybe I got it wrong. . ) But anyway my rms is in the DSP code module.
- Code: Select all
streamin in;
streamin bufferSize;
streamout average;
float buffer[44100];
float n,sum,size=512;
size = bufferSize;
sum = (sum + in) - buffer[n];
buffer[n]= in;
average = sum/size;
n = n + 1;
n = n- (n>=size)&size;
This was a example that exo put up here.
This and a simple-(ish) automatic gain corrector is giving me grief!
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: Copy & Paste Funtcion
Thanks Tronic, ill check it in the morn.
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: Copy & Paste Funtcion
Drnkhobo wrote:I dont understand Trog, my mono to float is AFTER the rms
Ah sorry, my mistake, I read your screenshot a bit wrong - I could only see that the dB conversion was in 'green', and thought that maybe the whole routine was in there.
Tronic's solution is the right one for RMS code- the code that you posted is only finding the average signal. That's not quite the same as RMS - you need the square/square-root parts that you see in Tronic's code, otherwise positive and negative audio values will tend to cancel each other out.
From what I can see though, the meter is not really a dB meter - the value from the code is RMS, but I don't see a dB conversion anywhere, so it is showing the absolute value, not logarithmically scaled as it should be for dB.
I'd also use just a Mono2Float from a custom ticker rather than the 'V' frame buffer - only one value from each buffer is ever being read, and the ballistics of the RMS code will smooth the result well enough that reading only occasional samples will not give too much error. Using small soundcard buffer sizes, the frames will be coming in much faster than the display could ever be updated, and 100s of buffer values are being passed for no reason - which will use a lot of unnecessary CPU power.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Copy & Paste Funtcion
Ive got a sqr module in assembly after the rms
I dont understand what you mean about V buffers Trog? - Aaah, Tronics example . . .
- Code: Select all
streamin in;
streamout out;
movaps xmm0,in;
sqrtps xmm0,xmm0;
movaps out,xmm0;
I dont understand what you mean about V buffers Trog? - Aaah, Tronics example . . .
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: Copy & Paste Funtcion
Ok here it is,
Its my rms module. I am going to change the rms sample size down to +-4000
Anyway here is where i get my INF errors. . .
Its my rms module. I am going to change the rms sample size down to +-4000
Anyway here is where i get my INF errors. . .
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: Copy & Paste Funtcion
Taking shape nicely! - in fact it is engineered a little TOO well, and there are now quite a few bits that you can safely remove.
- The square of a number can never be negative, so you can safely delete all of the abs() functions (code and primitives).
- You can remove all of that "green protection" between the M2F and dB if you make a tiny modification of the averaging code...
This is a little bit safer than adding the small offset as it is immune from any rounding errors that creep into the maths., It also means that "normal" values don't have anything added to them, so they'll never go off the scale of the meter (above 0dB).
PS) Watch out with those min and max functions - they confused me for ages. max(x,y) means "give me whichever if the biggest of these two values", so it doesn't set a maximum value for X, it's actually used when setting a minimum. I still get min and max the wrong way around about 5 million times a week!
And another thing to be aware of - it is not a good idea to modify a streamin variable (e.g. in = ...). Something done all the time in many programming languages, but due to a quirk of the way that input links work in FS, it can have some very strange side-effects sometimes. What happens is that the change to the input variable also changes the value at the other end of the link, inside the module/connector that is sending the value - and any other modules connected to the same source will see this modified value. I guess you could say that the link wires represent global variables, and they don't get made local inside a code block.
- The square of a number can never be negative, so you can safely delete all of the abs() functions (code and primitives).
- You can remove all of that "green protection" between the M2F and dB if you make a tiny modification of the averaging code...
- Code: Select all
streamin in;
streamin bufferSize;
streamout average;
float buffer[44100];
float n,sum,size=512;
//in = abs(in); Not needed any more due to In * in
size = bufferSize;
sum = (sum + in) - buffer[n];
buffer[n]= in;
average = sum/size;
average = max(average,0.000001); //Can't go below this value
average = min(average,1); //Can't go above 1
n = n + 1;
n = n- (n>=size)&size;
This is a little bit safer than adding the small offset as it is immune from any rounding errors that creep into the maths., It also means that "normal" values don't have anything added to them, so they'll never go off the scale of the meter (above 0dB).
PS) Watch out with those min and max functions - they confused me for ages. max(x,y) means "give me whichever if the biggest of these two values", so it doesn't set a maximum value for X, it's actually used when setting a minimum. I still get min and max the wrong way around about 5 million times a week!
And another thing to be aware of - it is not a good idea to modify a streamin variable (e.g. in = ...). Something done all the time in many programming languages, but due to a quirk of the way that input links work in FS, it can have some very strange side-effects sometimes. What happens is that the change to the input variable also changes the value at the other end of the link, inside the module/connector that is sending the value - and any other modules connected to the same source will see this modified value. I guess you could say that the link wires represent global variables, and they don't get made local inside a code block.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Copy & Paste Funtcion
Damn, thanks Trog!
Thanks for the tips on the whole "in=. . ."
Its weird that it works that way but I guess im just used to other languages.
Your code makes more sense than my feeble attempt lol
Im used to those min,max functions (used them in AVS) I dont know why I never thought of doing it like this!
Ive just noticed (yes,only now) when you connect a text primitive to the dsp module, it shows the conversion to asm right?
- Also why not then just use the output and have a asm instead of dsp module???
Thanks for the tips on the whole "in=. . ."
Its weird that it works that way but I guess im just used to other languages.
Your code makes more sense than my feeble attempt lol
Im used to those min,max functions (used them in AVS) I dont know why I never thought of doing it like this!
Ive just noticed (yes,only now) when you connect a text primitive to the dsp module, it shows the conversion to asm right?
- Also why not then just use the output and have a asm instead of dsp module???
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
29 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 62 guests