8
n8n 中文网amn8n.com

音效生成器

中级

这是一个AI领域的自动化工作流,包含 12 个节点。主要使用 If, Wait, FormTrigger, GoogleDrive, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用CassetteAI生成逼真音效并保存到Google Drive

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "6MbJjFFQ8e6Lq8Rw",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "音效生成器",
  "tags": [],
  "nodes": [
    {
      "id": "4183ba34-e5a7-4ee1-866a-e6e725b51589",
      "name": "获取状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        660
      ],
      "parameters": {
        "url": "=https://queue.fal.run/cassetteai/sound-effects-generator/requests/{{ $('Create audio').item.json.request_id }}/status ",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d2b00c1e-be8b-4aeb-8b56-85659be7b607",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -100
      ],
      "parameters": {
        "color": 3,
        "width": 740,
        "height": 180,
        "content": "# 音效生成器"
      },
      "typeVersion": 1
    },
    {
      "id": "c3110e24-b0c1-440b-8971-fdfe3f065b72",
      "name": "完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        1020,
        660
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5ae7f107-0350-446b-90d3-13ea67969969",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        320
      ],
      "parameters": {
        "width": 740,
        "height": 100,
        "content": "## 步骤 2 - 主流程"
      },
      "typeVersion": 1
    },
    {
      "id": "c3872c07-05fd-4124-97f2-843365cfeb3b",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        120
      ],
      "parameters": {
        "width": 740,
        "content": "## 步骤 1 - 获取 API 密钥 (YOURAPIKEY)"
      },
      "typeVersion": 1
    },
    {
      "id": "c3189915-a6a5-4a1e-973c-d0552d1b95cb",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        600
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "设置步骤 2 中创建的 API 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "2de370c0-4c08-4154-8f93-c2856b983466",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        80,
        660
      ],
      "webhookId": "960dd363-daa5-47d2-b5dc-660c93fb5b05",
      "parameters": {
        "options": {},
        "formTitle": "Sound Effects Generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Prompt",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "Duration (max 30 sec.)",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Sound Effects Generator"
      },
      "typeVersion": 2.2
    },
    {
      "id": "83e7b9fa-13cd-48b2-81e3-2d9fd0f51410",
      "name": "等待 10 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        580,
        660
      ],
      "webhookId": "70185285-4ebd-45a3-9e49-bc0b99120fe9",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "8264d6a6-d174-474f-804c-17859327e2d1",
      "name": "创建音频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        660
      ],
      "parameters": {
        "url": "https://queue.fal.run/cassetteai/sound-effects-generator",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n     \"prompt\": \"{{ $json.Prompt }}\",\n     \"duration\": {{ $json['Duration (max 30 sec.)'] }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8b00e3d3-9d8a-4d0d-8971-1666c3158c66",
      "name": "获取音频 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        100,
        1000
      ],
      "parameters": {
        "url": "=https://queue.fal.run/cassetteai/sound-effects-generator/requests/{{ $json.request_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cda508d2-2f10-4d48-8196-f17e20dbb416",
      "name": "上传音频",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        560,
        1000
      ],
      "parameters": {
        "name": "={{ $now.format('yyyyLLddHHmmss') }}.{{ $json.audio_file.file_name }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ",
          "cachedResultName": "Fal.run"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HEy5EuZkgPZVEa9w",
          "name": "Google Drive account (n3w.it)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ca095dda-3ac1-4e08-ad67-c4cdea232271",
      "name": "获取音频文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        1000
      ],
      "parameters": {
        "url": "={{ $json.audio_file.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d6d655d2-8ec6-4807-b17e-fea5d18a9f80",
  "connections": {
    "Completed?": {
      "main": [
        [
          {
            "node": "Get Audio Url",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 10 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create audio": {
      "main": [
        [
          {
            "node": "Wait 10 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Audio": {
      "main": [
        []
      ]
    },
    "Wait 10 sec.": {
      "main": [
        [
          {
            "node": "Get status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Audio Url": {
      "main": [
        [
          {
            "node": "Get Audio File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Audio File": {
      "main": [
        [
          {
            "node": "Upload Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Create audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量12
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 查看

分享此工作流