SmartEyeglass HeroSmartEyeglass Hero

Develop customized AR solutions

Sony’s augmented reality SmartEyeglass* is developed for increasing business productivity and reducing errors. Transform the way you work by enhancing reality with information and graphics.

*Discontinued model.

Use Bluetooth for audio I/O

Along with its unique see-through display and head-mount camera, SmartEyeglass is also a Bluetooth headset for the host smart phone. Your app can receive and play back audio data with the microphone and speaker that are built into the SmartEyeglass device. To do this, you use the Android Bluetooth Hands-Free Profile (BT HFP) API to capture sound and play back audio as you would for any standard Bluetooth headset.

Required permission

You will have to add a permission request to your app’s Android manifest to use these functions.

  • In order to be allowed to make changes to the way your application handles audio preferences, add this line to your app’s AndroidManifest.xml file:
  • To record audio from the microphone, add this permission:

Audio I/O mode

An AudioManager instance provides the functions you need to enable the device to send and receive audio data.

  • The default audio mode, MODE_NORMAL, uses the host phone for audio I/O. To use the headset, set the mode to MODE_IN_CALL:
    1. AudioManager mAudioManager =
    2. (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
    3. // Switch to headset
    4. mAudioManager.setMode(AudioManager.MODE_IN_CALL);

    You can now start the Bluetooth background process running:

    1. // Start audio I/O operation
    2. mAudioManager.startBluetoothSco();
  •  To switch off audio I/O, change to the normal audio mode:
    1. // Switch back to phone
    2. mAudioManager.setMode(AudioManager.MODE_NORMAL);
    3. // Stop audio I/O operation
    4. mAudioManager.stopBluetoothSco();

How to record and play audio through the headset

These code snippets show how to record audio to a file through the headset microphone, and play audio files through the headset speaker using standard players such as MediaPlayer and SoundPool.

Record audio

Create a MediaRecorder object and set its source to the current microphone. If you have set the audio mode correctly, this is the Bluetooth microphone in the SmartEyeglass headset.

  1. mRecorder mRecorder = new MediaRecorder();
  2. mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  4. // Set file extension for the recorded audio file
  5. mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
  6. // Set a file path for the recorded audio file
  7. mRecorder.setOutputFile(mFilePath);
  8. // Set encoding of the audio
  9. mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  10. mRecorder.prepare();
  11. // Start recording
  12. mRecorder.start();

To clean up on termination:

  1. mRecorder.stop();
  2. mRecorder.reset();
  3. mRecorder.release();
  4. mRecorder = null;

Play back an audio file using MediaPlayer

Create a MediaPlayer object in your app’s initialization code, and use it to play audio files. If you have set the audio mode correctly, it plays through the headset speaker.

  1. MediaPlayer mPlayer = new MediaPlayer();
  2. mPlayer.setDataSource(mFileName);
  3. // Audio file to be played
  4. mPlayer.prepare();
  5. mPlayer.start();
  6. // Start playing audio file

To clean up on termination:

  1. mPlayer.stop();
  2. mPlayer.reset();
  3. mPlayer.release();
  4. mPlayer= null;

Play back an audio file using SoundPool

Create a SoundPool object in your app’s initialization code, and use it to play audio files. Set the audio mode in the object constructor, so that the object always plays through the headset speaker.

  1. // (assume variables have been set)
  2. SoundPool mSoundPool = new SoundPool(num, AudioManager.MODE_IN_CALL, quality);
  3. // Use the play() method to request for playback of an audio file.
  4.,, 1), leftVolume, rightVolume,
  5. priority, loop, rate);

To clean up on termination:

  1. mSoundPool.unload(soundId);
  2. mSoundPool.release();
  3. mSoundPool = null;