Skip to content

Commit

Permalink
Merge pull request #7 from christian-byrne/tooltips
Browse files Browse the repository at this point in the history
Add tooltips
  • Loading branch information
christian-byrne authored Aug 21, 2024
2 parents 3d37b8b + d177e0e commit 67f0c18
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ def INPUT_TYPES(cls):
"optional": {
"method": (
["add", "mean", "subtract", "multiply", "divide"],
{"default": "add"},
{
"default": "add",
"tooltip": "The method used to combine the audio waveforms.",
},
)
},
}

FUNCTION = "main"
RETURN_TYPES = ("AUDIO",)
CATEGORY = "audio"
DESCRIPTION = "Combine two audio tracks by overlaying their waveforms."

def main(
self,
Expand Down
19 changes: 16 additions & 3 deletions src/combine_video_with_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ def INPUT_TYPES(cls):
return {
"required": {
"audio": ("AUDIO",),
"video_path": ("STRING", {"default": "/path/to/video.mp4"}),
"video_path": (
"STRING",
{
"default": "/path/to/video.mp4",
"tooltip": "The absolute file path to the video file to which the audio will be added.",
},
),
},
"optional": {
"video_start_time": (
"STRING",
{
"default": "0:00",
"tooltip": "The video will be trimmed to start at this time. The format is MM:SS.",
},
),
"video_end_time": (
"STRING",
{
"default": "1:00",
"tooltip": "The video will be trimmed to end at this time. The format is MM:SS.",
},
),
"auto_open": (
Expand All @@ -40,6 +48,7 @@ def INPUT_TYPES(cls):
"default": False,
"label_on": "Auto open after combining",
"description": "Don't auto open after combining",
"tooltip": "Whether to automatically open the combined video with the default video player after processing.",
},
),
},
Expand All @@ -50,6 +59,8 @@ def INPUT_TYPES(cls):
RETURN_NAMES = ("saved_video_path",)
CATEGORY = "audio"
OUTPUT_NODE = True
OUTPUT_TOOLTIPS = ("The path to the output video.",)
DESCRIPTION = "Replace the audio of a video with a new audio track."

def main(
self,
Expand All @@ -64,7 +75,9 @@ def main(
sample_rate: int = audio["sample_rate"]
input_path = Path(video_path)
if not input_path.exists():
raise FileNotFoundError(f"AudioVideoCombine: Video file not found: {video_path}")
raise FileNotFoundError(
f"AudioVideoCombine: Video file not found: {video_path}"
)

# Assume that no ":" in input means that the user is trying to specify seconds
if ":" not in video_start_time:
Expand Down Expand Up @@ -111,4 +124,4 @@ def main(
else:
os.system(f'xdg-open "{new_filepath}"')

return (str(new_filepath),)
return (str(new_filepath),)
1 change: 1 addition & 0 deletions src/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def INPUT_TYPES(cls):
FUNCTION = "main"
RETURN_TYPES = ("AUDIO",)
CATEGORY = "audio"
DESCRIPTION = "Crop (trim) audio to a specific start and end time."

def main(
self,
Expand Down
1 change: 1 addition & 0 deletions src/get_tempo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def INPUT_TYPES(cls):
RETURN_TYPES = ("STRING", "FLOAT", "INTEGER")
RETURN_NAMES = ("tempo_string", "tempo_float", "tempo_integer")
CATEGORY = "audio"
DESCRIPTION = "Get the tempo (BPM) of audio using onset detection."

def main(
self,
Expand Down
22 changes: 19 additions & 3 deletions src/separation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,33 @@ def INPUT_TYPES(cls):
"logarithmic",
"exponential",
],
{"default": "linear"},
{
"default": "linear",
"tooltip": "Audio is split into segments (chunks) with overlapping areas to ensure smooth transitions. This setting controls the fade effect at these overlaps. Choose Linear for even fading, Half-Sine for a smooth curve, Logarithmic for a quick fade out and slow fade in, or Exponential for a slow fade out and quick fade in.",
},
),
"chunk_length": (
"FLOAT",
{
"default": 10.0,
"tooltip": "The length of each segment (chunk) in seconds. Longer chunks may require more memory and MIGHT produce better results.",
},
),
"chunk_overlap": (
"FLOAT",
{
"default": 0.1,
"tooltip": "The overlap between each segment (chunk) in seconds. A higher overlap may be necessary if chunks are too short or the audio changes rapidly.",
},
),
"chunk_length": ("FLOAT", {"default": 10.0}),
"chunk_overlap": ("FLOAT", {"default": 0.1}),
},
}

FUNCTION = "main"
RETURN_TYPES = ("AUDIO", "AUDIO", "AUDIO", "AUDIO")
RETURN_NAMES = ("Bass", "Drums", "Other", "Vocals")
CATEGORY = "audio"
DESCRIPTION = "Separate audio into four sources: bass, drums, other, and vocals."

def main(
self,
Expand Down
1 change: 1 addition & 0 deletions src/tempo_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def INPUT_TYPES(cls):
FUNCTION = "main"
RETURN_TYPES = ("AUDIO", "AUDIO")
CATEGORY = "audio"
DESCRIPTION = "Match the tempo of two audio tracks by time-stretching them both to match the average tempo between them. E.g., if one audio track is 120 BPM and the other is 100 BPM, both will be time-stretched to 110 BPM."

def main(
self,
Expand Down
1 change: 1 addition & 0 deletions src/time_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def INPUT_TYPES(cls):
FUNCTION = "main"
RETURN_TYPES = ("AUDIO",)
CATEGORY = "audio"
DESCRIPTION = "Time-stretch or time-compress audio by a given rate. A rate of 2.0 will double the speed of the audio, while a rate of 0.5 will halve the speed."

def main(
self,
Expand Down

0 comments on commit 67f0c18

Please sign in to comment.