oboe icon indicating copy to clipboard operation
oboe copied to clipboard

Can we have a simpler "hello world" example?

Open gabenell opened this issue 5 years ago • 2 comments

I am playing around with audio APIs for a client/server streaming application. In just a few hours, I built a working client and server based on the golang bindings for portaudio (https://github.com/gordonklaus/portaudio).

Now I want to make a proof-of-concept client on Android. Since latency is a concern for me, I found Oboe.

The Oboe Getting Started Guide hints at a suitably simple "hello world" example: https://github.com/google/oboe/blob/master/docs/GettingStarted.md#example

This has just the right amount of complexity for someone new to the API. I expected that there would be a correspondingly simple Oboe sample app that I could run and tinker with and adapt to my needs.

Unfortunately, the "hello-oboe" example, which appears to be the simplest one, is frighteningly complex. Many buttons and options, latency tuning, etc. It took me a while to figure out that the equivalent of the onAudioReady callback from the getting started guide is buried in SoundGenerator::renderAudio. I have a Java background and a working knowledge of C, but I fear that I am going to spend a lot of time to hack this sample into something that I can begin to work with and understand.

For comparison, please see the equivalent golang portaudio "hello world" which render a sine wave, and compare to the hello-oboe example:

https://github.com/gordonklaus/portaudio/blob/master/examples/stereoSine.go

Just 48 lines, that's it, the entire demo. It is immediately obvious to me I should put my code in processAudio to get something coming out of the speakers, and delve into the more complex aspects of the API as needed. This, truly, is the audio equivalent of "hello world".

Could we have a sample app that is as promisingly simple as the example in the Oboe getting started guide? Maybe just a UI with one button that starts a sine wave with a dead-simple invocation of Oboe that lets someone push audio out to the speaker on an Android device? Otherwise a lot of people are just going to give up. Most people demoing and API want to start from the simplest example and learn the details of the API and best practices as they go.

gabenell avatar Aug 28 '20 05:08 gabenell

Good idea. I like minimal example code.

philburk avatar Sep 02 '20 21:09 philburk

Note: we will also need to update the docs as they contain references to hello-oboe:

https://google.github.io/oboe/reference/classoboe_1_1_audio_stream.html#a49254e6b1b19cb6d0ca6c63058029771

dturner avatar Mar 25 '21 12:03 dturner

We have the minimal oboe sample now

robertwu1 avatar Jun 16 '23 21:06 robertwu1