Comparison of Core Audio API's

A complex, multimedia application such as a game is nothing without sound. Whether it is background music or just a simple “click” when an event has been identified, sounds are essential. In Tizen 2.3 offers numerous API’s that deal with sound:

  • Audio I/O
  • Sound manager
  • Tone player
  • Wav player


These API’s are all related to playing sounds on your Tizen device, but which should be used to what purpose? In this article we will discuss the usage of each of these API’s.

Sound Manager

The first API we will be looking at is Sound Manager. This API is not responsible for playing or recording any sound, but it definitely is related and very relevant to the topic.

Sound Manager has two main functions:

  • Setting the Sound Session Type
  • Managing Volume control

The first of these sets the Session Type, which tells the system how it should interpret sounds coming from our app:





For example, the Emergency type should not be allowed to be silenced, and will not allow other sounds to be played over it. To set a session type, use the int sound_manager_set_session_type (sound_session_type_e type) method.

The Sound Manager API also allows setting various options to your app:

SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START - This session will be mixed with others when starting (default)

SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START - This session will interrupt other sessions when starting

SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM - This session will be resumed according to system policy (default)

SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED - This session will be resumed according to system policy and when the media session which interrupted this session is paused

SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY       - This session will be able to interrupted by other sessions during play (default)

SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY - This session will not be interrupted by other media sessions


These options are set with the int sound_manager_set_media_session_option      (sound_session_option_for_starting_e     s_option, sound_session_option_for_during_play_e d_option ) method.     

The other function, Volume Control, allows controlling the output volume and receives notifications about volume changes. To set the volume inside your app, you must first specify which type of sound you want to modify the volume of. The sound types are as follows:

SOUND_TYPE_SYSTEM - Sound type for system sounds

SOUND_TYPE_NOTIFICATION - Sound type for notifications

SOUND_TYPE_ALARM - Sound type for alarm sounds

SOUND_TYPE_MEDIA - Sound type for media sounds

SOUND_TYPE_VOICE - Sound type for voice

Now in order to change the volume, use the int sound_manager_set_volume( sound_type_e type, int volume) method.

The Sound Manager API also hosts a number of callbacks that receive information when a volume change has occurred.

For more information on the Sound Manager API please see the Help section attached to the Tizen SDK.

Tone Player

The Tone Player API is responsible for playing sounds that are generated by the application. It does not load sounds from external memory, only plays preprogrammed ones. This is illustrated in the Media Sample Application from the Samples section in Tizen SDK.

Fig.1 Tone Player


To play a sound you must specify the tone type (there are 111 tone types, the full list and description can be found in the documentation), a media sound type (e.g. SYSTEM, ALARM, MEDIA) and the duration in milliseconds (-1 for infinite playback). If playing the tone has been successful, the last parameter (player ID) will be set with a new value.

The method to play tone sounds is called

tone_player_start(TONE_TYPE_DEFAULT, SOUND_TYPE_MEDIA, -1, &tone_player_id);

For more information, see the Tone Player sample in the Media Sample Application.

Audio I/O

The Audio I/O API records and plays back raw sound data - this data is not compressed or coded into a file format. To illustrate its work, please see the Audio I/O section of the Media Sample Application.

Fig. 2 Audio I/O

To start working with the Audio I/O API, you need to specify the desired sample rate (between 8000 and 48000 Hz, the most common is 44 100 Hz, which is the format for Audio CD – this defines the quality of the recording), channel type (mono or stereo, meaning one or two channels), and sample type (unsigned 8-bit or signed 16-bit). This data needs to be fed to the audio_in and audio_out creators.

Once initialization is done, you can start recording audio files, which then can be edited within the app and played back. This API has also got the possibility of asynchronous recording and playback.

For more information please see the Audio I/O section in the Help section attached to the Tizen SDK.

Player API

The final and most complex API that deals with sound is the Player API. It allows the user to play back multimedia content from a file, directly from memory or streaming over a network. The API allows the user to navigate the playback position, play, pause and stop playback. It also has the option of changing the volume of the sound file.

Fig.3 Player API

The Player API supports the most popular sound formats, including mp3, wav and aac.

Another one of its functions is the built-in possibility to mix files. What this means, is the user can specify whether one file will interrupt another when playing, and if he so chooses, the sounds can be played at once.

Fig. 4 Multi play

This API can also play back videos, but that is not the topic of this article.

For more information please see the Player API overview in the help section and the Media Sample Application from the Samples in Tizen SDK.

File attachments: