No Chirp Sound

Solved!
Posted in Android by Oyindamola Oluwatimi Mon May 09 2016 19:21:35 GMT+0000 (UTC)·6·Viewed 572 times

I am following the Android tutorial to play a basic chirp. I played it once, but it doesn't seem to work after the first time I played a sound. The log states "Will chirp fd 0 shortcode parrotbill" . My code: ShortCode shortcode = new ShortCode( "parrotbill"); boolean valid=ChirpSDKHelpers.isValidShortcode(shortcode); String text; if(valid) { text = shortcode.getShortCode() + ": valid" + Integer.toString(num++); Log.i(TAG,text); chirpSDK.play(new ShortCode("parrotbill")); } else { text = shortcode.getShortCode() + ": not valid"; Log.i(TAG,text); } Any ideas on this?
Mike Smales
May 10, 2016

Hi Oyindamola

Thanks for the question.

Please call chirpSDK.startListening() before you call the play() method.

We also recommend subscribing to the onError() event in the ChirpSDKListener(), which may shed light on such errors in the future.

Oyindamola Oluwatimi
May 10, 2016

Hi Mike,

I am not sure how chirpSDK.startListening() will help me play a chirp. Maybe I was ambiguous with my question post. The problem is that with the code above, I played a single chirp. I attempted to play it again through a period service using Java's scheduledexecutorservice and it didn't work. I reverted back to original code, and the original code still doesn't work. In addition, I never used "chirpSDK.startListening()" to play a chirp. Please advise. Thank you.

Oyindamola Oluwatimi
May 10, 2016

Hi Mike,

As you suggested, I added chirpSDK.startListening() to the code, and it is playing now. I find that odd because I didn't use that piece of code before when it was working previously. Also, I assumed that chirpSDK.startListening() was only for actually retrieving audio data, and did not contribute to sending audio data. Such use of chirpSDK.startListening() is not intuitive, and other developers may find that confusing. Are there any more in depth description/documentation of each API call?

Mike Smales
May 10, 2016

Hi Oyindamola,

In order to play() a chirp, you must first have placed the chirpSDK in listening mode, which is achieved by calling chirpSDK.startListening().

Once you have called chirpSDK.startListening(), we would expect play() to work. If it is still not playing, do you receive any error events via the onError() callback?

Mike Smales
May 10, 2016

Hi Oyindamola,

Please ignore my last comment.

We appreciate your feedback on the matter. We have been considering either, modifying the chirpSDK so you do not have to be listening in order to play a Chirp, or renaming the method to be more intuitive.

The requirement to call startListening prior to calling play() is documented on our Chirp for Android page on here. This page also includes lots of tips for getting started.

You can find full documentation on each SDK method in the Javadocs that are distributed in the SDK bundle. We have also included source code for two example apps within the SDK bundle.

If you have any further comments on documentation, we would be grateful to hear them.


Mike Smales marked this as solved
Markdown is allowed