Monday 30 December 2019

Scoped Storage in Android

In Android 10 (SDK version 29) many new features were introduced and Scoped Storage is one of them. 

The Problem, Why scoped storage introduced in Android Q?

  • Before Android 10, we have a concept of Shared Storage
  • Every application in the device has some private storage in the internal memory and you can find this in android/data/your_package_name directory 
  • Apart from this internal storage, the rest of the storage is called the Shared Storage i.e. every application with the storage permission can access this part of the memory.
  • This includes media collections and other files of different applications. 

1st Problem

  • application having the storage permission doesn't require the access of all of these files always
  • For example,needs to select a user image to upload it as the profile picture and nothing else. 

So, why to provide them with the full access to that Shared Storage?

2nd problem 

  • application is having such a wide writing capability on the storage then the files generated by the application gets scattered 
  • when the user uninstalls the application then the files generated by the application remains in the storage and not deleted and takes a lot of space.

So, we need some kind of mechanism, with the help of which the apps can get the specific access they need without getting such a broad reading and writing power that they don't actually need.
This can be done with the help of Scoped Storage.

The Solution - Scoped Storage
Better Attribution: 

  • Better attribution means the system knows which file is generated by which application
  • when user uninstall an application from the device then all the contents related to the app will also be removed unless the user explicitly wants to keep it.

App data protection: 

  • the external storage is accessed by applications with storage permission
  • With the help of Scoped Storage, the data in the external storage can not be easily accessed by other applications

Key features of Scoped Storage
Unrestricted access: 
  • Every application has unrestricted access to its own storage( internal as well as external)
  • you don't need to provide storage permission to write files to your own app directory on the SD card.
Unrestricted media: 
  • unrestricted access to contribute files to the media collections and downloads of your own app.
  • No need to take permission if you want to save any image, video, or any other media file in media collection. 
  • You can read or write media files created by you
  • To read the media file of other application, you need to get the "READ_EXTERNAL_STORAGE" permission from the user. 
Organized collection: 
  • organized media collection like for images, videos, etc and downloads collection for non-media files.
  • There is new permission introduced in Android 10 i.e. ACCESS_MEDIA_LOCATION( get the location of the media )
For example, sometimes the picture taken by a camera also shows the location of the picture that was taken. So, if you want to show that location then you have to take this permission. 
It is runtime permission, so you need to declare this in your manifest file and from the MediaStore object, call the setRequireOriginal(), passing the URI of the image.
System Picker: 
  • In order to access other files except for these media files, we have to use System Picker which is accessed using the Storage Access Framework.
  • Read/write from outside: To read and write any files outside the collection, you need to use the System Picker.

How to access simple files(using System Picker)?
  • In order to access files on the device, you can use the Storage Access Framework (SAF).
  • By using ACTION_OPEN_DOCUMENT a dialog will be shown to the user where the needed documents can be selected. 
  • There’s also ACTION_OPEN_DOCUMENT_TREE to ask the user to select a directory and
  • ACTION_CREATE_DOCUMENT in order to save files.
Sample Application 
I am creating a sample application to demonstrate scope permission.  You can find it in my GitHub account 
screen shot


Thanks
Saurabh
Happy Coding !!!


Sunday 29 December 2019

Priority Queues in Python

What is a Priority Queue?
A queue has FIFO (first-in-first-out) ordering where items are taken out or accessed on a first-come-first-served basis.
A priority queue is an abstract data structure (a data structure defined by its behaviour) that is like a normal queue but where each item has a special “key” to quantify its “priority”.

Example : 
If Pizza shop decides to serve loyal customers first, it will order them by their loyalty (points or number of piza purchased by them in past).
In such a case, the queue for Piza buyer will no longer be first-come-first-served, but most-loyal-first-served.
The customers will be the “items” of this priority queue while the “priority” or “key” will be their loyalty.

Implementing Priority Queues in Python
Consider that we want to have a priority queue of customers based on their loyalty points. The higher the points, the more the priority.
Implementing Priority Queues in Python, there are a number of options. We will explore three of them.

Using a list
A very simple and straightforward way is to use the normal list but We have to sort it every time an item is added. Here’s an example:
# Priority Queues using List
customers = []
customers.append((2, "Saurabh")) #no sort needed here because 1 item.
customers.append((3, "Pheku"))
customers.sort(reverse=True)
#Need to sort to maintain order
customers.append((1, "Kumar"))
customers.sort(reverse=True)
#Need to sort to maintain order
customers.append((4, "Bhanu"))
customers.sort(reverse=True)
while customers:
print(customers.pop(0))
#Will print names in the order: Bhanu, Pheku, Saurabh, Kumar.
it takes O(n log n) time to maintain the order when an item is added to the list. Thus, it is only efficient when we have to make few insertions.
2. Using heapq
We can also use the heapq module in Python to implement our priority queue. This implementation has O(log n) time for insertion and extraction of the smallest element. Note that heapq only has a min heap implementation, but there are ways to use as a max heap.
Here’s an example:
# 2. Using heapq
import heapq
customers = []
heapq.heappush(customers, (2, "Harry"))
heapq.heappush(customers, (3, "Charles"))
heapq.heappush(customers, (1, "Riya"))
heapq.heappush(customers, (4, "Stacy"))
while customers:
print(heapq.heappop(customers))
#Will print names in the order: Riya, Harry, Charles, Stacy.
3. Using queue.PriorityQueue
This python inbuilt PriorityQueue uses the same heapq implementation, we discused in point no 2, internally and thus has the same time complexity.
However, it is different in two key ways. 

  • Firstly, it is synchronized, so it supports concurrent processes
  • Secondly, it is a class interface instead of the function based interface of heapq

Thus, PriorityQueue is the classic OOP style of implementing and using Priority Queues.
example:
# 3. Using queue.PriorityQueue
from queue import PriorityQueue
#we initialise the PQ class instead of using a function
# to operate upon a list.
customer1 = PriorityQueue()
customer1.put((2, "Khesav"))
customer1.put((3, "Madhav"))
customer1.put((1, "Hari"))
customer1.put((4, "Riya"))
while customer1:
print(customer1.get())


Thanks
Saurabh
Happy Coding !!!!

Saturday 28 December 2019

Git Command Line as easy as possible

Git Status
git status
git status -- short

Manipulate the Changes
git add file_name  >> adds the file file to the stage section
git restore file_name >> discards changes to the file
git restore --staged file_name >> removes the file from the stage section

Inspecting the diffs
git diff . >> displays the not-staged changes in your working tree
git diff --staged >> displays the staged changes
git diff dev >> displays changes between the working tree and the dev branch. You might use a commit hash or tag instead.
git diff master..dev >>displays changes between the branches master and dev

Committing
git commit -m 'Commit message'
git config --global core.editor your-editor-executable-path

Switch
The switch command can be used to switch between branches.
git switch branch-name >> switches to a branch-name branch
git switch -b abc >> creates branch abc and switches to it
git switch - >> switches you to the previous branch
git checkout [branch_name] >> works as a switch but can also move HEAD to any commit/tag as well

Branches
git branch >>> returns a list of the local branches.
Use -r to list only remote branches or -a to get them all
git branch abc >>> creates abc branch
git branch -d abc >>> deletes abc if already merged.
If not, use -D to force deletion.

Log Results
git log >>> to see the commits’ history.
git log -p >>>Display the changes alongside the commit description:
git log -2 >>> display two recent commits
git log branch-name  >>>Display log for a specific branch/revision:
Filter log for a specific file(s) only (glob pattern applies here):
git log *.js # or git log branch-name:*.js
Filter commits by the author (accepts partial name):
git log --author saurabh
Filter by date:
git log --since 2019-10-01
Filter by date using dynamic date ranges (days, weeks, months, years):
git log --since 2months --until 1week

Thanks
Saurabh Sharma

Friday 13 December 2019

Python must know Resource

Hi Guys!!!!

Hope you all doing well!!!!.  

Today   I am going to discuss, Puthon must know resource. First Why python is so important?
Python is one of the world’s most popular, in-demand programming languages. This is for many reasons:
  • it’s easy to learn
  • it’s super versatile
  • it has a huge range of modules and libraries(known as Batteries)
Here, I’ve made an attempt at sharing some of famous and must know resource to you guys
You find all the example from my github page
https://github.com/Saurabh-12/Python_Learning
# all or any

x = [True, True, False]
if any(x):
    print("At least one True")
if all(x):
    print("Not one False")
if any(x) and not all(x):
    print("At least one True and one False")
bashplotlib
You want to plot graphs in the console ?
pip install bashplotlib
collections
Python has some great default datatypes and collection . You can check it from my github page. 

https://github.com/Saurabh-12/Python_Learning/blob/master/Python_Collections.py

from collections import OrderedDict, Counter
# Remembers the order the keys are added!
x = OrderedDict(a=1, b=2, c=3)
# Counts the frequency of each character
y = Counter("Hello World!")
print(y)
print(x)

emoji
Yes, really 
pip install emoji
from emoji import emojize
print(emojize(":thumbs_up:"))

geopy
It works by abstracting the APIs of a range of different geocoding services. It enables you to obtain a place’s full street address, latitude, longitude, and even altitude.
pip install geopy
from geopy import GoogleV3
place = "Manjunatha Layout,Munnekolala,Marathali, Bangalore, India"
location = GoogleV3().geocode(place)
print(location.address)
print(location.location)

howdoi
Need to check StackOverflow, but don’t want to leave the terminal?

pip install howdoi

howdoi for loop in python

**kwargs

The double-asterisk in front of a dictionary object lets you pass the contents of that dictionary as named arguments to a function.

dictionary = {"a": 1, "b": 2}
def someFunction(a, b):
print(a + b)
return
# these do the same thing:
someFunction(**dictionary)
someFunction(a=1, b=2)
List comprehensions
One of the best thing in python. Check my git hub page check dedicatd example
map
Python supports functional programming through a number of inbuilt features. 
One of the most useful is the map() function — especially in combination with lambda functions.
zip
Ever needed to form a dictionary out of two lists?
keys = ['a', 'b', 'c']
vals = [1, 2, 3]
zipped = dict(zip(keys, vals))
print(zipped)
Virtual environments
Let say we are working on multiple Python projects at any one time. 
Unfortunately, sometimes two projects will rely on different versions of the same dependency. 
Which do We install in our system?
To solve this :- venv is solution for this . For more detail see my blogs dedicaed to it
uuid
A quick and easy way to generate Universally Unique IDs (or ‘UUIDs’) is through the Python Standard Library’s uuid module.
import uuid
user_id = uuid.uuid4()
print(user_id)
pprint

Python’s default print function does it work quite good.

But if We try to print out any large, nested object, and the result is rather ugly.

pprint comes to rescue us for printing out complex structured objects in an easy-to-read format.

import requests
import pprint
url = 'https://randomuser.me/api/?results=1'
users = requests.get(url).json()
pprint.pprint(users)
Find memory used by an object
import sys
print(sys.getsizeof(5)) # 28
print(sys.getsizeof("Python")) # 55
Find the most frequent element in a list
def most_frequent(list):
return max(set(list), key = list.count)

numbers = [1, 2, 3, 2, 4, 3, 1, 3]
print(most_frequent(numbers)) # 3
Calculate time taken to execute a piece of code
import time
start_time = time.time()
a,b = 5,10
c = a+b
end_time = time.time()
time_taken = (end_time- start_time)*(10**6)
print("Time taken in micro_seconds:", time_taken)
# Time taken in micro_seconds: 3.89577484130859375
Find unique characters in a string
string = "abcbcabdb"
unique = set(string)
new_string = ''.join(unique)
print(new_string) # abcd
Use chained function call
def add(a, b):
return a + b
def subtract(a, b):
return a - b
a, b = 5, 10
print((subtract if a > b else add)(a, b)) # 15

Thanks
Saurabh Sharma
Happy Coding !!!

Wednesday 4 December 2019

Python package manager

Hi Guys !!!
Today I am going to discuss Python package manager.
What is Python Package Manager ?
Python Package Manager is a Python utility intended to simplify the tasks of locating, installing, upgrading and removing Python packages.
Pip
First, we need to talk about Pip. Pip is python’s package manager. It has come built-in to Python for quite a while now, so if you have Python, you likely have pip installed already.
Pip installs packages like tensorflow and numpy, pandas and jupyter, and many more, along with their dependencies.
pip install <your_favorite_library>
So  as a demo project or learning or for a small project you can use PIP.  But in real world secnario if you are working on big project which required many python labiraries(battery) in that case PIP can not help much. As part of this ecosystem, there is a whole world of version numbers and dependencies. 
We sometimes need to use different versions of a given library for different projects that We are working on, so We need a way to organize our groups of packages into different, isolated environments.
There are currently two popular options for taking care of managing your different pip packages:
  • virtualenv and 
  • anaconda
Virtualenv
Virtualenv is a package that allows you to create named “virtual environments”, where you can install pip packages in an isolated manner
 Example :- 
you could create an environment for web development with one set of libraries, and a different environment for data science.
This way, you won’t need to have unrelated libraries interacting with each other, and it allows you to create environments dedicated to specific purposes.
Installing virtualenv
$ pip install virtualenv
Test your installation:
$ virtualenv --version
Using virtualenv You can create a virtualenv using the following command:
$ virtualenv my_name
After running this command, a directory named my_name will be created. This is the directory which contains all the necessary executables to use the packages that a Python project would need. This is where Python packages will be installed
If you want to specify Python interpreter of your choice, for example Python 3, it can be done using the following command:
virtualenv -p /usr/bin/python3 virtualenv_name      (ubuntu)
Now after creating virtual environment, you need to activate it. Remember to activate the relevant virtual environment every time you work on the project
$ source virtualenv_name/bin/activate
Once the virtual environment is activated, the name of your virtual environment will appear on left side of terminal. Below Screen shot





Now you can install dependencies related to the project in this virtual environment. For example if you are using Django 1.9 for a project
(virtualenv_saurabh)$ pip install Django==1.9
Once you are done with the work, you can deactivate the virtual environment by the following command:
(virtualenv_name)$ deactivate
Now you will be back to system’s default Python installation.

Anaconda
  • Now, if you are primarily doing data science work, Anaconda is also a great option. 
  • it is a Python distribution that comes preinstalled with lots of useful python libraries for data science.
Anaconda is popular because it brings many of the tools used in data science and machine learning with just one install, so it’s great for having short and simple setup.
  • Like Virtualenv, Anaconda also uses the concept of creating environments to isolate different libraries and versions.
  • Anaconda also introduces its own package manager, called conda, from where you can install libraries.
For instaling Anacoda and more details of use . check below official links

Thanks
Saurabh Sharma
Happy Coding !!!

Tuesday 3 December 2019

Android Audio Framework Terminology

Hi Guys !!!

Before Going share some blogs on Android Multimedia Framework  i want to make you guys faililar with some audio terminiology.  It will give you some basic that help you guys to understand my next blog on Audio  framework.

Digital Audio
Handling sound using audio signals encoded in digital form. For details, refer to Digital Audio.
acoustics
Mechanical properties of sound, such as how the physical placement of transducers (speakers, microphones, etc.) on a device affects perceived audio quality
attenuation
Multiplicative factor less than or equal to 1.0, applied to an audio signal to decrease the signal level. Compare to gain
channel
Single stream of audio information, usually corresponding to one location of recording or playback.
DSD
Direct Stream Digital. Proprietary audio encoding based on pulse-density modulation. While Pulse Code Modulation (PCM) encodes a waveform as a sequence of individual audio samples of multiple bits, DSD encodes a waveform as a sequence of bits at a very high sample rate (without the concept of samples). Both PCM and DSD represent multiple channels by independent sequences. DSD is better suited to content distribution than as an internal representation for processing as it can be difficult to apply traditional digital signal processing (DSP) algorithms to DSD. DSD is used in Super Audio CD (SACD) and in DSD over PCM (DoP) for USB. For details, refer to Direct Stream Digital.
duck
Temporarily reduce the volume of a stream when another stream becomes active. For example, if music is playing when a notification arrives, the music ducks while the notification plays. Compare to mute.
frame
Set of samples, one per channel, at a point in time.
frames per buffer
Number of frames handed from one module to the next at one time. The audio HAL interface uses the concept of frames per buffer.
gain
Multiplicative factor greater than or equal to 1.0, applied to an audio signal to increase the signal level. Compare to attenuation.
HD audio
High-Definition audio. Synonym for high-resolution audio (but different than Intel High Definition Audio).
high-resolution audio
Representation with greater bit-depth and sample rate than CDs (stereo 16-bit PCM at 44.1 kHz) and without lossy data compression. Equivalent to HD audio. For details, refer to high-resolution audio.
latency
Time delay as a signal passes through a system.
mute
Temporarily force volume to be zero, independent from the usual volume controls.
PCM
Pulse Code Modulation. Most common low-level encoding of digital audio. The audio signal is sampled at a regular interval, called the sample rate, then quantized to discrete values within a particular range depending on the bit depth. For example, for 16-bit PCM the sample values are integers between -32768 and +32767.
ramp
Gradually increase or decrease the level of a particular audio parameter, such as the volume or the strength of an effect. A volume ramp is commonly applied when pausing and resuming music to avoid a hard audible transition.
sample
Number representing the audio value for a single channel at a point in time.
sample rate or frame rate
Number of frames per second. While frame rate is more accurate, sample rate is conventionally used to mean frame rate.
sonification
Use of sound to express feedback or information, such as touch sounds and keyboard sounds.
stereo
Two channels.
stereo widening
Effect applied to a stereo signal to make another stereo signal that sounds fuller and richer. The effect can also be applied to a mono signal, where it is a type of upmixing.
surround sound
Techniques for increasing the ability of a listener to perceive sound position beyond stereo left and right.
virtualizer
Effect that attempts to spatialize audio channels, such as trying to simulate more speakers or give the illusion that sound sources have position.
volume
Loudness, the subjective strength of an audio signal.
Inter-device interconnect
Inter-device interconnection technologies connect audio and video components between devices and are readily visible at the external connectors.
The HAL implementer and end user should be aware of these terms.

