-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: FFTCrossFade node documentation | ||
description: FFTCrossFade: FFT FFTCrossFade. Requires two FFT* inputs. | ||
|
||
[Reference library](../../index.md) > [FFT](../index.md) > [FFTCrossFade](index.md) | ||
|
||
# FFTCrossFade | ||
|
||
```python | ||
FFTCrossFade(inputA=0, inputB=0, crossfade=0.0) | ||
``` | ||
|
||
FFT FFTCrossFade. Requires two FFT* inputs. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "signalflow/node/fft/fftnode.h" | ||
|
||
namespace signalflow | ||
{ | ||
|
||
/**--------------------------------------------------------------------------------* | ||
* FFT FFTCrossFade. | ||
* Requires two FFT* inputs. | ||
*---------------------------------------------------------------------------------*/ | ||
class FFTCrossFade : public FFTOpNode | ||
{ | ||
public: | ||
FFTCrossFade(NodeRef inputA = 0, NodeRef inputB = 0, NodeRef crossfade = 0.0); | ||
virtual void process(Buffer &out, int num_frames); | ||
|
||
private: | ||
NodeRef inputB; | ||
NodeRef crossfade; | ||
}; | ||
|
||
REGISTER(FFTCrossFade, "fft-cross-fade") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "signalflow/node/fft/fft-cross-fade.h" | ||
#include <algorithm> | ||
|
||
namespace signalflow | ||
{ | ||
|
||
FFTCrossFade::FFTCrossFade(NodeRef inputA, NodeRef inputB, NodeRef crossfade) | ||
: FFTOpNode(inputA), inputB(inputB), crossfade(crossfade) | ||
{ | ||
this->name = "fft-contrast"; | ||
|
||
this->create_input("inputB", this->inputB); | ||
this->create_input("crossfade", this->crossfade); | ||
} | ||
|
||
void FFTCrossFade::process(Buffer &out, int num_frames) | ||
{ | ||
FFTNode *fftnode = (FFTNode *) this->input.get(); | ||
this->num_hops = fftnode->num_hops; | ||
|
||
for (int hop = 0; hop < this->num_hops; hop++) | ||
{ | ||
float crossfade = this->crossfade->out[0][0]; | ||
|
||
for (int frame = 0; frame < this->fft_size; frame++) | ||
{ | ||
if (frame < this->num_bins) | ||
{ | ||
out[hop][frame] = (input->out[hop][frame] * (1 - crossfade)) + (inputB->out[hop][frame] * (crossfade)); | ||
} | ||
else | ||
{ | ||
out[hop][frame] = (input->out[hop][frame] * (1 - crossfade)) + (inputB->out[hop][frame] * (crossfade)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters