API Documentation

호흡음 분리 API

개요

호흡음 분리 API는 사용자가 업로드한 혼합 오디오 파일에서 호흡음과 소음을 분리하는 딥러닝 기반 서비스입니다.
분리 가능 소음: 강아지 짖는 소리, 발자국 소리, 샤워 소리, 가구 끄는 소리


오디오 분리 예시 및 다운로드

샘플 1: 폐음 + 강아지 짖는 소리

혼합 오디오 (Mixture)


mixturesample1_lung_dog.wav 다운로드

분리된 폐음 (Lung Sound)


singlesample1_lung.wav 다운로드

분리된 강아지 소리 (Dog Sound)


singlesample1_dog.wav 다운로드


샘플 2: 폐음 + 발걸음 소리

혼합 오디오 (Mixture)


mixturesample2_lung_footstep.wav 다운로드

분리된 폐음 (Lung Sound)


singlesample2_lung.wav 다운로드

분리된 발걸음 소리 (Footstep Sound)


singlesample2_footstep.wav 다운로드


API 엔드포인트

POST https://medisensing.kr/api/respsep/separate

인증 방식은 마이페이지에서 발급된 토큰을 사용합니다.


요청 (Request)

요청 헤더

Content-Type: multipart/form-data
X-API-Key: <api_key>

요청 파라미터

이름 타입 필수 설명
file file O 혼합 오디오 파일 (WAV, 최대 100MB, 권장 30초 이내)

응답 (Response)

성공 응답 (200 OK)

{
  "status": "success",
  "job_id": "abc123xyz",
  "duration": 8.35,
  "sample_rate": 44100,
  "n_sources": 2,
  "files": [
    {
      "type": "mixture",
      "filename": "mixture.wav",
      "path": "/api/respsep/result/abc123xyz/mixture.wav"
    },
    {
      "type": "source_1",
      "filename": "lung.wav",
      "path": "/api/respsep/result/abc123xyz/lung.wav"
    },
    {
      "type": "source_2",
      "filename": "noise.wav",
      "path": "/api/respsep/result/abc123xyz/noise.wav"
    }
  ]
}

오류 응답 예시

{
  "detail": "Invalid API key"
}

가능한 오류 코드 - 400 Bad Request: 파일 누락 또는 형식 오류 - 401 Unauthorized: 잘못된 API 키 - 413 Payload Too Large: 파일 크기 초과 - 500 Internal Server Error: 서버 내부 오류


샘플 요청

cURL

curl -X POST "https://medisensing.kr/api/respsep/separate"   -H "X-API-Key: YOUR_API_KEY"   -F "file=@mixturesample1_lung_dog.wav"

JavaScript (fetch)

const formData = new FormData();
formData.append("file", fileInput.files[0]);

fetch("https://medisensing.kr/api/respsep/separate", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY"
  },
  body: formData
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);

직접 테스트 (Demo)



응답 미리보기






참고

  • 지원 형식: WAV
  • 권장 길이: 30초 이내
  • 권장 크기: 100MB 이하
  • 처리 시간: 오디오 길이에 따라 1–10초 소요