Go bindings for the PortAudio audio I/O library

portaudio

This package provides an interface to the PortAudio audio I/O library. See the package documentation for details.

To build this package you must first have the PortAudio development headers and libraries installed. Some systems provide a package for this; e.g., on Ubuntu you would want to run apt-get install portaudio19-dev. On other systems you might have to install from source.

Thanks to sqweek for motivating and contributing to host API and device enumeration.

Comments
  • Go 1.6beta1 - Changes to CGO pointer passing break portaudio

    Go 1.6beta1 - Changes to CGO pointer passing break portaudio

    Hi,

    I tried compiling portaudio against the new golang 1.6 beta 1 release and it breaks port audio bindings. As a part of 1.6 they tighten the rules regarding Go pointers being passed into C memory.

    This means that while programs compile, at run-time they abort. See below for the noise.go example from the distribution.

    This example worked fine on 1.5.x and lower.

    The related changes are described in https://github.com/golang/go/issues/12416.

    $ ./noise.exe
    panic: runtime error: cgo argument has Go pointer to Go pointer
    
    goroutine 1 [running]:
    github.com/gordonklaus/portaudio._cgoCheckPointer1(0x4b8d00, 0x1298e230, 0x0, 0x0, 0x0, 0x4b1dc0)
            ??:0 +0x41
    github.com/gordonklaus/portaudio.OpenStream(0x0, 0x0, 0x0, 0x0, 0x12988300, 0x2, 0x989680, 0x0, 0x0, 0x40e58880, ...)
            C:/Users/april/Projects/super-eight/GoPath/src/github.com/gordonklaus/portaudio/portaudio.go:504 +0x2f5
    main.main()
            c:/Users/april/Projects/super-eight/GoPath/src/github.com/gordonklaus/portaudio/examples/noise.go:18 +0x104
    
  • Playback issue with 24 bitsPerSample audio content

    Playback issue with 24 bitsPerSample audio content

    Hi, unfortunately I am not able to play back 24/96 flac files. Such content usually gives me an "Output underflowed" error message or just trash noise. Here some free 24bps content:

    http://www.lindberg.no/hires/test/2L-125_stereo-88k-24b_04.flac

    When I call OpenDefaultStream(), do I have to hand over a buffer created with make([]portaudio.Int24,framesPerBuffer) instead of make([]int16,framesPerBuffer)? Anything else I should be aware of when trying to play back 24bps audio content? Thank you.

  • cross-compiling

    cross-compiling

    Hi! I'm using MacOS, and would like to create app that works with microphone, ready-to-use on any platform (Windows, Linux, Mac)... so the question is - how to achieve this on my Mac? Or... from any other OS (not a big deal to use Vagrant and build from there).

  • Working example with go-mpg123

    Working example with go-mpg123

    I'm working on a project where I will be using go-mpg123 (a port of the libmpg123 bindings in golang) but I'm having a hard time getting that library to play nicely with port audio.

    I've gotten reasonably far in this gist but the audio playback is really distorted for some reason and I cant figure out what would be the issue.

    Has anyone been able to get these two libraries successfully working together, and if so is there anything blatantly wrong with my code example? If I'm able to get something working, would this be a good candidate for the examples directory?

  • unable to open on a device

    unable to open on a device

    Hi everyone,

    First of all, great job everyone involved in the construction of this piece of software.

    I have been using portaudio very successfully for the past weeks for developing a low delay app for musicians https://bitbucket.org/claudio_ortega/jambridge/src/master/doc/jambridge-README.md

    Here's the bad news, I've run today into an issue, which seems to be very likely system dependent.

    I am using an AudioBox USB96 interface, which has been working and still works just fine. Please find at the bottom the test case with the minimum piece of code that shows the failure. The problem is in the call to OpenStream() which returns "PortAudio Internal Error"

    The test passes in these two test beds:

    • (1) ubuntu 20.02 box
    • (2) iMac Late 2009 running Catalina (w/dosdude adaptor)

    The exact same test does not pass in my third test bed:

    • (3) Mac Mini 2018 w/ Big Sur.

    In all cases I am with go1.15.x, and I have no 'user' applications opened. Also in all cases I've verified that the name for the device picked up by the call to DefaultInputDevice is always the same: "AudioBox USB 96", which is the one that I expect and the one I want.

    The audio parameters used in the test are: 44.1k/64samples/16bits/1channel. However, I've tried with different combinations of sampling freq and buffer length, all working fine on 1,2 above, but none of those have worked on (3).

    I hope somebody has run into this issue, and hopefully might shed some light on it.

    Thanks again for the great work put on this library.

    Claudio

    package audiotest
    
    import (
    	"testing"
    	"time"
    	"github.com/gordonklaus/portaudio"
    )
    
    func TestBigSurIssue(t *testing.T) {
    
    	err := portaudio.Initialize()
    	checkErr(t, err)
    
    	inputDeviceInfo, err := portaudio.DefaultInputDevice()
    	checkErr(t, err)
    
    	streamParameters := portaudio.LowLatencyParameters(inputDeviceInfo, nil)
    	streamParameters.SampleRate = 44100.0
    	streamParameters.FramesPerBuffer = 64
    	streamParameters.Input.Channels = 1
    	streamParameters.Input.Latency = time.Millisecond
    
    	_, err = portaudio.OpenStream(
    		streamParameters,
    		func(in []int16,
    			outIgnore []int16,
    			timeInfo portaudio.StreamCallbackTimeInfo,
    			flags portaudio.StreamCallbackFlags,
    		) {
    		})
    	checkErr(t, err)
    
    	err = portaudio.Terminate()
    	checkErr(t, err)
    }
    
    func checkErr(t testing.TB, err error) {
    	if err != nil {
    		t.Fatal(err)
    	}
    }
    
    
  • Issues installing on Windows

    Issues installing on Windows

    Hi,

    I am trying to attach to audio streams on windows with go and have found many sources pointing to this package but I am having issues when running the go get command. Here are the steps I have taken so far:

    1. Downloaded the source for PortAudio
    2. Followed the instructions found here: https://github.com/PortAudio/portaudio/wiki/Notes_about_building_PortAudio_with_MinGW
    3. Added my PortAudio path to my PKG_CONFIG_PATH environment variable
    4. Run go get github.com/gordonklaus/portaudio

    When I run the final command I get this error:

    # github.com/gordonklaus/portaudio
    C:\Users\user\go\pkg\mod\github.com\gordonklaus\[email protected]\portaudio.go:16:10: fatal error: portaudio.h: No such file or directory
       16 | #include <portaudio.h>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    

    When looking at the file mentioned here I find that line 16 is contained in a multi line comment, so the fact that it is complaining makes no sense to me. Is there something that I have done wrong?

  • Running mp3 example with hajimehoshi/go-mp3 library

    Running mp3 example with hajimehoshi/go-mp3 library

    Hi!

    I am trying to reproduce the mp3 example but using a different mp3 library. My current attempt is available in this gist.

    The code compiles, the sound is playing, but it is heavily distorted - there is a glitch per each read-write cycle. One can see that by tweaking the bufsize variable - the smaller the buffer, the higher the glitching frequency.

    I took a look at this issue, but I cannot quite figure out what is the problem in my case :(

    Thanks! Yuriy

  • error on goinstall

    error on goinstall

    What steps will reproduce the problem?
    1. use `goinstall portaudio-go.googlecode.com/hg/portaudio`
    
    What to expect: install without errors
    
    What do you see instead?
    
    bart@bart-laptop:~$ goinstall portaudio-go.googlecode.com/hg/portaudio
    /bin/bash: === cd 
    /home/bart/go/src/pkg/portaudio-go.googlecode.com/hg/portaudio; bash gomake -f- 
    install
    CGOPKGPATH=portaudio-go.googlecode.com/hg cgo --  portaudio.go 
    error: 'getPaStreamCallback' undeclared (first use in this function)
    error: (Each undeclared identifier is reported only once
    error: 'paContinue' undeclared (first use in this function)
    unresolved names
    make: *** [_obj/_cgo_run] Error 2
    --- exit status 2
    goinstall: portaudio-go.googlecode.com/hg/portaudio: install: running bash: 
    exit status 2 ($GOPATH not set)
    
    
    What version of the product are you using? On what operating system?
    bart@bart-laptop:~$ 8g -V
    8g version release.r60.3 9516
    
    bart@bart-laptop:~$ uname -a
    Linux bart-laptop 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:35:14 UTC 2011 
    i686 GNU/Linux
    
    bart@bart-laptop:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 10.04.3 LTS
    Release:    10.04
    Codename:   lucid
    
    

    Original issue reported on code.google.com by [email protected] on 15 Jan 2012 at 9:41

  • windows dll

    windows dll

    Hi, I'm trying to include portaudio in my go project for windows, but when i run, it ask for libportaudio-2.dll If i add the dll in the same folder of built exe it works, but i would to know if i can include the libportaudio-2.dll in the exe so that i can distribute it standalone.

    Thanks

  • fatal error: unexpected signal during runtime execution

    fatal error: unexpected signal during runtime execution

    Hi,

    I'm using this library to read an audio stream (of a click track) and determine when a click happens to start a playback of a light show. Unfortunately the program crashed every now and then, but not in a reproducible interval. The error thrown is the following - any idea what's going on there? :(

    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0xb pc=0x76cc3e4c]
    runtime stack:
    runtime.throw(0x469cbf, 0x2a)
           /usr/local/go/src/runtime/panic.go:617 +0x5c
    runtime.sigpanic()
           /usr/local/go/src/runtime/signal_unix.go:374 +0x3fc
    goroutine 93703 [syscall]:
    runtime.cgocall(0x39fcf0, 0xc285b4, 0xd5c784)
           /usr/local/go/src/runtime/cgocall.go:128 +0x5c fp=0xc2859c sp=0xc28584 pc=0x150fc
    github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio._Cfunc_Pa_OpenStream(0xd5c784, 0xcf35e0, 0x0, 0x0, 0x40e58880, 0x40, 0x0, 0x0, 0x15, 0x0)
           _cgo_gotypes.go:498 +0x38 fp=0xc285b0 sp=0xc2859c pc=0x1f5e60
    github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio.OpenStream.func1(0xd5c780, 0xcf0100, 0x1, 0x213766b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio/portaudio.go:641 +0x168 fp=0xc285fc sp=0xc285b0 pc=0x1f9480
    github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio.OpenStream(0xcf0100, 0x1, 0x213766b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40e58880, ...)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio/portaudio.go:641 +0xa4 fp=0xc2865c sp=0xc285fc pc=0x1f7360
    github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio.OpenDefaultStream(0x1, 0x0, 0x0, 0x40e58880, 0x40, 0x100bd40, 0x1, 0x1, 0x40007, 0x0, ...)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/gordonklaus/portaudio/portaudio.go:677 +0xa0 fp=0xc286dc sp=0xc2865c pc=0x1f74d4
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start(0xcf9aa0, 0xb, 0xc0ab80)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:37 +0x17c fp=0xc28734 sp=0xc286dc pc=0x1fb604
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).Wait(0xcf9aa0, 0xe58a00, 0xe58a40, 0x8082d4, 0x0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:87 +0x20 fp=0xc287bc sp=0xc28734 pc=0x1fba78
    github.com/StageAutoControl/controller/pkg/cntl/playback.(*Player).wait.func2(0x100bd38, 0xe58a00, 0xe58a40, 0xcf9ad0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/playback/player.go:83 +0x38 fp=0xc287dc sp=0xc287bc pc=0x1fe0cc
    runtime.goexit()
           /usr/local/go/src/runtime/asm_arm.s:868 +0x4 fp=0xc287dc sp=0xc287dc pc=0x6fc78
    created by github.com/StageAutoControl/controller/pkg/cntl/playback.(*Player).wait
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/playback/player.go:82 +0xe4
    goroutine 1 [IO wait]:
    internal/poll.runtime_pollWait(0x635c0ef8, 0x72, 0x0)
           /usr/local/go/src/runtime/netpoll.go:182 +0x48
    internal/poll.(*pollDesc).wait(0xd5d874, 0x72, 0x0, 0x0, 0x456184)
           /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x80
    internal/poll.(*pollDesc).waitRead(...)
           /usr/local/go/src/internal/poll/fd_poll_runtime.go:92
    internal/poll.(*FD).Accept(0xd5d860, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
           /usr/local/go/src/internal/poll/fd_unix.go:384 +0x1b0
    net.(*netFD).accept(0xd5d860, 0xfed9253, 0xcabf6ecc, 0x898)
           /usr/local/go/src/net/fd_unix.go:238 +0x20
    net.(*TCPListener).accept(0xc10f08, 0x0, 0x1, 0x13bbc)
           /usr/local/go/src/net/tcpsock_posix.go:139 +0x20
    net.(*TCPListener).AcceptTCP(0xc10f08, 0x10926a0, 0xc96f8900, 0x49e98)
           /usr/local/go/src/net/tcpsock.go:247 +0x40
    net/http.tcpKeepAliveListener.Accept(0xc10f08, 0xdc6cb0, 0xc, 0xc000e0, 0x3185c0)
           /usr/local/go/src/net/http/server.go:3264 +0x1c
    net/http.(*Server).Serve(0xd50400, 0x4fbc08, 0xc10f08, 0x0, 0x0)
           /usr/local/go/src/net/http/server.go:2859 +0x1e4
    net/http.(*Server).ListenAndServe(0xd50400, 0x4, 0x45b23e)
           /usr/local/go/src/net/http/server.go:2797 +0xd4
    github.com/StageAutoControl/controller/pkg/api/server.(*Server).Run(0xcf80f0, 0x4fc1e8, 0xcf2840, 0xc183d0, 0xc, 0xc18301, 0x0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/api/server/server.go:110 +0x3e0
    github.com/StageAutoControl/controller/cmd.glob..func4(0x7c79d8, 0xd00170, 0x0, 0x2)
           /etc/controller/src/github.com/StageAutoControl/controller/cmd/server.go:46 +0x304
    github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra.(*Command).execute(0x7c79d8, 0xd00140, 0x2, 0x2, 0x7c79d8, 0xd00140)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra/command.go:766 +0x204
    github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x7c78a8, 0xc6a030, 0x0, 0x1)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra/command.go:850 +0x1f0
    github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra.(*Command).Execute(...)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/spf13/cobra/command.go:800
    github.com/StageAutoControl/controller/cmd.Execute()
           /etc/controller/src/github.com/StageAutoControl/controller/cmd/root.go:64 +0x24
    main.main()
           /etc/controller/src/github.com/StageAutoControl/controller/main.go:12 +0x14
    goroutine 19 [syscall, 124 minutes]:
    os/signal.signal_recv(0x0)
           /usr/local/go/src/runtime/sigqueue.go:139 +0x130
    os/signal.loop()
           /usr/local/go/src/os/signal/signal_unix.go:23 +0x14
    created by os/signal.init.0
           /usr/local/go/src/os/signal/signal_unix.go:29 +0x30
    goroutine 35 [chan receive, 124 minutes]:
    github.com/StageAutoControl/controller/vendor/github.com/apinnecke/go-exitcontext.NewWithContext.func1(0xcf06c0, 0xcf6220)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/apinnecke/go-exitcontext/context.go:23 +0x24
    created by github.com/StageAutoControl/controller/vendor/github.com/apinnecke/go-exitcontext.NewWithContext
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/apinnecke/go-exitcontext/context.go:22 +0xc8
    goroutine 4 [chan receive, 124 minutes]:
    github.com/StageAutoControl/controller/cmd.glob..func2.1()
           /etc/controller/src/github.com/StageAutoControl/controller/cmd/root.go:46 +0x40
    created by github.com/StageAutoControl/controller/cmd.glob..func2
           /etc/controller/src/github.com/StageAutoControl/controller/cmd/root.go:45 +0x1cc
    goroutine 5 [chan receive, 124 minutes]:
    github.com/StageAutoControl/controller/pkg/process.(*manager).listenExit(0xc0c660)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/process/manager.go:37 +0x3c
    created by github.com/StageAutoControl/controller/pkg/process.NewManager
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/process/manager.go:31 +0x90
    goroutine 6 [select]:
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).pollReplyLoop(0xd56000)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:132 +0xf0
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).Start
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:110 +0x5c4
    goroutine 7 [select]:
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).recvLoop(0xd56000)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:222 +0x9c
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).Start
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:111 +0x5e0
    goroutine 8 [select]:
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).sendLoop(0xd56000)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:158 +0x80
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).Start
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:112 +0x5fc
    goroutine 21 [IO wait]:
    internal/poll.runtime_pollWait(0x635c0f7c, 0x72, 0x0)
           /usr/local/go/src/runtime/netpoll.go:182 +0x48
    internal/poll.(*pollDesc).wait(0xd5d7d4, 0x72, 0x1000, 0x1000, 0x0)
           /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x80
    internal/poll.(*pollDesc).waitRead(...)
           /usr/local/go/src/internal/poll/fd_poll_runtime.go:92
    internal/poll.(*FD).ReadFrom(0xd5d7c0, 0xd32f70, 0x1000, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0)
           /usr/local/go/src/internal/poll/fd_unix.go:219 +0x16c
    net.(*netFD).readFrom(0xd5d7c0, 0xd32f70, 0x1000, 0x1000, 0x1, 0x1, 0x3fe14, 0x75a78, 0x176c30)
           /usr/local/go/src/net/fd_unix.go:208 +0x38
    net.(*UDPConn).readFrom(0xc10e58, 0xd32f70, 0x1000, 0x1000, 0x178304, 0xc1807c, 0x4, 0x4)
           /usr/local/go/src/net/udpsock_posix.go:47 +0x38
    net.(*UDPConn).ReadFromUDP(0xc10e58, 0xd32f70, 0x1000, 0x1000, 0x4, 0x4, 0x1, 0x0)
           /usr/local/go/src/net/udpsock.go:109 +0x44
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).recvLoop.func1(0xd56000)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:189 +0x6c
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Node).recvLoop
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/node.go:186 +0x30
    goroutine 10 [select]:
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Controller).pollLoop(0xc524c0)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/controller.go:171 +0x190
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Controller).Start
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/controller.go:130 +0x300
    goroutine 11 [runnable]:
    github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Controller).dmxUpdateLoop(0xc524c0)
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/controller.go:248 +0x730
    created by github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet.(*Controller).Start
           /etc/controller/src/github.com/StageAutoControl/controller/vendor/github.com/jsimonetti/go-artnet/controller.go:131 +0x31c
    goroutine 12 [chan receive, 3 minutes]:
    github.com/StageAutoControl/controller/pkg/artnet.(*controller).sendBackground(0xc0c600)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/artnet/controller.go:106 +0x138
    created by github.com/StageAutoControl/controller/pkg/artnet.(*controller).Start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/artnet/controller.go:65 +0x118
    goroutine 13 [chan receive]:
    github.com/StageAutoControl/controller/pkg/artnet.(*controller).debugDevices(0xc0c600)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/artnet/controller.go:127 +0x90
    created by github.com/StageAutoControl/controller/pkg/artnet.(*controller).Start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/artnet/controller.go:66 +0x134
    goroutine 14 [chan receive, 124 minutes]:
    github.com/StageAutoControl/controller/pkg/api/server.(*Server).Run.func2(0x4fc1e8, 0xcf2840, 0xd50400, 0xcf80f0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/api/server/server.go:102 +0x38
    created by github.com/StageAutoControl/controller/pkg/api/server.(*Server).Run
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/api/server/server.go:101 +0x358
    goroutine 81119 [chan send, 11 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xf40090)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xf40090)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xf40090)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 53503 [chan send, 32 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xf40b10)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xf40b10)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xf40b10)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 31760 [chan send, 78 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xcfc0c0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xcfc0c0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xcfc0c0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 577 [chan send, 117 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xcfcb40)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xcfcb40)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xcfcb40)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 10364 [chan send, 110 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0x1038ab0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0x1038ab0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0x1038ab0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 69747 [chan send, 18 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0x1038030)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0x1038030)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0x1038030)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 47837 [chan send, 38 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xc962d0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xc962d0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xc962d0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 34366 [chan send, 68 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xcfc150)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xcfc150)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xcfc150)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 49019 [chan send, 38 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xff2210)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xff2210)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xff2210)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 43926 [chan send, 41 minutes]:
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).notifyWait(0xf40000)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:81 +0x44
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).checkForPeak(0xf40000)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:73 +0x60
    github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).readStream(0xf40000)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:59 +0x3c
    created by github.com/StageAutoControl/controller/pkg/cntl/waiter.(*Audio).start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/waiter/audio.go:46 +0x334
    goroutine 93701 [select]:
    github.com/StageAutoControl/controller/pkg/cntl/playback.(*Player).wait(0xcf9ad0, 0x4fc1e8, 0x10b6cc0, 0x0, 0x0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/playback/player.go:89 +0x1b4
    github.com/StageAutoControl/controller/pkg/cntl/playback.(*Player).PlaySong(0xcf9ad0, 0x4fc1e8, 0x10b6cc0, 0x10d2c30, 0x24, 0x0, 0x0)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/playback/player.go:112 +0x1c4
    github.com/StageAutoControl/controller/pkg/cntl/playback.(*Process).Start(0xc53400, 0x4fc1e8, 0xcf2840, 0x10b0470, 0x6fc7c)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/cntl/playback/process.go:72 +0x370
    github.com/StageAutoControl/controller/pkg/process.(*manager).Start.func1(0xc53440, 0xc0c660, 0x457548, 0x8)
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/process/manager.go:94 +0x3c
    created by github.com/StageAutoControl/controller/pkg/process.(*manager).Start
           /etc/controller/src/github.com/StageAutoControl/controller/pkg/process/manager.go:93 +0x1d0
    

    This is the code which reads the stream (Initialize and Terminate are called once on programm start and exit), with the line throwing the error marked: https://github.com/StageAutoControl/controller/blob/master/pkg/cntl/waiter/audio.go#L37

    Looking forward to any helpful input - and thanks in advance! Alex

    EDIT: Cleaned up log for readability, removing systemd infos.

  • Determining FramesPerBuffer For Infinite Stream Time

    Determining FramesPerBuffer For Infinite Stream Time

    Currently I am working to record audio via the input device and send it through a TCP Conn to a client who will then use the same library to play the audio. Before I have tried to face the issue of piping the stream data to a socket I wanted to figure out how to approach the issue of streaming for an unknown or infinite amount of time. Programmatically how would I go about this process as some of the OpenDefaultStream requires a length of frames per buffer to be provided but how could that be done if I plan to stream data indefinitely between an input device through a socket connection to an output device on another machine with no time limit?

  • play.go example aiff file sounds

    play.go example aiff file sounds "strange"

    Trying to playback an aiff file with the play.go example, playback is almost correct still the sound is weird like there is some kind of bandpass filter shadowing a frequency range. There is no problem with the file it plays correctly in other players. Are all files supposed to play correctly in the example or maybe I should change the some configurations ?

    Not sure if this is a problem with the code or it is supposed to be that way. Thanks for any support

  • " doesn't work">

    "go install " doesn't work

    Hello. As I mentioned at the title, go install command does not work to install your package.

    I tried "go get" command on Mac , instead of "go install", it does work but on Windows it doesn't. Please let me know how to install your portaudio package.

    my GO env GO111MODULE = on GOVERSION = go1.19.1

  • MacOS compile Windows error

    MacOS compile Windows error

    Hello! Is it real to compile portaudio for windows from macos?

    I using this payload to go this: GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="x86_64-w64-mingw32-gcc" go build -o recorder_v1.exe but gettting error: x86_64-w64-mingw32-gcc: error: unrecognized command-line option '-framework x4 Could you tell how fix it, pls?

Mini audio library

malgo Go bindings for miniaudio library. Requires cgo but does not require linking to anything on the Windows/macOS and it links only -ldl on Linux/BS

Dec 31, 2022
Package flac provides access to FLAC (Free Lossless Audio Codec) streams.

flac This package provides access to FLAC (Free Lossless Audio Codec) streams. Documentation Documentation provided by GoDoc. flac: provides access to

Jan 5, 2023
GAAD (Go Advanced Audio Decoder)

GAAD (Go Advanced Audio Decoder) Package currently provides AAC parsing capabilities. This package performs a full parse of AAC-LC and HE-AACv1 bitstr

Oct 24, 2022
Go tools for audio processing & creation ?

GoAudio ? GoAudio is an audio processing library, currently supporting WAVE files, although some tools such as the synth and breakpoints are encoding

Dec 23, 2022
Sequence-based Go-native audio mixer for music apps

Mix https://github.com/go-mix/mix Sequence-based Go-native audio mixer for music apps See demo/demo.go: package main import ( "fmt" "os" "time"

Dec 1, 2022
Go package capable of generating waveform images from audio streams. MIT Licensed.

waveform Go package capable of generating waveform images from audio streams. MIT Licensed. This library supports any audio streams which the azul3d/e

Nov 17, 2022
CLI audio player written in go.
CLI audio player written in go.

A very minimal CLI audio player.

Dec 13, 2022
alto is a program built for audio management.
alto is a program built for audio management.

alto, a music organizer alto is a program built for audio management. It's purpose is to provide the user the means to create a path construct to move

Oct 10, 2022
Terrible Audio Downloader

Terrible Audio Downloader This is just a small go project I did for myself, to manage my audio library to get away from spotify. All it does is downlo

Oct 30, 2021
Audio visualizer in Go
Audio visualizer in Go

demo_audio_visualizer Simple audio visualizer in Go Used libraries: raylib-go go-mp3 oto go-dsp To disable the additional console window on Windows OS

Dec 4, 2022
libsox bindings for go

gosox "SoX − Sound eXchange, the Swiss Army knife of audio manipulation" Go bindings for the libsox sound library For more information and documentati

Nov 22, 2022
Go bindings for libportmidi

portmidi Want to output to an MIDI device or listen your MIDI device as an input? This package contains Go bindings for PortMidi. libportmidi (v. 217)

Dec 25, 2022
Golang bindings for libmediainfo

mediainfo Golang binding for libmediainfo Duration, Bitrate, Codec, Streams and a lot of other meta-information about media files can be extracted thr

Nov 16, 2022
? ID3 decoding and encoding library for Go

id3v2 Supported ID3 versions: 2.3, 2.4 Installation go get -u github.com/bogem/id3v2 Usage example package main import ( "fmt" "log" "github.com

Dec 31, 2022
♪ A low-level library to play sound on multiple platforms ♪

Oto (音) A low-level library to play sound. This package offers io.WriteCloser to play PCM sound. Platforms Windows macOS Linux FreeBSD OpenBSD Android

Jan 4, 2023
EasyMidi is a simple and reliable library for working with standard midi file (SMF)

EasyMidi EasyMidi is a simple and reliable library for working with standard midi file (SMF). Installing A step by step series of examples that tell y

Sep 21, 2022
Go library for searching on YouTube Music.

ytmusic Go library for searching on YouTube Music and getting other useful information. Installing go get github.com/raitonoberu/ytmusic Usage Search

Oct 15, 2022
Small application to convert my music library folder structure to 'crates' in the open-source DJ software Mixxx

Small application to convert my music library folder structure to 'crates' in the open-source DJ software Mixxx

Nov 18, 2022
Local-audio - Web walking audio tour platform proof-of-concept

Goal: Proof of concept for a Web Audio walk platform Data retention dynamdo db "time to live" expires in 1 day from creation of record set in add.go s

Jan 9, 2022
A ocilloscope writen in GO. Supported serial input, portaudio input.

A ocilloscope writen in GO. Supported serial input, portaudio input.

Oct 23, 2021