Giter Club home page Giter Club logo

volume-go's Introduction

volume-go Travis Build Status Go Report Card MIT License GoDoc

Volume control in Go

This is a Go language package for controlling audio volume.

CLI tool usage

install

 $ go get -u github.com/itchyny/volume-go/cmd/volume

get

Gets current volume.

 $ volume get 
20

set

Set volume to specified amount.

 $ volume set 40
 $ volume status
volume: 40
muted: false

up/down

Increase/decrease volume by specified amount, default 6.

 $ volume get
40
 $ volume up
 $ volume get
46

 $ volume up 4
 $ volume get
50

 $ volume down
 $ volume get
44
 $ volume down 4
 $ volume get
40

status

Get current volume and is muted.

 $ volume status
volume: 20
muted: false

mute/unmute

 $ volume mute
 $ volume status
volume: 20
muted: true

 $ volume unmute
 $ volume status
volume: 20
muted: false

Package usage

package main

import (
	"fmt"
	"log"

	"github.com/itchyny/volume-go"
)

func main() {
	vol, err := volume.GetVolume()
	if err != nil {
		log.Fatalf("get volume failed: %+v", err)
	}
	fmt.Printf("current volume: %d\n", vol)

	err = volume.SetVolume(10)
	if err != nil {
		log.Fatalf("set volume failed: %+v", err)
	}
	fmt.Printf("set volume success\n")

	err = volume.Mute()
	if err != nil {
		log.Fatalf("mute failed: %+v", err)
	}

	err = volume.Unmute()
	if err != nil {
		log.Fatalf("unmute failed: %+v", err)
	}
}

Bug Tracker

Report bug at Issues・itchyny/volume-go - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

volume-go's People

Contributors

itchyny avatar nicogranuja avatar patrick-motard avatar

Watchers

James Cloos avatar Akash Rajendra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.