-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples, TimeShift and GetTempo nodes
- Loading branch information
1 parent
a5107dd
commit b7d6600
Showing
12 changed files
with
487 additions
and
123 deletions.
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ samples | |
lut | ||
video-editing/ | ||
video-editing/**/** | ||
testing-all-nodes-megaworkflow.json |
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
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,29 @@ | ||
from .utils import estimate_tempo | ||
|
||
from typing import Tuple | ||
from ._types import AUDIO | ||
|
||
|
||
class GetTempo: | ||
@classmethod | ||
def INPUT_TYPES(cls): | ||
return { | ||
"required": { | ||
"audio": ("AUDIO",), | ||
}, | ||
} | ||
|
||
FUNCTION = "main" | ||
RETURN_TYPES = ("STRING", "FLOAT", "INTEGER") | ||
RETURN_NAMES = ("tempo_string", "tempo_float", "tempo_integer") | ||
CATEGORY = "audio" | ||
|
||
def main( | ||
self, | ||
audio: AUDIO, | ||
) -> Tuple[AUDIO, AUDIO]: | ||
waveform = audio["waveform"].squeeze(0) | ||
sample_rate = audio["sample_rate"] | ||
tempo = estimate_tempo(waveform, sample_rate) | ||
|
||
return (f"{int(round(tempo))}", tempo, int(tempo)) |
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
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,36 @@ | ||
from .utils import time_shift | ||
|
||
from typing import Tuple | ||
from ._types import AUDIO | ||
|
||
|
||
class TimeShift: | ||
@classmethod | ||
def INPUT_TYPES(cls): | ||
return { | ||
"required": { | ||
"audio": ("AUDIO",), | ||
"rate": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 10.0}), | ||
}, | ||
} | ||
|
||
FUNCTION = "main" | ||
RETURN_TYPES = ("AUDIO",) | ||
CATEGORY = "audio" | ||
|
||
def main( | ||
self, | ||
audio: AUDIO, | ||
rate: float, | ||
) -> Tuple[AUDIO, AUDIO]: | ||
waveform = audio["waveform"].squeeze(0) | ||
sample_rate = audio["sample_rate"] | ||
rate = min(max(rate, 0.1), 10.0) | ||
shifted = time_shift(waveform, rate) | ||
|
||
return ( | ||
{ | ||
"waveform": shifted.unsqueeze(0), | ||
"sample_rate": sample_rate, | ||
}, | ||
) |
Oops, something went wrong.