C++ conditional operator conversion help [GPL Code!]
Re: C++ conditional operator conversion help [GPL Code!]
what version of gpl is it, they differ but they will still stipulate that you need to make available the source for the dll
Re: C++ conditional operator conversion help [GPL Code!]
You seem not to care about my message. The answers to your questions are only there (FSF) and, more accurately in the licence you do not care to publish.
And this version of request described by idle is not adapted : what the FSF will ask is the same as I said, << Where is the licence ? >>
Personnally, I do not understand what is the use of this source code, so I do not know care.
But if I copy and publish a code, I read the licence, I contact the author(s) which, certainly, will agree with my demand, and go on.
I had the way in the french forum : I found a published code in C, 5 years ago, a mail address was on the head of the code : I contacted it and, after having told my goal, he gave me all the rights I wanted and described via a mail.
And this version of request described by idle is not adapted : what the FSF will ask is the same as I said, << Where is the licence ? >>
Personnally, I do not understand what is the use of this source code, so I do not know care.
But if I copy and publish a code, I read the licence, I contact the author(s) which, certainly, will agree with my demand, and go on.
I had the way in the french forum : I found a published code in C, 5 years ago, a mail address was on the head of the code : I contacted it and, after having told my goal, he gave me all the rights I wanted and described via a mail.
Re: C++ conditional operator conversion help [GPL Code!]
To complete my personnal exemple of respect of right of author, my contact was Song Ho Ahn : VBO !
Enjoy !
Enjoy !
Re: C++ conditional operator conversion help [GPL Code!]
@Olli, I read your message. The License is GPLv3.
https://github.com/jagger2048/Dynamics-processor
I will contact the Author.
https://github.com/jagger2048/Dynamics-processor
I will contact the Author.
Re: C++ conditional operator conversion help [GPL Code!]
In your github link, there is a licence page.
In the code extract you published, there are several floating point constants : I think these values are protected. They might be the result of a research time. If you are able to calculate these values, you have no lots of questions : you insert the ops getting these value, in your source code. Else, if this code is really interesting for you, the mail to the author will help you.
I confess that I have never been concretely interested in complex sound processing : I never coded such a program, not even vocal synthesis which is very easy with any libraries. But maybe others have dug this type of problem.
In the code extract you published, there are several floating point constants : I think these values are protected. They might be the result of a research time. If you are able to calculate these values, you have no lots of questions : you insert the ops getting these value, in your source code. Else, if this code is really interesting for you, the mail to the author will help you.
I confess that I have never been concretely interested in complex sound processing : I never coded such a program, not even vocal synthesis which is very easy with any libraries. But maybe others have dug this type of problem.
Re: C++ conditional operator conversion help [GPL Code!]
Ok... I worked a little bit the viewing of sounds curves.
So, here is a video to bring the math model to you : a wave is represented by a sinus in math. Cosinus is also a sinus, but lightly shifted (one round quarter). Exactly, cosinus(angle) = sinus(angle + 90°).
And sinus (as cosinus) is built by the exponential e^x.
Why ? Because 'e' is a constant (near the value 2) which has been discovered in the physical problems where we wanted to forsee the duration of a change, whatever what it changes, from the point we got a minimum of physical datas.
'e' has been discovered also in the physical problems where we wanted to forsee the physical status of something, from several durations we have measured.
A sound is a wave. A noise is however a status change which propagates itself to become a sound.
Example : an explode (explosion). If you are near, it's not a sound you get, but a hurt. It is a really strong noise.
But, if you are far, you will listen to a strongly starting sound, and which attenuates itself.
In math, a simple equation which seems like the attenuating sound of an explosion, is 1/x.
An other example which is not exact, I agree, but it represents well the attenuation : a telegraphic pole and its cable which would touch the floor(Source)
If you take a photo of this pole, and this cable, the curve drawn by the cable will seem like the math equation 1/x.(Source)
If you observe the surface between the cable and the floor on the picture of the photo, you get an math equation named surface = ln(distance) where the distance is between the vertical pole and the horizontal limit you have decided to calculate this surface.
Also, if you give a surface value you can measure on the photo to anybody, this last one could get the distance between the vertical pole and the limit you decided to measure the surface, thanks to the reverse of the ln(x) math function :
distance = e^surface
Also, a surface it is an addition of several distances. In the way of our cable hold by our pole, the surface I was talking about is an addition of vertical distances, an addition of several heights whom the resulting value (the surface) depends of the horizontal distance between the pole and limit position we have decided. (This 'addition' has a name in math : an integral)
But it exists lots of physical unities we can add to get an other type physical unity.
Example : a speed is a addition of several distances, from the way where we ever measure these several distances in a same rythm.
For the way of a wave, to approach the idea of a sound, let's imagine a wave in the see. We have a height of wave which can be considered as a distance, and we have a speed with which the wave go up and go down repeatitively.
So, knowing this wave draws a sinus, considering that the height of the wave is a first type of physical energy (potential energy), and considering the vertical speed of the wave is a second type of physical energy (cinetic energy), and considering the vertical speed in the time t is the addition of several heights to this time t, the relationship between the height and the speed is :
verticalSpeedWave(t) = ln(verticalHeightWave(t) )
and its reverse :
verticalHeightWave(t) = e^(verticalSpeedWave(t) )
As the wave draws a sinus, we have :
sinus(t) = e^(verticalSpeedWave(t) )
And, as a wave is a successive round trip transfer of energies between the potential energy (height) and the cinetic energy, I simplify a lot, but we can consider the verticalSpeedWave as a 90° shifted sinus :
sinus(t) = e^(-cosinus(t) ) (minus sign is due to a math convention)
cosinus(t) = -ln(sinus(t) )
So, a noise is a variable value (which can be a small sinus) which comes to add itself in the equation.
sinus(t) <> e^(-cosinus(t) ) + noise(t)
Your goal : to detect the noise function !
Hoping this message helps you a little bit, I add this link to a video which explains the built of trigonometric functions (sinus and cosinus) from the e function.
math video
So, here is a video to bring the math model to you : a wave is represented by a sinus in math. Cosinus is also a sinus, but lightly shifted (one round quarter). Exactly, cosinus(angle) = sinus(angle + 90°).
And sinus (as cosinus) is built by the exponential e^x.
Why ? Because 'e' is a constant (near the value 2) which has been discovered in the physical problems where we wanted to forsee the duration of a change, whatever what it changes, from the point we got a minimum of physical datas.
'e' has been discovered also in the physical problems where we wanted to forsee the physical status of something, from several durations we have measured.
A sound is a wave. A noise is however a status change which propagates itself to become a sound.
Example : an explode (explosion). If you are near, it's not a sound you get, but a hurt. It is a really strong noise.
But, if you are far, you will listen to a strongly starting sound, and which attenuates itself.
In math, a simple equation which seems like the attenuating sound of an explosion, is 1/x.
An other example which is not exact, I agree, but it represents well the attenuation : a telegraphic pole and its cable which would touch the floor(Source)
If you take a photo of this pole, and this cable, the curve drawn by the cable will seem like the math equation 1/x.(Source)
If you observe the surface between the cable and the floor on the picture of the photo, you get an math equation named surface = ln(distance) where the distance is between the vertical pole and the horizontal limit you have decided to calculate this surface.
Also, if you give a surface value you can measure on the photo to anybody, this last one could get the distance between the vertical pole and the limit you decided to measure the surface, thanks to the reverse of the ln(x) math function :
distance = e^surface
Code: Select all
Debug Log(5) ; ln(5) =~ 1.6
Debug Exp(1.6) ; e^(1.6) =~ 5
Debug Pow(#E, 1.6) ; ~5
But it exists lots of physical unities we can add to get an other type physical unity.
Example : a speed is a addition of several distances, from the way where we ever measure these several distances in a same rythm.
For the way of a wave, to approach the idea of a sound, let's imagine a wave in the see. We have a height of wave which can be considered as a distance, and we have a speed with which the wave go up and go down repeatitively.
So, knowing this wave draws a sinus, considering that the height of the wave is a first type of physical energy (potential energy), and considering the vertical speed of the wave is a second type of physical energy (cinetic energy), and considering the vertical speed in the time t is the addition of several heights to this time t, the relationship between the height and the speed is :
verticalSpeedWave(t) = ln(verticalHeightWave(t) )
and its reverse :
verticalHeightWave(t) = e^(verticalSpeedWave(t) )
As the wave draws a sinus, we have :
sinus(t) = e^(verticalSpeedWave(t) )
And, as a wave is a successive round trip transfer of energies between the potential energy (height) and the cinetic energy, I simplify a lot, but we can consider the verticalSpeedWave as a 90° shifted sinus :
sinus(t) = e^(-cosinus(t) ) (minus sign is due to a math convention)
cosinus(t) = -ln(sinus(t) )
So, a noise is a variable value (which can be a small sinus) which comes to add itself in the equation.
sinus(t) <> e^(-cosinus(t) ) + noise(t)
Your goal : to detect the noise function !
Hoping this message helps you a little bit, I add this link to a video which explains the built of trigonometric functions (sinus and cosinus) from the e function.
math video
Re: C++ conditional operator conversion help [GPL Code!]
Thank you for your effort Olli. I'll take a look.
Re: C++ conditional operator conversion help [GPL Code!]
Don't thank me so hastily, given what I wrote, it's obvious that I was tired...
In some calculations, I put on the pants before the briefs. Do not hesitate to test in all directions. Anyway, that gives you a general idea of the starting methods for creating an algorithm that removes noise.
In some calculations, I put on the pants before the briefs. Do not hesitate to test in all directions. Anyway, that gives you a general idea of the starting methods for creating an algorithm that removes noise.
Re: C++ conditional operator conversion help [GPL Code!]
As you will see, the magenta curve (gy(5) ) has been changed when the frequency has been low. Is not it ?
Code: Select all
; very bad filtering example
Global.d ww, wh, dw, dw, dpiW, dpiH
dw = DesktopWidth(0 & ExamineDesktops() )
dh = DesktopHeight(0)
tempWin = OpenWindow(#PB_Any, 0, 0, 1, 1, "", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_Maximize)
ww = WindowWidth(tempWin)
wh = WindowHeight(tempWin)
CloseWindow(tempWin)
dpiW = dw / ww
dpiH = dh / wh
mainWin = OpenWindow(#PB_Any, 0, 0, ww * 1/2, wh * 1/2, "very bad filtering example : high frequency good bye", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Dim color(7)
color(0) = RGBA(255, 255, 255, 255)
color(1) = RGBA(0, 0, 255, 255)
color(2) = RGBA(0, 255, 0, 255)
color(3) = RGBA(0, 255, 255, 255)
color(4) = RGBA(255, 0, 0, 255)
color(5) = RGBA(255, 0, 255, 255)
InitSprite()
sw = WindowWidth(mainWin)
sh = WindowHeight(mainWin)
OpenWindowedScreen(WindowID(mainWin), 0, 0, sw, sh, 1, 0, 0)
Define.d gx, gy, gx0, gy0, xSca = 2
Dim ch(7)
Dim gy.d(7)
Dim gy0.d(7)
ch(0) = CreateSprite(#PB_Any, sw, sh, #PB_Sprite_AlphaBlending)
If 1
StartDrawing(SpriteOutput(ch(0) ) )
DrawingMode(#PB_2DDrawing_AllChannels)
For i = 2 To sw
gx0 = gx
gx = ((i - 1) * (2 * #PI * xSca) / sw) - (#PI * xSca)
For j = 0 To 5
gy0(j) = gy(j)
Next
gy(0) = Sin(Pow(gx, 3) ) * (1 + (Pow(Random(2), 2) / 8) ) ; normal digit
gy(3) = Cos(Pow(gx, 3) ) ; later digit (careful, it's simulated, it should have had been gy(3) = gy(0) but gy(0) from the past -any milliseconds- , "ideal" inductive filtering)
gy(4) = ((gy(0) - gy(3) ) + 0) / 5 ; difference between normal digit and later digit
gy(5) + (gy(4) / 50) ; very very bad ("plus"... the null-math integrate :-)
For j = 0 To 5
If gy(j)
LineXY(i - 2, (1 + gy0(j) ) * (sh / 2), i - 1, (1 + gy(j) ) * (sh / 2), color(j) )
If j = 5
Circle(i - 2, (1 + gy0(j) ) * (sh / 2), 2, color(j) )
EndIf
EndIf
Next
Next
StopDrawing()
EndIf
Repeat
ClearScreen(0)
DisplayTransparentSprite(ch(0), 0, 0)
FlipBuffers()
Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: C++ conditional operator conversion help [GPL Code!]
Note : Sure I apologize if it is not inductive, in this way it is capacitive. It is not a problem : I just have been confused between the left and the right. Anyway, since the time that it exists, God saving the Beatles.
Note 2 : Most of it is editable between lines 46 and 49. You have "gy(n)" with n from 0 to 5 (for 6 curves). Just assign a "math" function to each of the 6 "gy()" (Graphic X) based on gx.
gy(curve #) = 0 won't be displayable.
gxMin = -Pi
gxMax = Pi
gyMin = -1
gyMax = 1
Respective colors :
gy(0) :: white
gy(1) :: blue
gy(2) :: green
gy(3) :: cyan
gy(4) :: red
gy(5) :: magenta
gy(5) magenta curve thickness is upper (line #54) (else it is hard to see it).
Note 3 : You may notice that I'm cheating: line #49, I send maths to the grass, combinatorial logic being the mother of mathematics. Thus, in case, a false remains a false, a true remains a true. And the gap between sequential logic, the father of mathematics, and combinatorial logic leaves any artist free to place their signature there...
Note 4 : It is more simple to show the "bringer line" (french : la "porteuse") independantly, to begin and understand. But lines #46 and #47 could be replaced with the following three lines, to be more realistic in the experiment.+Pi/2 is the maximum absolute delay value.
As I swam in the grapevine, I stayed in the ease of positive y to the bottom, as in maths, the positive y is to the top.
That's that the reason for which '+' (for +Pi/2) and '-' seems like dancers to really know if it is capacitive or inductive. (Physically, an inductive circuit LR - Thevenin scheme* - should remove the frequencies higher than a threshold - depending the late delay duration -, as a capacitive circuit RC - Norton scheme* - should
remove the frequencies lower than a - other - threshold, the final goal being the coding of 2^15 LRC circuits and, manually or through an AI, select the frequencies in the heap of near 30K, select the ones we want to keep)
Good luck !
(*) : please be careful to very big mistakes : Thevenin and Norton schemes represents resistive generators, whom the main characteric is the electromotor force. It is less false if we consider the behaviours of C and L components : exactly as generators, C capacitors and L coils have an electric configuration to provide energy.This configuration is own to each component type, and is finally described by delay value (the angle shift equ to +pi/2 in this source code example above). Logically, the component type depends of the shift sign status :
-> negative shift simulates a coil (stores the energy received, in the vacuum through a magnetic field)
-> positive shift simulates a capacitor (stores the energy received, in the vacuum through an electric field)
Let's imagine a warming double pipe (hot and cold) between the Earth and the Moon, which sends hot water to the Moon, and receives cold water from the Moon. Let's consider that Neil Armstrong forgot to leave the heating tap open on the Moon. And let's consider (but there, you have to do the roulades in the grapevines) that there is no heat loss in space, between the double pipe system and the space.
*> If the pipes are far themselves, the heat follows the pipe circuit, leaves the Earth, firstly, reachs the Moon then, and finally, will go back to the Earth after that the Moon station has received the heat. (inductive transfer)
*> If the pipes are near themselves,the residual heat received on Earth will come from an exchange of calories between the two pipes, during the Earth-Moon journey. This heat received on Earth, which did not wait for the Moon, arrives in advance on Earth (capacitive transfer).
Coils and capacitors have a behaviour which seems like these pipes.
Note 2 : Most of it is editable between lines 46 and 49. You have "gy(n)" with n from 0 to 5 (for 6 curves). Just assign a "math" function to each of the 6 "gy()" (Graphic X) based on gx.
gy(curve #) = 0 won't be displayable.
gxMin = -Pi
gxMax = Pi
gyMin = -1
gyMax = 1
Respective colors :
gy(0) :: white
gy(1) :: blue
gy(2) :: green
gy(3) :: cyan
gy(4) :: red
gy(5) :: magenta
gy(5) magenta curve thickness is upper (line #54) (else it is hard to see it).
Note 3 : You may notice that I'm cheating: line #49, I send maths to the grass, combinatorial logic being the mother of mathematics. Thus, in case, a false remains a false, a true remains a true. And the gap between sequential logic, the father of mathematics, and combinatorial logic leaves any artist free to place their signature there...
Note 4 : It is more simple to show the "bringer line" (french : la "porteuse") independantly, to begin and understand. But lines #46 and #47 could be replaced with the following three lines, to be more realistic in the experiment.
Code: Select all
noise.d = (1 + Pow(Random(2), 2) / 8) )
gy(0) = Sin(Pow(gx, 3) ) * noise ; normal digit
gy(3) = Sin(Pow(gx, 3) + (#Pi / 2) ) * noise ; delayed digit
As I swam in the grapevine, I stayed in the ease of positive y to the bottom, as in maths, the positive y is to the top.
That's that the reason for which '+' (for +Pi/2) and '-' seems like dancers to really know if it is capacitive or inductive. (Physically, an inductive circuit LR - Thevenin scheme* - should remove the frequencies higher than a threshold - depending the late delay duration -, as a capacitive circuit RC - Norton scheme* - should
remove the frequencies lower than a - other - threshold, the final goal being the coding of 2^15 LRC circuits and, manually or through an AI, select the frequencies in the heap of near 30K, select the ones we want to keep)
Good luck !
(*) : please be careful to very big mistakes : Thevenin and Norton schemes represents resistive generators, whom the main characteric is the electromotor force. It is less false if we consider the behaviours of C and L components : exactly as generators, C capacitors and L coils have an electric configuration to provide energy.This configuration is own to each component type, and is finally described by delay value (the angle shift equ to +pi/2 in this source code example above). Logically, the component type depends of the shift sign status :
-> negative shift simulates a coil (stores the energy received, in the vacuum through a magnetic field)
-> positive shift simulates a capacitor (stores the energy received, in the vacuum through an electric field)
Let's imagine a warming double pipe (hot and cold) between the Earth and the Moon, which sends hot water to the Moon, and receives cold water from the Moon. Let's consider that Neil Armstrong forgot to leave the heating tap open on the Moon. And let's consider (but there, you have to do the roulades in the grapevines) that there is no heat loss in space, between the double pipe system and the space.
*> If the pipes are far themselves, the heat follows the pipe circuit, leaves the Earth, firstly, reachs the Moon then, and finally, will go back to the Earth after that the Moon station has received the heat. (inductive transfer)
*> If the pipes are near themselves,the residual heat received on Earth will come from an exchange of calories between the two pipes, during the Earth-Moon journey. This heat received on Earth, which did not wait for the Moon, arrives in advance on Earth (capacitive transfer).
Coils and capacitors have a behaviour which seems like these pipes.
Re: C++ conditional operator conversion help [GPL Code!]
@AndyMK
Were you able to advance?
Were you able to advance?
Re: C++ conditional operator conversion help [GPL Code!]
Not yet.. work has taken over
Re: C++ conditional operator conversion help [GPL Code!]
Which code ?
I do not see anything inspired of a GPL code there (extract of my code on the head of this page. Goal = to understand a physical effect) :
Code: Select all
gy(0) = Sin(Pow(gx, 3) ) * (1 + (Pow(Random(2), 2) / 8) ) ; normal digit
gy(3) = Cos(Pow(gx, 3) ) ; later digit (careful, it's simulated, it should have had been gy(3) = gy(0) but gy(0) from the past -any milliseconds- , "ideal" inductive filtering)
gy(4) = ((gy(0) - gy(3) ) + 0) / 5 ; difference between normal digit and later digit
gy(5) + (gy(4) / 50) ; very very bad ("plus"... the null-math integrate :-)
Re: C++ conditional operator conversion help [GPL Code!]
Hello Kiffi, I thank your information. I will post a screenshoot resulting from this code. Sure, lots of people will be able to start a filter from this example. It is not accurate, but it shows a filter does not require very complex algo (initially anyway).