Wrong path if using custom path in ComfyUI
Hi! I have an issue with loading and saving audio files
It happens because you initiate path variables at the top of nodes.py
I mean this:
input_path = folder_paths.get_input_directory() output_path = folder_paths.get_output_directory()
It's better to get a path inside your functions, coz when you make it at the top of the file, variables keep the old path that changes later This is example how I fixed that:
class LoadAudioPath:
@classmethod
def INPUT_TYPES(s):
input_dir = folder_paths.get_input_directory()
files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
return {"required":
{"audio": (sorted(files),)},
}
CATEGORY = "AIFSH_XTTS"
RETURN_TYPES = ("AUDIOPATH",)
FUNCTION = "load_audio"
def load_audio(self, audio):
audio_path = folder_paths.get_annotated_filepath(audio)
return (audio_path,)
By the way, could you add a player (preview) to the XTTS Inference node and add alternative input and output to it as the "AUDIO" type. It's really useful because, in this case, we can use "LoadAudio" and "SaveAudio" from CORE nodes. Ty!
P.S. - Yeah, and it will be nice to disable autoplay of audio files. I mean, you don't need to play it automatically every time