summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
14 daysUpdate CHANGELOG.md for version 0.2.1HEADv0.2.1mainxegineering
14 dayspipewire: Assert OS is GNU / Linuxxegineering
PipeWire is a Linux-specific sound system. This commit adds a proper error if the operating is not matching.
14 dayspipewire: Make sure only one instance is runningxegineering
The init / deinit of the PipeWire C library is not well handled for multiple instances. Furthermore the PipeWire audio streaming relies on a channel which is a global variable. Both issues have to be fixed before multiple PipeWire capture instances are allowed.
14 dayspipewire: Fix silence droppingxegineering
It used to drop silence per channel, not silence per sample. In the unlikely case of perfect silence on one channel and sound on the other this would switch effectively the channels.
14 dayspipewire: Implement capture tear-downxegineering
This closes the PipeWire process properly to not leak memory and remove the PipeWire capture node of soundbox as soon as the context passed to StreamPipewireContext() is closed.
2024-12-14pipewire: Disable auto-connectxegineering
This used to connect the soundbox capture device directly to the default input (usually system microphone). This is not wanted since the main purpose of soundbox is not streaming the microphone but output of media players. Furthermore depending on the sound setup it could lead to a feedback loop with a very loud noise.
2024-12-10pipewire: Avoid unnamed struct member initxegineering
This makes the code less readable.
2024-12-08Update CHANGELOG.md for release v0.2.0v0.2.0xegineering
2024-12-08Apply go fmtxegineering
2024-12-08Add examples to overview on generated API docxegineering
This makes it easier for readers to find them.
2024-12-08Add generate-compile-commands.shxegineering
This documents the `bear` call required to produce a proper `compile_commands.json` here. The JSON file is not committed since it contains absolute paths. It is used for language servers like `clangd`.
2024-12-08pipewire: Fix huge latency by dropping silencexegineering
The current architecture uses the following processing: - capture raw audio from PipeWire as unsigned 16 bit integers - convert with a `ffmpeg` process to OGG / FLAC - stream the `ffmpeg` output to multiple soundboxes via TCP Only the first part is different for URL sources. Since using PipeWire significant latency (up to 15 seconds) were measured. It turned out that this happens exactly when zero bytes (silence) are fed into the `ffmpeg` process. This commit avoids this by dropping those empty samples. It has to be made sure that only samples are dropped where both channels are zero. Otherwise audible noise is the result.
2024-12-08pipewire: Add experimental PipeWire supportxegineering
This implements a PipeWire capture device which can be used as an input source instead of the already available URL input. Known issues with the current PipeWire support are: - user has to connect the monitor of the default audio sink to the capture device manually - correct shutdown has to be tested - multiple instances do not work - medium code quality requires refactoring Since this is nevertheless usable and possible unknown bugs should be figured out in practise soon this implementation is already added. Bugfixes and refactoring might follow.
2024-11-29Update CHANGELOG.md for version 0.1.5v0.1.5xegineering
2024-11-29Refactor streamContext()xegineering
This avoids an unnecessary additional for loop.
2024-11-29Handle internal error correctlyxegineering
2024-11-29Fix variable buffer sizexegineering
The switch to `io.Copy()` to pump the data to the soundbox devices removed the control over the buffer size of this copy action. While for generic copy actions it is even an advantage when a big buffer is used this is a problem for the soundbox use case. A big buffer used during copy means that the first soundbox device gets audio data significantly earlier than the later ones since `io.MultiWriter()` works sequentially. Thus this commit switches to `io.CopyBuffer()` where a buffer has to provided. For that purpose the same buffer size is used as before the refactoring to use `io.Copy()`.
2024-11-28Replace custom code by io package functionsxegineering
This makes use of two functions from this package: - io.Copy() - io.MultiWriter() `io.Copy()` is used to move the data from whatever reader is provided. `io.Multiwriter()` solves the issue that we need to stream to multiple network connections at the same time (one for each soundbox).
2024-11-27Handle read error after processing bufferxegineering
This is recommended by the Go standard library. One reason is that a Reader might deliver the last couple of bytes together with the EOF error. This is only handled correctly if the returned bytes are processed first and the error is handled later. [1]: https://pkg.go.dev/io#Reader
2024-11-27Introduce io.Reader-based streamContext()xegineering
This prepares the switch to adding more sources than web URLs. Everything providing an io.Reader can then simply use this internal function in the background to avoid code duplication.
2024-11-17Fix streaming only via first interface candidatexegineering
2024-11-10Update CHANGELOG.md for version 0.1.4v0.1.4xegineering
2024-11-10Add CHANGELOG.mdxegineering
This keeps track of the changes to this repository.
2024-11-10Avoid unnecessary variable for argsxegineering
2024-11-10Use Go code for output network streamxegineering
Calling the external program `ffmpeg` should be avoided completely in the future to make soundbox-go a pure Go code base. `ffmpeg` provides the following functionality to soundbox-go: - web radio input stream transport - re-encoding of the audio stream - output stream transport to soundbox devices The last part should be replaced with this commit as a first step.
2024-11-08Rename cmd to argsxegineering
This variable only contains the arguments for the called program. Thus it should be named like this.
2024-10-31Fix outdated README.mdv0.1.3xegineering
2024-10-31Change module name and restructure contentv0.1.2xegineering
The repository names for soundbox are named as below: - app: soundbox-app - Go library module: soundbox-go - Device: soundbox The Go module names were: - app: xengineering.eu/soundbox/app - Go library module: xengineering.eu/soundbox This does not make clear which module is related to which repository since the names are different. Thus it should be changed to: - app: xengineering.eu/soundbox-app - Go library module: xengineering.eu/soundbox-go The import statement for the library is then: import "xengineering.eu/soundbox-go/soundbox" This is a bit longer but it keeps the property that the library is referenced inside the code by the simple name `soundbox`.
2024-10-06Move streaming example to stream_test.gov0.1.1xegineering
This example is completely based on the StreamURLContext() function. Thus it should go to the respective test file.
2024-10-06Add missing doc string to public functionxegineering
2024-10-03Add soundbox.StreamURLContext()v0.1.0xegineering
This should be the primary public API of the library to stream web radio to soundbox devices.
2024-10-03Remove soundbox.Clientxegineering
This data structure only contained a net.HardwareAddr and did not provide much more useful functionality. Thus the net.HardwareAddr type should be used directly.
2024-10-03Make soundbox.StreamingPort privatexegineering
It is planned to provide a function for streaming. Thus the streaming port is not required to be exposed. If there is a use case the streaming port can be exposed again.
2024-10-03Add soundbox.getInterface()xegineering
This is required as a temporary solution to guess the correct interface.
2024-10-02Rename Port to StreamingPortxegineering
It is expected that further ports (maybe for information via HTTP) are added in the future. To keep the public API stable this should be taken into account before the first release.
2024-10-02Fix example documentationxegineering
2024-10-02Rename Soundbox to Clientxegineering
Since the module name is `soundbox` naming the primary type of the module also `Soundbox` is redundant. Following similar code from the Go standard library this struct is renamed to `Client`.
2024-10-02Fix check.py as pre-commit hookxegineering
The file did not work properly if used via Git commit hook symlink.
2024-10-02Add basic check.pyxegineering
This script should be usable as a Git pre-commit hook to make sure every commit has a running test suite and is well formatted. This commit starts with running the test suite for the module.
2024-10-02Add basic examplexegineering
This gives a brief introduction how the library should be used. Furthermore it has an output string comment making sure with the test suite that it actually works.
2024-10-02Add soundbox.fromHardwareAddr()xegineering
This splits the soundbox.NewSoundbox() function into two smaller functions.
2024-10-02Use testing.Fatalf() to log in testsxegineering
Using testing.Errorf() does not stop the test. This was never wanted.
2024-10-02Add soundbox.toLinkLocal()xegineering
To communicate with soundbox devices it is required to convert the known device MAC address (printed on the case) to an IPv6 link-local address.
2024-10-02Add soundbox.Port constantxegineering
2024-10-02Link project page in README.mdxegineering
This gives a better overview of the existing repositories.
2024-10-02Change Go module name from `soundbox-go` to `soundbox`xegineering
Go modules should be named with a single word if possible (see the [standard libraray][1] as a reference example). Furthermore the module name will be present in the code very often and thus length is a critical point. The repository and project should still be named `soundbox-go` to distinguish it from the device repository [soundbox][2] and the application repository [soundbox-app][3]. [1]: https://pkg.go.dev/std [2]: https://cgit.xengineering.eu/soundbox [3]: https://cgit.xengineering.eu/soundbox-app
2024-10-01Make soundbox package top-levelxegineering
It is not expected that this library will be so big that multiple packages make sense. Thus it should start only with the main package.
2024-10-01Add go.modxegineering
This makes this repository a Go module.
2024-10-01Add minimal soundbox Go packagexegineering
This only adds the `Soundbox` struct type which has a `net.HardwareAddr` to identify it together with a constructor and a unit test.
2024-10-01Add Mozilla Public License version 2.0xegineering