Bluetooth
Short range wireless technology. For details on the audio-related Bluetooth profiles and Bluetooth protocols, refer to A2DP for music, SCO for telephony, and Audio/Video Remote Control Profile (AVRCP).
DisplayPort
Digital display interface by the Video Electronics Standards Association (VESA).
HDMI
High-Definition Multimedia Interface. Interface for transferring audio and video data. For mobile devices, a micro-HDMI (type D) or MHL connector is used.
IEEE 1394
IEEE 1394, also called FireWire, is a serial bus used for real-time low-latency applications such as audio.
Intel HDA
Intel High Definition Audio (do not confuse with generic high-definition audio or high-resolution audio). Specification for a front-panel connector. For details, refer to Intel High Definition Audio.
interface
An interface converts a signal from one representation to another. Common interfaces include a USB audio interface and MIDI interface.
line level
Line level is the strength of an analog audio signal that passes between audio components, not transducers.
MHL
Mobile High-Definition Link. Mobile audio/video interface, often over micro-USB connector.
phone connector
Mini or sub-mini component that connects a device to wired headphones, headset, or line-level amplifier.
Intra-device interconnect
Intra-device interconnection technologies connect internal audio components within a given device and are not visible without disassembling the device. The HAL implementer may need to be aware of these, but not the end user. For details on intra-device interconnections, refer to the following articles:
SoundWire
In ALSA System on Chip (ASoC), these are collectively called Digital Audio Interfaces (DAI).
Audio Signal Path
Audio signal path terms relate to the signal path that audio data follows from an application to the transducer or vice-versa.

ADC
Analog-to-digital converter. Module that converts an analog signal (continuous in time and amplitude) to a digital signal (discrete in time and amplitude). Conceptually, an ADC consists of a periodic sample-and-hold followed by a quantizer, although it does not have to be implemented that way. An ADC is usually preceded by a low-pass filter to remove any high frequency components that are not representable using the desired sample rate. For details, refer to Analog-to-digital converter.
AP
Application processor. Main general-purpose computer on a mobile device.
codec
Coder-decoder. Module that encodes and/or decodes an audio signal from one representation to another (typically analog to PCM or PCM to analog). In strict terms, codec is reserved for modules that both encode and decode but can be used loosely to refer to only one of these. For details, refer to Audio codec.
DAC
Digital-to-analog converter. Module that converts a digital signal (discrete in time and amplitude) to an analog signal (continuous in time and amplitude). Often followed by a low-pass filter to remove high-frequency components introduced by digital quantization. For details, refer to Digital-to-analog converter.
DSP
Digital Signal Processor. Optional component typically located after the application processor (for output) or before the application processor (for input). Primary purpose is to off-load the application processor and provide signal processing features at a lower power cost.
PDM
Pulse-density modulation. Form of modulation used to represent an analog signal by a digital signal, where the relative density of 1s versus 0s indicates the signal level. Commonly used by digital to analog converters. For details, refer to Pulse-density modulation.
PWM
Pulse-width modulation. Form of modulation used to represent an analog signal by a digital signal, where the relative width of a digital pulse indicates the signal level. Commonly used by analog-to-digital converters. For details, refer to Pulse-width modulation.
transducer
Converts variations in physical real-world quantities to electrical signals. In audio, the physical quantity is sound pressure, and the transducers are the loudspeaker and microphone. For details, refer to Transducer.
Sample Rate Conversion
Sample rate conversion terms relate to the process of converting from one sampling rate to another.

downsample
Resample, where sink sample rate < source sample rate.

                          Android-Specific Terms
