dalloriam / websynth

Experimental API-Controlled synthesizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebSynth

Requirements

  • Portaudio

Running the synth

$ go get ./...
$ go run main.go

Note: if the application panics with a message related to an invalid number of channels, you can try adjusting the devices used by portaudio. I will implement proper device detection with the next releases.

Using the synth

The synthesizer is controllable via a GraphQL API running on http://localhost:8080/synth.

Display Mixer Status

query {
    Mixer {
        Channels {
            Pan {
                Value
            }
            Volume {
                Value
            }
        }
    }
}

Adjust a mixer channel's volume and pan

mutation {
    Mixer {
        Channel(Idx: 0) {
            Volume {
                Set(Value: 1)
            }
            Pan {
                Set(Value: -1)
            }
        }
    }
}

List Available Modules

Note: For now, WebSynth only supports the oscillator module. This will obviously improve in the next releases.

query {
    Modules {
        List {
            ... on Oscillator {
                Frequency {
                    Value
                }
                Volume {
                    Value
                }
            }	
        }
    }
}

Create an Oscillator

mutation {
    Modules {
        Create {
            Oscillator 
        }
    }
}

Attach a module to a mixer channel

mutation {
    Mixer {
        Channel(Idx: 0) {
            Input {
                Attach(ModuleIdx: 0, ModuleField: "Sine") 
            }
        }
    }
}

Detach a module from a mixer channel

mutation {
    Mixer {
        Channel(Idx: 0) {
            Input {
                Detach
            }
        }
    }
}

Modify a module

Note: This obviously assumes that module 0 is an oscillator.

mutation {
    Module(Idx: 0) {
        ...on OscillatorMutation {
            Frequency {
                Set(Value: 200)
            }
        }
    }
}

About

Experimental API-Controlled synthesizer


Languages

Language:Go 33.3%Language:TypeScript 31.3%Language:JavaScript 30.4%Language:HTML 4.5%Language:CSS 0.5%