Skip to content

Commit

Permalink
tone generator moved to separate subpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyapashuk committed Aug 31, 2021
1 parent 6521f34 commit 7ac400a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 3 additions & 6 deletions examples/tone-player/main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package main

import "os"
import "fmt"
import "github.com/faiface/beep"
import "github.com/faiface/beep/generators"
import "github.com/faiface/beep/speaker"
import "github.com/faiface/beep"
import "strconv"

func main() {
f,_ := strconv.Atoi(os.Args[1])
speaker.Init(beep.SampleRate(48000), 4800)
s := beep.SinTone(beep.SampleRate(48000), f)
rb := make([][2]float64,20)
s.Stream(rb)
fmt.Println(rb)
s := generators.SinTone(beep.SampleRate(48000), f)
speaker.Play(s)
for {

Expand Down
3 changes: 2 additions & 1 deletion toner.go → generators/toner.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// tones generator


package beep
package generators

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

// simple sinusoid tone generator
type toneStreamer struct {
Expand Down

0 comments on commit 7ac400a

Please sign in to comment.