Android-specific terms include terms used only in the Android audio framework and generic terms that have special meaning within Android.
ALSA
Advanced Linux Sound Architecture. An audio framework for Linux that has also influenced other systems. For a generic definition, refer to ALSA. In Android, ALSA refers to the kernel audio framework and drivers and not to the user-mode API.
AudioEffect
API and implementation framework for output (post-processing) effects and input (pre-processing) effects. The API is defined at android.media.audiofx.AudioEffect.
AudioFlinger
Android sound server implementation. AudioFlinger runs within the mediaserver process. For a generic definition, refer to Sound server.
audio focus
Set of APIs for managing audio interactions across multiple independent apps. For details, see Managing Audio Focus and the focus-related methods and constants of android.media.AudioManager.
AudioMixer
Module in AudioFlinger responsible for combining multiple tracks and applying attenuation (volume) and effects. For a generic definition, refer to Audio mixing (recorded music) (discusses a mixer as a hardware device or software application, rather than a software module within a system).
audio policy
Service responsible for all actions that require a policy decision to be made first, such as opening a new I/O stream, re-routing after a change, and stream volume management.
AudioRecord
Primary low-level client API for receiving data from an audio input device such as a microphone. The data is usually PCM format. The API is defined at android.media.AudioRecord.
AudioResampler
Module in AudioFlinger responsible for sample rate conversion.
audio source
An enumeration of constants that indicates the desired use case for capturing audio input. For details, see audio source. As of API level 21 and above, audio attributes are preferred.
AudioTrack
Primary low-level client API for sending data to an audio output device such as a speaker. The data is usually in PCM format. The API is defined at android.media.AudioTrack.
audio_utils
Audio utility library for features such as PCM format conversion, WAV file I/O, and non-blocking FIFO, which is largely independent of the Android platform.
client
Usually an application or app client. However, an AudioFlinger client can be a thread running within the mediaserver system process, such as when playing media decoded by a MediaPlayer object.
HAL
Hardware Abstraction Layer. HAL is a generic term in Android; in audio, it is a layer between AudioFlinger and the kernel device driver with a C API (which replaces the C++ libaudio).
FastCapture
Thread within AudioFlinger that sends audio data to lower latency fast tracks and drives the input device when configured for reduced latency.
FastMixer
Thread within AudioFlinger that receives and mixes audio data from lower latency fast tracks and drives the primary output device when configured for reduced latency.
fast track
AudioTrack or AudioRecord client with lower latency but fewer features on some devices and routes.
MediaPlayer
Higher-level client API than AudioTrack. Plays encoded content or content that includes multimedia audio and video tracks.
media.log
AudioFlinger debugging feature available in custom builds only. Used for logging audio events to a circular buffer where they can then be retroactively dumped when needed.
mediaserver
Android system process that contains media-related services, including AudioFlinger.
NBAIO
Non-blocking audio input/output. Abstraction for AudioFlinger ports. The term can be misleading as some implementations of the NBAIO API support blocking. The key implementations of NBAIO are for different types of pipes.
silent mode
User-settable feature to mute the phone ringer and notifications without affecting media playback (music, videos, games) or alarms.
SoundPool
Higher-level client API than AudioTrack. Plays sampled audio clips. Useful for triggering UI feedback, game sounds, etc. The API is defined at android.media.SoundPool.
Stagefright
Android includes Stagefright, a media playback engine at the native level that has built-in software-based codecs for popular media formats.
Stagefright audio and video playback features include integration with OpenMAX codecs, session management, time-synchronized rendering, transport control, and DRM.
Stagefright also supports integration with custom hardware codecs provided by you. To set a hardware path to encode and decode media, you must implement a hardware-based codec as an OpenMax IL (Integration Layer) component.
StateQueue
Module within AudioFlinger responsible for synchronizing state among threads. Whereas NBAIO is used to pass data, StateQueue is used to pass control information.
stream type
Enumeration that expresses a use case for audio output. The audio policy implementation uses the stream type, along with other parameters, to determine volume and routing decisions. For a list of stream types, see android.media.AudioManager.
ToneGenerator
Higher-level client API than AudioTrack. Plays dual-tone multi-frequency (DTMF) signals. For details, refer to Dual-tone multi-frequency signaling and the API definition at android.media.ToneGenerator.
track
Audio stream. Controlled by the AudioTrack or AudioRecord API.
volume index
Unitless integer that expresses the desired relative volume of a stream. The volume-related APIs of android.media.AudioManager operate in volume indices rather than absolute attenuation factors.


Thanks
Saurabh Sharma
Happy Coding !!!

Build a Custom Kernel Module for Android

Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...