Skip to content

Commit

Permalink
Merge pull request #1 from dusk125/update-project
Browse files Browse the repository at this point in the history
Updating project to gopxl org fork
  • Loading branch information
MarkKremer authored Oct 7, 2023
2 parents 60cd180 + 4adbddf commit b59e958
Show file tree
Hide file tree
Showing 38 changed files with 93 additions and 98 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Beep [![GoDoc](https://godoc.org/github.com/faiface/beep?status.svg)](https://godoc.org/github.com/faiface/beep) [![Go Report Card](https://goreportcard.com/badge/github.com/faiface/beep)](https://goreportcard.com/report/github.com/faiface/beep) [![Discord Chat](https://img.shields.io/discord/699679031603494954)](https://discord.gg/q2DK4MP)
# Beep [![GoDoc](https://godoc.org/github.com/gopxl/beep?status.svg)](https://godoc.org/github.com/gopxl/beep) [![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/beep)](https://goreportcard.com/report/github.com/gopxl/beep) [![Discord Chat](https://img.shields.io/discord/699679031603494954)](https://discord.gg/q2DK4MP)

A little package that brings sound to any Go application. Suitable for playback and audio-processing.

```
go get -u github.com/faiface/beep
go get -u github.com/gopxl/beep
```

## Features

Beep is built on top of its [Streamer](https://godoc.org/github.com/faiface/beep#Streamer) interface, which is like [io.Reader](https://golang.org/pkg/io/#Reader), but for audio. It was one of the best design decisions I've ever made and it enabled all the rest of the features to naturally come together with not much code.
Beep is built on top of its [Streamer](https://godoc.org/github.com/gopxl/beep#Streamer) interface, which is like [io.Reader](https://golang.org/pkg/io/#Reader), but for audio. It was one of the best design decisions I've ever made and it enabled all the rest of the features to naturally come together with not much code.

- **Decode and play WAV, MP3, OGG, and FLAC.**
- **Encode and save WAV.**
Expand All @@ -20,18 +20,18 @@ Beep is built on top of its [Streamer](https://godoc.org/github.com/faiface/beep

## Tutorial

The [Wiki](https://github.com/faiface/beep/wiki) contains a handful of tutorials for you to get started. They teach the fundamentals and advanced topics alike. **Read them especially if you call `speaker.Init` every time you play something.**
The [Wiki](https://github.com/gopxl/beep/wiki) contains a handful of tutorials for you to get started. They teach the fundamentals and advanced topics alike. **Read them especially if you call `speaker.Init` every time you play something.**

- [Hello, Beep!](https://github.com/faiface/beep/wiki/Hello,-Beep!)
- [Composing and controlling](https://github.com/faiface/beep/wiki/Composing-and-controlling)
- [To buffer, or not to buffer, that is the question](https://github.com/faiface/beep/wiki/To-buffer,-or-not-to-buffer,-that-is-the-question)
- [Making own streamers](https://github.com/faiface/beep/wiki/Making-own-streamers)
- [Hello, Beep!](https://github.com/gopxl/beep/wiki/Hello,-Beep!)
- [Composing and controlling](https://github.com/gopxl/beep/wiki/Composing-and-controlling)
- [To buffer, or not to buffer, that is the question](https://github.com/gopxl/beep/wiki/To-buffer,-or-not-to-buffer,-that-is-the-question)
- [Making own streamers](https://github.com/gopxl/beep/wiki/Making-own-streamers)

## Examples

| [Speedy Player](https://github.com/faiface/beep/tree/master/examples/speedy-player) | [Doppler Stereo Room](https://github.com/faiface/beep/tree/master/examples/doppler-stereo-room) |
| [Speedy Player](https://github.com/gopxl/beep/tree/master/examples/speedy-player) | [Doppler Stereo Room](https://github.com/gopxl/beep/tree/master/examples/doppler-stereo-room) |
| --- | --- |
| ![Speedy Player](https://github.com/faiface/beep/blob/master/examples/speedy-player/screenshot.png) | ![Doppler Stereo Room](https://github.com/faiface/beep/blob/master/examples/doppler-stereo-room/screenshot.png) |
| ![Speedy Player](https://github.com/gopxl/beep/blob/master/examples/speedy-player/screenshot.png) | ![Doppler Stereo Room](https://github.com/gopxl/beep/blob/master/examples/doppler-stereo-room/screenshot.png) |

## Dependencies

Expand All @@ -41,7 +41,7 @@ Running an already built application should work with no extra dependencies.

## Licence

[MIT](https://github.com/faiface/beep/blob/master/LICENSE)
[MIT](https://github.com/gopxl/beep/blob/master/LICENSE)

## Projects using beep

Expand Down
2 changes: 1 addition & 1 deletion buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/rand"
"testing"

"github.com/faiface/beep"
"github.com/gopxl/beep"
)

func TestFormatEncodeDecode(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion compositors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/faiface/beep"
"github.com/gopxl/beep"
)

// randomDataStreamer generates random samples of duration d and returns a StreamSeeker which streams
Expand Down
12 changes: 6 additions & 6 deletions effects/doppler.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effects

import "github.com/faiface/beep"
import "github.com/gopxl/beep"

// Doppler simulates a "sound at a distance". If the sound starts at a far distance,
// it'll take some time to reach the ears of the listener.
Expand All @@ -11,11 +11,11 @@ import "github.com/faiface/beep"
//
// The arguments are:
//
// quality: the quality of the underlying resampler (1 or 2 is usually okay)
// samplesPerMeter: sample rate / speed of sound
// s: the source streamer
// distance: a function to calculate the current distance; takes number of
// samples Doppler wants to stream at the moment
// quality: the quality of the underlying resampler (1 or 2 is usually okay)
// samplesPerMeter: sample rate / speed of sound
// s: the source streamer
// distance: a function to calculate the current distance; takes number of
// samples Doppler wants to stream at the moment
//
// This function is experimental and may change any time!
func Doppler(quality int, samplesPerMeter float64, s beep.Streamer, distance func(delta int) float64) beep.Streamer {
Expand Down
2 changes: 1 addition & 1 deletion effects/equalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package effects
import (
"math"

"github.com/faiface/beep"
"github.com/gopxl/beep"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion effects/gain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effects

import "github.com/faiface/beep"
import "github.com/gopxl/beep"

// Gain amplifies the wrapped Streamer. The output of the wrapped Streamer gets multiplied by
// 1+Gain.
Expand Down
2 changes: 1 addition & 1 deletion effects/mono.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effects

import "github.com/faiface/beep"
import "github.com/gopxl/beep"

// Mono converts the wrapped Streamer to a mono buffer
// by downmixing the left and right channels together.
Expand Down
2 changes: 1 addition & 1 deletion effects/pan.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effects

import "github.com/faiface/beep"
import "github.com/gopxl/beep"

// Pan balances the wrapped Streamer between the left and the right channel. The Pan field value of
// -1 means that both original channels go through the left channel. The value of +1 means the same
Expand Down
2 changes: 1 addition & 1 deletion effects/swap.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effects

import "github.com/faiface/beep"
import "github.com/gopxl/beep"

// Swap swaps the left and right channel of the wrapped Streamer.
//
Expand Down
2 changes: 1 addition & 1 deletion effects/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package effects
import (
"math"

"github.com/faiface/beep"
"github.com/gopxl/beep"
)

// Volume adjusts the volume of the wrapped Streamer in a human-natural way. Human's perception of
Expand Down
16 changes: 8 additions & 8 deletions examples/doppler-stereo-room/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"time"
"unicode"

"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gdamore/tcell"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func multiplyChannels(left, right float64, s beep.Streamer) beep.Streamer {
Expand Down Expand Up @@ -128,16 +128,16 @@ var directions = map[rune]EventMappedLocation{
'2': {-1, 1, 1, 1, SetPoint},
// Left, Right
'4': {-1.5, 0, -1, 0, SetPoint},
'6': { 1,0, 1.5,0, SetPoint},
'6': {1, 0, 1.5, 0, SetPoint},
// Layout Top Left, Top Right, Bottom Right, Bottom Left
'7': {-1.8, -1.8,-0.8, -1.8, SetPoint},
'9': {0.8, -1.8,1.8, -1.8, SetPoint},
'7': {-1.8, -1.8, -0.8, -1.8, SetPoint},
'9': {0.8, -1.8, 1.8, -1.8, SetPoint},
'1': {-1.8, 1.8, -0.8, 1.8, SetPoint},
'3': {0.8, 1.8, 1.8, 1.8, SetPoint},

// Diagonal Locations
'\\': {-1, -1, 1, 1, SetPoint},
'/': {-1, 1, 1, -1, SetPoint},
'/': {-1, 1, 1, -1, SetPoint},

// Left
'a': {-1, 0, 0, 0, Applied},
Expand Down
8 changes: 4 additions & 4 deletions examples/speedy-player/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"time"
"unicode"

"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gdamore/tcell"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func drawTextLine(screen tcell.Screen, x, y int, s string, style tcell.Style) {
Expand Down
6 changes: 3 additions & 3 deletions examples/tone-player/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strconv"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/generators"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/generators"
"github.com/gopxl/beep/speaker"
)

func usage() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/1-hello-beep/a/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/1-hello-beep/b/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/2-composing-and-controlling/a/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/2-composing-and-controlling/b/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/2-composing-and-controlling/c/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
8 changes: 4 additions & 4 deletions examples/tutorial/2-composing-and-controlling/d/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/3-to-buffer-or-not-to-buffer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/4-making-own-streamers/a/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"math/rand"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/speaker"
)

func Noise() beep.Streamer {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/4-making-own-streamers/b/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/mp3"
"github.com/gopxl/beep/speaker"
)

type Queue struct {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/5-equalizer/mono/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"math/rand"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/speaker"
)

func noise() beep.Streamer {
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial/5-equalizer/stereo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"math/rand"
"time"

"github.com/faiface/beep"
"github.com/faiface/beep/effects"
"github.com/faiface/beep/speaker"
"github.com/gopxl/beep"
"github.com/gopxl/beep/effects"
"github.com/gopxl/beep/speaker"
)

func noise() beep.Streamer {
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Code for the [tutorials](https://github.com/faiface/beep/wiki)
# Code for the [tutorials](https://github.com/gopxl/beep/wiki)

Here's the code for all the tutorials from the [Wiki](https://github.com/faiface/beep/wiki/Hello,-Beep!).
Here's the code for all the tutorials from the [Wiki](https://github.com/gopxl/beep/wiki/Hello,-Beep!).

All the music is downloaded from [Free Music Archive](https://freemusicarchive.org) and [Free Sound Effects.com](https://www.freesoundeffects.com/).
2 changes: 1 addition & 1 deletion flac/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"io"

"github.com/faiface/beep"
"github.com/gopxl/beep"
"github.com/mewkiz/flac"
"github.com/pkg/errors"
)
Expand Down
6 changes: 3 additions & 3 deletions generators/sawtooth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"math"

"github.com/faiface/beep"
"github.com/gopxl/beep"
)

type sawGenerator struct {
Expand All @@ -21,7 +21,7 @@ func SawtoothTone(sr beep.SampleRate, freq float64) (beep.Streamer, error) {
dt := freq / float64(sr)

if dt >= 1.0/2.0 {
return nil, errors.New("faiface sawtooth tone generator: samplerate must be at least 2 times grater then frequency")
return nil, errors.New("gopxl sawtooth tone generator: samplerate must be at least 2 times grater then frequency")
}

return &sawGenerator{dt, 0, false}, nil
Expand All @@ -35,7 +35,7 @@ func SawtoothToneReversed(sr beep.SampleRate, freq float64) (beep.Streamer, erro
dt := freq / float64(sr)

if dt >= 1.0/2.0 {
return nil, errors.New("faiface triangle tone generator: samplerate must be at least 2 times grater then frequency")
return nil, errors.New("gopxl triangle tone generator: samplerate must be at least 2 times grater then frequency")
}

return &sawGenerator{dt, 0, true}, nil
Expand Down
Loading

0 comments on commit b59e958

Please sign in to comment.