Cross-fading between 2 values on number lines. The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Simple lowpass frequency responseSpeech processing pre-emphasis: how does it work?Given a signal in the time domain, is there a way to determine a function that produces that signal?Using the FFT to align two instances of the same signalWhich of arithmetic, geometric or harmonic mean is the most appropriate in this case?Negative autocorrelation valuesVisualize signal dropsDerivative of arctangentCorrelation between 2 signals of uneven dimensionsDiscrete Representations of Continuous Surfaces
Is 'stolen' appropriate word?
How to determine omitted units in a publication
Sub-subscripts in strings cause different spacings than subscripts
Circular reasoning in L'Hopital's rule
Is an up-to-date browser secure on an out-of-date OS?
Huge performance difference of the command find with and without using %M option to show permissions
Single author papers against my advisor's will?
Did the new image of black hole confirm the general theory of relativity?
Simulating Exploding Dice
Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?
Is every episode of "Where are my Pants?" identical?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
How do spell lists change if the party levels up without taking a long rest?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
"is" operation returns false even though two objects have same id
How to handle characters who are more educated than the author?
Keeping a retro style to sci-fi spaceships?
Button changing its text & action. Good or terrible?
Why doesn't shell automatically fix "useless use of cat"?
Do warforged have souls?
Mortgage adviser recommends a longer term than necessary combined with overpayments
How did passengers keep warm on sail ships?
Why are PDP-7-style microprogrammed instructions out of vogue?
Define a list range inside a list
Cross-fading between 2 values on number lines.
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Simple lowpass frequency responseSpeech processing pre-emphasis: how does it work?Given a signal in the time domain, is there a way to determine a function that produces that signal?Using the FFT to align two instances of the same signalWhich of arithmetic, geometric or harmonic mean is the most appropriate in this case?Negative autocorrelation valuesVisualize signal dropsDerivative of arctangentCorrelation between 2 signals of uneven dimensionsDiscrete Representations of Continuous Surfaces
$begingroup$
Background:
I'm working on writing a software application where I need to cross fade between 2 digital audio signals. In the software I have 4 variables that play a role:
float sampleA; //The value of signal A in this very instant (values from -1 to 1).
float sampleB; //The value of signal B in this very instant (values from -1 to 1).
float index; //The index of the crossfade in this very instant (values from 0 to 1).
float result; //The resulting value of the signal after the crossfade is applied.
However I have no idea how I would achieve this crossfade.
Problem Description:
I've decided to make a visual representation of the problem:

As you can see we have 3 number lines A(blue), B(red), and i(green). A and B represent the 2 floating point values of sampleA and sampleB which can vary between 1 and -1 while i is the crossfade index, a value which determines how far into the crossfade we are. Now what I've done is I've added some values for A, B and i on their respective numberlines and I've connected the points for A and B with a line.
If we then project the value of i on the line between point A and B we get a new point, Let's call this point R. If we project point R on either the numberline for A or B we can then get the final result.
Problem:
What is a formula which I can use, given a value for A, B and i, to calculate the value of R projected on the numberline?
signal-processing
$endgroup$
add a comment |
$begingroup$
Background:
I'm working on writing a software application where I need to cross fade between 2 digital audio signals. In the software I have 4 variables that play a role:
float sampleA; //The value of signal A in this very instant (values from -1 to 1).
float sampleB; //The value of signal B in this very instant (values from -1 to 1).
float index; //The index of the crossfade in this very instant (values from 0 to 1).
float result; //The resulting value of the signal after the crossfade is applied.
However I have no idea how I would achieve this crossfade.
Problem Description:
I've decided to make a visual representation of the problem:

As you can see we have 3 number lines A(blue), B(red), and i(green). A and B represent the 2 floating point values of sampleA and sampleB which can vary between 1 and -1 while i is the crossfade index, a value which determines how far into the crossfade we are. Now what I've done is I've added some values for A, B and i on their respective numberlines and I've connected the points for A and B with a line.
If we then project the value of i on the line between point A and B we get a new point, Let's call this point R. If we project point R on either the numberline for A or B we can then get the final result.
Problem:
What is a formula which I can use, given a value for A, B and i, to calculate the value of R projected on the numberline?
signal-processing
$endgroup$
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21
add a comment |
$begingroup$
Background:
I'm working on writing a software application where I need to cross fade between 2 digital audio signals. In the software I have 4 variables that play a role:
float sampleA; //The value of signal A in this very instant (values from -1 to 1).
float sampleB; //The value of signal B in this very instant (values from -1 to 1).
float index; //The index of the crossfade in this very instant (values from 0 to 1).
float result; //The resulting value of the signal after the crossfade is applied.
However I have no idea how I would achieve this crossfade.
Problem Description:
I've decided to make a visual representation of the problem:

