Skip to content

nfacha/voicemeeter-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Voicemeeter REST API

A REST API for controlling Voicemeeter parameters. This API allows you to control input strips and output buses, including their gain levels and mute states.

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/nfacha/voicemeeter-rest-api.git
cd voicemeeter-rest-api
  1. Install dependencies:
go mod tidy
  1. Run the server:
go run main.go

The server will start on port 4260.

API Endpoints

Input Strips (0-4)

Get Strip State

GET /api/strips/{id}

Response:

{
    "gain": 0.0,
    "mute": false
}

Set Strip Gain

PUT /api/strips/{id}/gain

Request body:

{
    "gain": -6.0
}

Set Strip Mute

PUT /api/strips/{id}/mute

Request body:

{
    "mute": true
}

Toggle Strip Mute

PUT /api/strips/{id}/mute/toggle

Response:

{
    "gain": 0.0,
    "mute": true
}

Output Buses (0-7)

Get Bus State

GET /api/bus/{id}

Response:

{
    "gain": 0.0,
    "mute": false
}

Set Bus Gain

PUT /api/bus/{id}/gain

Request body:

{
    "gain": -6.0
}

Set Bus Mute

PUT /api/bus/{id}/mute

Request body:

{
    "mute": true
}

Toggle Bus Mute

PUT /api/bus/{id}/mute/toggle

Response:

{
    "gain": 0.0,
    "mute": true
}

Notes

  • Strip IDs range from 0 to 4 (5 input channels)
  • Bus IDs range from 0 to 7 (8 output channels)
  • Gain values are in decibels (dB)
  • All endpoints return JSON responses
  • Error responses include an error message and appropriate HTTP status code

Example Usage with cURL

Get strip 0 state:

curl http://localhost:4260/api/strips/0

Set strip 1 gain to -6dB:

curl -X PUT http://localhost:4260/api/strips/1/gain -H "Content-Type: application/json" -d '{"gain": -6.0}'

Toggle strip 2 mute:

curl -X PUT http://localhost:4260/api/strips/2/mute/toggle

Get bus 3 state:

curl http://localhost:4260/api/bus/3

Set bus 4 mute:

curl -X PUT http://localhost:4260/api/bus/4/mute -H "Content-Type: application/json" -d '{"mute": true}'

Toggle bus 5 mute:

curl -X PUT http://localhost:4260/api/bus/5/mute/toggle

Error Handling

The API returns appropriate HTTP status codes and error messages in JSON format:

{
    "error": "Strip ID out of range (valid range: 0-4)"
}

Common error codes:

  • 400: Bad Request (invalid input)
  • 500: Internal Server Error