UNPKG

n8n-nodes-comfyui-text-to-audio

Version:

n8n node to integrate with ComfyUI stable diffusion workflows for text to audio conversion

410 lines (305 loc) 11 kB
![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png) # n8n-nodes-comfyui-text-to-audio This package provides n8n node to integrate with [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - A powerful and modular stable diffusion GUI with a graph/nodes interface. ## Features - Execute ComfyUI workflows directly from n8n - Generate audio from text using stable diffusion models - Support for workflow JSON import - Automatic output retrieval from workflow outputs - Progress monitoring and error handling - Support for API key authentication - Configurable timeout settings ## Prerequisites - n8n (version 1.0.0 or later) - ComfyUI instance running and accessible - Node.js 18 or newer ## Installation ### Standard Installation ```bash # Install from npm package (recommended) npm install n8n-nodes-comfyui-text-to-audio # Or install from git repository npm install github:StudioExitt/n8n-nodes-comfyui-text-to-audio ``` ### Docker Installation For Docker installations, you can use one of the following methods: #### Method 1: Volume Mount ```bash # Create a directory for custom nodes mkdir -p /path/to/custom/nodes # Clone the repository git clone https://github.com/StudioExitt/n8n-nodes-comfyui-text-to-audio.git /tmp/custom-nodes cd /tmp/custom-nodes # Install dependencies and build npm install npm run build # Copy the built files to your custom nodes directory cp -r dist/* /path/to/custom/nodes/n8n-nodes-comfyui-text-to-audio/ # Run n8n with the custom nodes directory mounted docker run -d \ --name n8n \ -p 5678:5678 \ -v /path/to/custom/nodes:/home/node/.n8n/custom/nodes \ n8nio/n8n ``` #### Method 2: Custom Docker Image ```dockerfile # Dockerfile FROM n8nio/n8n # Install the custom nodes package from GitHub RUN cd /tmp && \ npm install github:StudioExitt/n8n-nodes-comfyui-text-to-audio && \ cp -r /tmp/node_modules/n8n-nodes-comfyui-text-to-audio /home/node/.n8n/custom/nodes/ && \ chown -R node:node /home/node/.n8n ``` Build and run: ```bash docker build -t n8n-with-comfyui . docker run -d --name n8n -p 5678:5678 n8n-with-comfyui ``` #### Method 3: Docker Compose ```yaml version: '3' services: n8n: image: n8nio/n8n container_name: n8n ports: - "5678:5678" volumes: - n8n_data:/home/node/.n8n - ./custom-nodes:/home/node/.n8n/custom/nodes environment: - N8N_PORT=5678 - N8N_PROTOCOL=http - NODE_ENV=production volumes: n8n_data: ``` Then: ```bash # Clone the repository git clone https://github.com/StudioExitt/n8n-nodes-comfyui-text-to-audio.git /tmp/custom-nodes cd /tmp/custom-nodes # Install dependencies and build npm install npm run build # Copy the built files to your custom nodes directory mkdir -p ./custom-nodes/n8n-nodes-comfyui-text-to-audio cp -r dist/* ./custom-nodes/n8n-nodes-comfyui-text-to-audio/ # Start the docker-compose setup docker-compose up -d ``` ## Node Types ### ComfyUI Text to Audio Node This node allows you to generate audio from text using ComfyUI's text-to-audio capabilities. #### Settings - **API URL**: The URL of your ComfyUI instance (default: http://127.0.0.1:8188) - **API Key**: Optional API key if authentication is enabled - **Workflow JSON**: The ComfyUI workflow in JSON format for text-to-audio generation - **Input Type**: Choose between Text Input or JSON Parameters - **Text Input**: Text to convert to audio (when using Text Input) - **JSON Parameters**: JSON object with advanced parameters (when using JSON Parameters input type) - **Voice Model**: Specify a voice model name (optional) - **Timeout**: Maximum time in minutes to wait for audio generation #### Input The node accepts text input in two ways: 1. **Text Input**: Provide direct text to be converted to audio 2. **JSON Parameters**: Provide a JSON object with text and additional parameters #### Outputs The node outputs the generated audio: - In the `binary.data` property with proper MIME type and file information - `fileName`: Name of the generated audio file - `data`: Base64 encoded audio data - `fileType`: The type of audio file (e.g., 'audio') - `fileSize`: Size of the audio in KB - `fileExtension`: File extension (wav, mp3, ogg, flac) - `mimeType`: MIME type of the audio ## Usage Examples ### Using the ComfyUI Text to Audio Node 1. Create a workflow in ComfyUI for text-to-audio generation 2. Export the workflow as JSON (API) 3. Add the ComfyUI Text to Audio node 4. Paste your workflow JSON 5. Select the appropriate Input Type: - For Text Input: Enter the text to convert to audio - For JSON Parameters: Provide a JSON object with 'text' and other parameters 6. Optionally specify a voice model 7. Configure timeout as needed 8. Execute the workflow to generate audio from your input text ## Error Handling The node includes comprehensive error handling for: - API connection issues - Invalid workflow JSON - Execution failures - Timeout conditions - Input validation ## Development ```bash # Install dependencies npm install # Build npm run build # Test npm run test # Lint npm run lint ``` ## License [MIT](LICENSE.md) --- # 한국어 문서 ## n8n-nodes-comfyui-text-to-audio 이 패키지는 [ComfyUI](https://github.com/comfyanonymous/ComfyUI)와 통합하는 n8n 노드를 제공합니다 - 그래프/노드 인터페이스가 있는 강력하고 모듈식 안정적인 확산 GUI입니다. ## 기능 - n8n에서 직접 ComfyUI 워크플로우 실행 - 안정적인 확산 모델을 사용하여 텍스트에서 오디오 생성 - 워크플로우 JSON 가져오기 지원 - 워크플로우 출력에서 자동 출력 검색 - 진행 모니터링 및 오류 처리 - API 키 인증 지원 - 구성 가능한 타임아웃 설정 ## 사전 요구 사항 - n8n (버전 1.0.0 이상) - ComfyUI 인스턴스가 실행 중이고 접근 가능 - Node.js 18 이상 ## 설치 ### 표준 설치 ```bash # npm 패키지에서 설치 (권장) npm install n8n-nodes-comfyui-text-to-audio # 또는 git 저장소에서 설치 npm install github:StudioExitt/n8n-nodes-comfyui-text-to-audio ``` ### Docker 설치 Docker 설치의 경우 다음 방법 중 하나를 사용할 수 있습니다: #### 방법 1: 볼륨 마운트 ```bash # 커스텀 노드용 디렉토리 생성 mkdir -p /path/to/custom/nodes # 저장소 클론 git clone https://github.com/StudioExitt/n8n-nodes-comfyui-text-to-audio.git /tmp/custom-nodes cd /tmp/custom-nodes # 의존성 설치 및 빌드 npm install npm run build # 빌드된 파일을 커스텀 노드 디렉토리에 복사 cp -r dist/* /path/to/custom/nodes/n8n-nodes-comfyui-text-to-audio/ # 커스텀 노드 디렉토리가 마운트된 n8n 실행 docker run -d \ --name n8n \ -p 5678:5678 \ -v /path/to/custom/nodes:/home/node/.n8n/custom/nodes \ n8nio/n8n ``` #### 방법 2: 커스텀 Docker 이미지 ```dockerfile # Dockerfile FROM n8nio/n8n # GitHub에서 커스텀 노드 패키지 설치 RUN cd /tmp && \ npm install github:StudioExitt/n8n-nodes-comfyui-text-to-audio && \ cp -r /tmp/node_modules/n8n-nodes-comfyui-text-to-audio /home/node/.n8n/custom/nodes/ && \ chown -R node:node /home/node/.n8n ``` 빌드 및 실행: ```bash docker build -t n8n-with-comfyui . docker run -d --name n8n -p 5678:5678 n8n-with-comfyui ``` #### 방법 3: Docker Compose ```yaml version: '3' services: n8n: image: n8nio/n8n container_name: n8n ports: - "5678:5678" volumes: - n8n_data:/home/node/.n8n - ./custom-nodes:/home/node/.n8n/custom/nodes environment: - N8N_PORT=5678 - N8N_PROTOCOL=http - NODE_ENV=production volumes: n8n_data: ``` 그 다음: ```bash # 저장소 클론 git clone https://github.com/StudioExitt/n8n-nodes-comfyui-text-to-audio.git /tmp/custom-nodes cd /tmp/custom-nodes # 의존성 설치 및 빌드 npm install npm run build # 빌드된 파일을 커스텀 노드 디렉토리에 복사 mkdir -p ./custom-nodes/n8n-nodes-comfyui-text-to-audio cp -r dist/* ./custom-nodes/n8n-nodes-comfyui-text-to-audio/ # docker-compose 설정 시작 docker-compose up -d ``` ## 노드 유형 ### ComfyUI Text to Audio 노드 이 노드를 사용하면 ComfyUI의 텍스트-오디오 기능을 사용하여 텍스트에서 오디오를 생성할 수 있습니다. #### 설정 - **API URL**: ComfyUI 인스턴스의 URL (기본값: http://127.0.0.1:8188) - **API Key**: 인증이 활성화된 경우 선택적 API 키 - **Workflow JSON**: 텍스트-오디오 생성을 위한 JSON 형식의 ComfyUI 워크플로우 - **Text**: 오디오로 변환할 텍스트 - **Voice Model**: 음성 모델 이름 지정 (선택사항) - **Timeout**: 오디오 생성을 기다리는 최대 시간(분) #### 입력 노드는 텍스트 입력을 받아 오디오로 변환합니다. #### 출력 노드는 생성된 오디오를 출력합니다: - 적절한 MIME 타입과 파일 정보가 포함된 `binary.data` 속성 - `fileName`: 생성된 오디오 파일의 이름 - `data`: Base64로 인코딩된 오디오 데이터 - `fileType`: 오디오 파일의 유형 (예: 'audio') - `fileSize`: 오디오 크기(KB) - `fileExtension`: 파일 확장자 (wav, mp3, ogg, flac) - `mimeType`: 오디오의 MIME 타입 ## 사용 예제 ### ComfyUI Text to Audio 노드 사용하기 1. ComfyUI에서 텍스트-오디오 생성을 위한 워크플로우 생성 2. 워크플로우를 JSON(API)으로 내보내기 3. ComfyUI Text to Audio 노드 추가 4. 워크플로우 JSON 붙여넣기 5. 오디오로 변환할 텍스트 입력 6. 선택적으로 음성 모델 지정 7. 필요에 따라 타임아웃 구성 8. 워크플로우를 실행하여 입력 텍스트에서 오디오 생성 ## 오류 처리 노드는 다음에 대한 포괄적인 오류 처리를 포함합니다: - API 연결 문제 - 잘못된 워크플로우 JSON - 실행 실패 - 타임아웃 조건 - 입력 유효성 검사 ## 개발 ```bash # 의존성 설치 npm install # 빌드 npm run build # 테스트 npm run test # 린트 npm run lint ``` ## 라이선스 [MIT](LICENSE.md) --- ## 변경 로그 ### v1.0.0 - 초기 릴리스 - ComfyUI 텍스트-오디오 생성 지원 - API 키 인증 지원 - 구성 가능한 타임아웃 - 바이너리 오디오 출력 지원 ## 기여 기여를 환영합니다! 이슈를 제출하거나 풀 리퀘스트를 생성해 주세요. ## 지원 문제가 발생하면 [GitHub Issues](https://github.com/StudioExitt/n8n-nodes-comfyui-text-to-audio/issues)에서 이슈를 생성해 주세요.