As you can see we have 3 number lines A(blue), B(red), and i(green). A and B represent the 2 floating point values of sampleA and sampleB which can vary between 1 and -1 while i is the crossfade index, a value which determines how far into the crossfade we are. Now what I've done is I've added some values for A, B and i on their respective numberlines and I've connected the points for A and B with a line.
If we then project the value of i on the line between point A and B we get a new point, Let's call this point R. If we project point R on either the numberline for A or B we can then get the final result.
Problem:
What is a formula which I can use, given a value for A, B and i, to calculate the value of R projected on the numberline?
signal-processing
$endgroup$
Background:
I'm working on writing a software application where I need to cross fade between 2 digital audio signals. In the software I have 4 variables that play a role:
float sampleA; //The value of signal A in this very instant (values from -1 to 1).
float sampleB; //The value of signal B in this very instant (values from -1 to 1).
float index; //The index of the crossfade in this very instant (values from 0 to 1).
float result; //The resulting value of the signal after the crossfade is applied.
However I have no idea how I would achieve this crossfade.
Problem Description:
I've decided to make a visual representation of the problem:

As you can see we have 3 number lines A(blue), B(red), and i(green). A and B represent the 2 floating point values of sampleA and sampleB which can vary between 1 and -1 while i is the crossfade index, a value which determines how far into the crossfade we are. Now what I've done is I've added some values for A, B and i on their respective numberlines and I've connected the points for A and B with a line.
If we then project the value of i on the line between point A and B we get a new point, Let's call this point R. If we project point R on either the numberline for A or B we can then get the final result.
Problem:
What is a formula which I can use, given a value for A, B and i, to calculate the value of R projected on the numberline?
signal-processing
signal-processing
asked Mar 24 at 16:09
BRHSMBRHSM
1053
1053
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21
add a comment |
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
From the visual I interpret this as
$$R=a+i(b-a)$$
because the value of $R$ is equal to that of $a$ plus some fraction $i$ of the difference between $b$ and $a$.
$endgroup$
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3160718%2fcross-fading-between-2-values-on-number-lines%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
From the visual I interpret this as
$$R=a+i(b-a)$$
because the value of $R$ is equal to that of $a$ plus some fraction $i$ of the difference between $b$ and $a$.
$endgroup$
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
add a comment |
$begingroup$
From the visual I interpret this as
$$R=a+i(b-a)$$
because the value of $R$ is equal to that of $a$ plus some fraction $i$ of the difference between $b$ and $a$.
$endgroup$
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
add a comment |
$begingroup$
From the visual I interpret this as
$$R=a+i(b-a)$$
because the value of $R$ is equal to that of $a$ plus some fraction $i$ of the difference between $b$ and $a$.
$endgroup$
From the visual I interpret this as
$$R=a+i(b-a)$$
because the value of $R$ is equal to that of $a$ plus some fraction $i$ of the difference between $b$ and $a$.
answered Mar 24 at 16:19
Peter ForemanPeter Foreman
7,1841318
7,1841318
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
add a comment |
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
$begingroup$
I'm not getting the desired output i want so let me play with it some more and see if i can get this to work!
$endgroup$
– BRHSM
Mar 24 at 17:19
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3160718%2fcross-fading-between-2-values-on-number-lines%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
This is often called a "reset" or a "linear reset" in programming languages which support it. Since your input and output ranges are of equal length, some of the math can be simplified.
$endgroup$
– abiessu
Mar 24 at 16:16
$begingroup$
@abiessu i know about things like remapping but i don't know how that can help here, i tried looking around google for the linear reset or reset thing you mentiond but I can't seem to find any relevant information
$endgroup$
– BRHSM
Mar 24 at 17:21