Playing sounds with the speaker while monitoring sound level

You must Login before you can answer or comment on any questions.

Hello!

My app uses Ti.Media.startMicrophoneMonitor to monitor average ambient sound level. While this, I have to play some sound samples, which also work - but they are played only on the phone speaker (the small one on the top). (I had to use AUDIO_SESSION_MODE_PLAY_AND_RECORD to enable them.) How can I set Ti.Media.AUDIO_SPEAKER to use the bottom speaker instead?

— asked 1 year ago by Kristof Gruber
2 Comments
  • HEllo Kristof. What do you mean with the phone speaker? the one that we use when normally calling?

    That's news for me. I always heard the audio at the bottom speakers.

    Can you please share more info, like some code example and which SDK/iOS version are you using?

    Best,

    Mauro

    — commented 1 year ago by Mauro Parra

  • I mean the bottom speaker :)

    iOS 5.1, Titanium SDK 2.0.1

    — commented 1 year ago by Kristof Gruber

2 Answers

Hi Kristof! I'm having the same problem... Here are some of my ideas on the subject, not sure if everything is 100% correct...

AUDIO_SESSION_MODE_PLAY_AND_RECORD ---->> will set Ti.Media.audioLineType = AUDIO_RECEIVER_AND_MIC (1) or if the headphones are plugged in AUDIO_HEADPHONES_AND_MIC (2)

---the sound comes from the top speaker, used for phone-calls, not the bottom speaker, therefore it sounds muted / you are supposed to have your ear at the top of the phone

---user can record sound from the mic at the bottom

AUDIO_SESSION_MODE_RECORD ----->> Ti.Media.audioLineType = AUDIO_MICROPHONE (6) -only mic is used, no speaker, no playback of the recorded audio

AUDIO_SESSION_MODE_AMBIENT ----->> Ti.Media.audioLineType = Ti.Media.AUDIO_LINEOUT (4) - sound comes from bottom speaker - -but no mic/recording option

...so it looks to me like there is no audio session which enables bottom speaker and mic, and I can't figure out how to set sound to come from bottom speaker while recording

here some 2 years old ideas

[inline link text] (http://stackoverflow.com/questions/1613556/iphone-sdk-audiosession-question)

[inline link text] http://developer.appcelerator.com/question/56451/output-speaker

This seems to be an issue only on the iPhone. On iPad and iPod Touch the AUDIO_SESSION_MODE_PLAY_AND_RECORD should be enough.

— answered 5 weeks ago by Humberto Neves
answer permalink
2 Comments
  • Hi Humberto, Is it general for all devices?

    I can confirm for testing on iPhone 3GS, iPod 4 - just what you said.

    How about iPhone 4, 4s, 5. iPod 3, 5. And iPad 1, 2, 3, 4?

    Thanx.

    — commented 4 weeks ago by o coenen

  • We also verified the same behavior using iPhone 4, 4S. The playback sound turns to the top speaker when changing to a record session. We've tested successfully using iPod 5 and iPad 2.

    — commented 4 weeks ago by Humberto Neves

Your Answer

Think you can help? Login to answer this question!