-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features pt. 2 #119
Comments
Two ideas for composites I have floating in my mind: Event listenerThis is similar to a callback, but it is wrapped around a streamer so information about the current position is known and can be hooked into. streamer, format, err := vorbis.Decode(f)
if err != nil {
log.Fatal(err)
}
defer streamer.Close()
watchStreamer := beep.Watch(streamer)
watchStreamer.Started(func () {
fmt.Println("Started")
})
watchStreamer.At(format.SampleRate.N(time.Second * 10), func () {
fmt.Println("Passed the 10 second mark.")
})
watchStreamer.Ended(func () {
fmt.Println("Finished")
})
speaker.Play(watchStreamer) This doesn't yet make it easy to get accurate time information when speaker is buffered. Schedulerscheduler := NewScheduler()
scheduler.Now(streamerA)
speaker.Play(scheduler)
time.Sleep(time.Second * 2)
scheduler.StartAt(scheduler.Position() + format.SampleRate.N(time.Second * 5), streamerB) // played after 5 seconds from now
scheduler.Append(streamerC) // played after both streamerA and streamerB are finished.
time.Sleep(time.Second * 10)
scheduler.Now(streamerD) // played ASAP, will be mixed together with sounds that are playing already. The scheduler could also return a handle to cancel certain sounds: handle := scheduler.Now(streamer)
// some time later
handle.Abort() The scheduler and event listener can be combined to schedule a stream, and then get events on when it actually started. |
Swapper// Play streamerA for 10 seconds, then play streamerB.
swapper := NewSwapper(streamerA)
speaker.Play(swapper)
time.Sleep(time.Second * 10)
swapper.Swap(streamerB) Alternatively, this could be part of the |
Time to have a good look at what Beep can an can't do.
Here are some old issues with desired features:
I haven't read them completely yet, but I'll update the current issue with wishes I find in them I think are important.
Below are a couple of scenario's I expect Beep to be used in. I've listed a bunch of requirements for each. Some of these requirements are my idea of what is probably needed, although I don't necessarily have experience with them so feedback is welcome. Other points are requests I found in issues. I'll try to link those issues when I find them. However, I don't necessarily place them within the scenario the original issue was about.
This issue will be updated with more requirements as I spit through all the old issues.
Game
Music player
BeepBox
Something like BeepBox.
Audio streaming over the network
I saw some issues dealing with this and I don't currently know enough which formats could properly support this. It would be nice to have a second look at this at some point to have Beep support this the proper way.
Beep shouldn't have to deal with sockets. But it should be able to produce an theoretically infinite bytestream using the format's encode function and decode it on the other end.
Everything above should work well. No stuttering audio, all realizable with out-of-the-box components.
For this, we need to re-imagine the components we need in Beep. A lot can be done with Beep, but I'm struggling with how some of the above requirements could be fulfilled using only the current composites. Two things are needed:
I wrote this issue and then @dusk125 said that he appreciated the easy low level access to the data in Beep. I think that should be kept in mind to not overdo it when implementing these things.
The text was updated successfully, but these errors were encountered: