Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 29 Jun 2017, 07:01
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to edit audio_policy.conf in Android Lollipop
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [26 Posts]   Goto page: 1, 2 Next
Author Message
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Fri 30 Oct 2015, 11:05    Post subject:  How to edit audio_policy.conf in Android Lollipop
Subject description: hacking smartphone for mono audio output w/o root access
 

EDIT: I neglected to mention my mission here. I want to edit audio_policy.conf to output mono audio to the earbud jack.

First off, why can't I see my Motorola Lollipop smartphone's system files when I mount the device through MTP? I can understand why I might not be able to edit the system files, but shouldn't I at least be able to view the files? Since I can't edit the system files from my Slacko box, I am trying to edit audio_policy.conf with ES File Manager on the smartphone. I wish there were an easier way to work on this file, but I guess I will painstakingly transfer it to this thread, just to get a better view of it:
Code:
#Global configuration section: lists input and output devices always
present on the device as well as the output device selected by default.
Devices are designated by a string that corresponds to the enum in
audio.h

global_configuration {
  attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|
AUDIO_DEVICE_OUT_SPEAKER
  default_output_device AUDIO_DEVICE_OUT_SPEAKER
  attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|
AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX|
AUDIO_DEVICE_IN_FM_RX|AUDIO_DEVICE_IN_FM_RX_A2DP
}

# audio hardware module section: contains descriptors for all audio hw
modules present on the device. Each hw module node is named after the
corresponding hw module library base name.
For instance, "primary" corresponds to audio primary.<device>.so.
The "primary" mmodule is mandatory and must include at least one
output with AUDIO_OUTPUT_FLAG_PRIMARY flag.
Each module descriptor contains one or more output profile descriptors
and zero or more input profile descriptors. Each profile lists all the
parameters supported by a given output or input stream category.
The "channel masks", "formats", "devices" and "flags" are specified using
 strings corresponding to enums in audio.h and audio policy.h. They are
 concatenated by use of "|" without space or "\n".

audio_hw_modules {
  primary {
    outputs {
      primary {
        sampling_rates 44100|48000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|
AUDIO_DEVICE_OUT_LINE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_FM
        flags AUDIO_OUTPUT_FLAG_PRIMARY
      }
      low_latency {
         sampling_rates 44100/48000
         channel_masks AUDIO_CHANNEL_OUT_STEREO
         formats AUDIO_FORMAT_PCM_16_BIT
         devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_WIRED_HEADPHONE|
AUDIO_DEVICE_OUT_LINE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_FM
         flags AUDIO_OUTPUT_FLAG_FAST
      }
      compress_offload {
        sampling rates 8000|11025|16000|22050|24000|32000|44100|48000
        channel_masks AUDIO_CHANNEL_OUT_MONO|
AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AAC_LC
AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2
        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_
HEADPHONE|AUDIO_DEVICE_OUT_LINE|AUDIO_DEVICE_OUT_ALL_SCO
        flags AUDIO_OUTPUT_FLAG_DIRECT|
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|
AUDIO_OUTPUT_FLAG_NON_BLOCKING
      }
    }
    inputs {
      primary {
        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
        channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL
_IN_FRONT_BACK
        formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_AMR_NB|
AUDIO_FORMAT_AMR_WB|AUDIO_FORMAT_QCELP|AUDIO_FORMAT_EVRC|
AUDIO_FORMAT_EVRCB|AUDIO_FORMAT_EVRCWB|AUDIO_FORMAT_EVRCNW
        devices AUDIO_DEVICE_IN_BUILTIN_MIC|
AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BLUETOOTH_SCO_
HEADSET|AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_ANLG_DOCK
_HEADSET|AUDIO_DEVICE_IN_FM_RX|AUDIO_DEVICE_IN_FM_RX_A2DP|
AUDIO_DEVICE_IN_VOICE_CALL
    }
   }
  }
  a2dp {
    outputs {
      a2dp {
        sampling_rates 44100
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_ALL_A2DP
     }
    }
   }
   usb {
     outputs {
       usb_accessory {
         sampling_rates 44100
         channel_masks AUDIO_CHANNEL_OUT_STEREO
         formats AUDIO_FORMAT_[C,_16_BIT
         devices AUDIO_DEVICE_OUT_ALL_A2DP   
      }
     }
    }
    usb {
      outputs {
        usb_accessory {
          sampling_rates 44100
          channel_masks AUDIO_CHANNEL_OUT_STEREO
          formats AUDIO_FORMAT_PCM_16_BIT
          devices AUDIO_DEVICE_OUT_USB_ACCESSORY
        }
        usb_device {
          sampling_rates dynamic
          channel_masks dynamic
          formats dynamic
          devices AUDIO_DEVICE_OUT_USB_DEVICE
        }
       }
       inputs {
         usb_device {
           sampling_rates dynamic
           channel_masks AUDIO_CHANNEL_IN_STEREO
           formats AUDIO_FORMAT_PCM_16_BIT
           devices AUDIO_DEVICE_IN_USB_DEVICE
         }
        }
       }
       r_submix {
         outputs {
           submix {
             sampling_rates 48000
             channel_masks AUDIO_CHANNEL_IN_STEREO
             formats AUDIO_FORMAT_PCM_16_BIT
             devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
        }
       }
       inputs {
         submix {
           sampling_rates 48000
           channel_masks AUDIO_CHANNEL_IN_STEREO
           formats AUDIO_FORMAT_PCM_16_BIT
           devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
         }
        }
       }
      }

I read a hint about getting mono audio output on an Android phone from a post on a Google Code thread. A positive note that I learned from reading this thread is that mono audio is there already because Android uses ALSA, it just needs to be called into play correctly. Towit:
Quote:
An update, I have found a way to solve this issue at
least on the HTC One m8, and I suspect the m9 as well.
It is possible to edit the audio_policy.conf file found
in /system/etc and change every AUDIO_CHANNEL_OUT_STEREO
entry to AUDIO_CHANNEL_OUT_MONO, making sure to remove
duplicates. This properly mixes mono audio as long as
boomsound is turned on. As for mixing without boomsound,
I don't know.

Why can't I see this system file from my Slacko box when I mount the smartphone as MTP device? I notice that all instances of MONO in audio_policy.conf have a pipe after the word, as in MONO|.

Would anyone care to venture an opinion about whether I will be able to edit this system file when I don't have root access? Thank you.

For purposes of comparison, here is my LG KitKat smartphone's audio_policy.conf file with the Stereo-Mono switch set to Mono
Code:
global configuration section: lists input and output devices always
present on the device as well as the output device selected by default.
Devices are designated by a string that corresponds to the enum in audio.h

global configuration {
  attached_output_devices
AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER
  default_output_device
AUDIO_DEVICE_OUT_SPEAKER
  attached_input_devices
AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE
_IN_REMOTE_SUBMIX|AUDIO_DEVICE_IN_VOICE_CALL
}

#audio hardware module section: contains descriptors for all audio hw
modules present on the device. Each hw module node is named after the
corresponding hw module library base name.
For instance, "primary" corresponds to audio primary.<device>.so.
The "primary" mmodule is mandatory and must include at least one
output with AUDIO_OUTPUT_FLAG_PRIMARY flag.
Each module descriptor contains one or more output profile descriptors
and zero or more input profile descriptors. Each profile lists all the
parameters supported by a given output or input stream category.
The "channel masks", "formats", "devices" and "flags" are specified using
strings corresponding to enums in audio.h and audio policy.h. They are
concatenated by use of "|" without space or "\n".

audio_hw_modules {
  primary {
    outputs {
      primary {
        sampling_rates 44100|48000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_
HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_
PROXY|AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET|AUDIO_DEVICE_
OUT_FM|AUDIO_DEVICE_OUT_FM_TX
         flags AUDIO_OUTPUT_FLAG_PRIMARY
      }
      low_latency {
         sampling_rates 44100/48000
         channel_masks AUDIO_CHANNEL_OUT_STEREO
         formats AUDIO_FORMAT_PCM_16_BIT
         devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_WIRED_HEADPHONE|
AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_PROXY|AUDIO_DEVICE
_OUT_ANLG_DOCK_HEADSET|AUDIO_DEVICE_OUT_FM|AUDIO_DEVICE_OUT_
FM_TX
         flags AUDIO_OUTPUT_FLAG_FAST
      }
  compress_offload {
        sampling rates 8000|11025|16000|22050|24000|32000|44100|48000
        channel_masks
AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AAC
        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|
AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_
HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_
PROXY|AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET|AUDIO_DEVICE
_OUT_FM_TX
        flags AUDIO_OUTPUT_FLAG_DIRECT|
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|
AUDIO_OUTPUT_FLAG_NON_BLOCKING
     }
     incall_music
        sampling_rates 8000|16000|48000
        channel masks
AUDIO_CHANNEL_OUT_MONO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices
AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE
_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_
DEVICE_ANLG_DOCK_HEADSET|AUDIO_DEVICE_OUT_ALL_USB|AUDIO_
DEVICE_OUT_ALL_SCO
        flags
AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_INCALL_MUSIC     
     }
     voip_rx {
       sampling_rates 8000|16000
       channel_masks
AUDIO_CHANNEL_OUT_MONO
       formats
AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_AMR_NB|AUDIO_FORMAT_AMR
_WB|AUDIO_FORMAT_QCELP|AUDIO_FORMAT_EVRC|AUDIO_FORMAT_EVRCB|
AUDIO_FORMAT_EVRCWB|AUDIO_FORMAT_EVRCNW
       devices
AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_
OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO
_DEVICE_OUT_ANLG_DOCK_HEADSET|AUDIO_DEVICE_OUT_ALL_SCO
       flags
AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX
    }
    irrc {
       sampling_rates 48000
       channel_masks
AUDIO_CHANNEL_OUT_STEREO
       formats AUDIO_FORMAT_PCM_16_BIT
       devices AUDIO_DEVICE_OUT_IRRC
       flags
AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_IRRC
    }

   }
   inputs {
      primary {
         sampling_rates
8000|11025|12000|16000|22050|24000|32000|44100|48000
         channel_masks
AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL
_IN_FRONT_BACK|AUDIO_CHANNEL_IN_5POINT1|AUDIO_CHANNEL_IN_VOICE_
CALL_MONO|AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO|AUDIO_CHANNEL_
IN_VOICE_UPLINK_MONO
         formats
AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_AMR_NB|AUDIO_FORMAT_AMR
_WB|AUDIO_FORMAT_QCELP|AUDIO_FORMAT_EVRC|AUDIO_FORMAT_EVRCB|
AUDIO_FORMAT_EVRCWB|AUDIO_FORMAT_EVRCNW
        devices
AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO
_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_BACK_MIC| AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET|AUDIO_DEVICE_IN_FM_RX|AUDIO_
DEVICE_IN_FM_RX_A2DP|AUDIO_DEVICE_IN_VOICE_CALL|AUDIO_DEVICE_
IN_PROXY|AUDIO_DEVICE_IN_COMMUNICATION
      }
    }
  }
  a2dp {
    outputs {
      a2dp {
        sampling_rates 44100
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_ALL_A2DP
     }
    }
   }
   usb {
     outputs {
       usb_accessory {
         sampling_rates 44100
         channel_masks AUDIO_CHANNEL_OUT_STEREO
         formats AUDIO_FORMAT_[C,_16_BIT
         devices AUDIO_DEVICE_OUT_ALL_A2DP   
      }
     }
    }
    usb {
      outputs {
        usb_accessory {
          sampling_rates 44100
          channel_masks AUDIO_CHANNEL_OUT_STEREO
          formats AUDIO_FORMAT_PCM_16_BIT
          devices AUDIO_DEVICE_OUT_USB_ACCESSORY
        }
        usb_device {
          sampling_rates dynamic
          channel_masks dynamic
          formats dynamic
          devices AUDIO_DEVICE_OUT_USB_DEVICE
        }
       }
       inputs {
         usb_device {
           sampling_rates dynamic
           channel_masks AUDIO_CHANNEL_IN_STEREO
           formats AUDIO_FORMAT_PCM_16_BIT
           devices AUDIO_DEVICE_IN_USB_DEVICE
         }
        }
       }
       r_submix {
         outputs {
           submix {
             sampling_rates 48000
             channel_masks AUDIO_CHANNEL_IN_STEREO
             formats AUDIO_FORMAT_PCM_16_BIT
             devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
        }
       }
       inputs {
         submix {
           sampling_rates 48000
           channel_masks AUDIO_CHANNEL_IN_STEREO
           formats AUDIO_FORMAT_PCM_16_BIT
           devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
         }
        }
       }
      }

Last edited by nubc on Mon 09 Nov 2015, 23:51; edited 22 times in total
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2590

PostPosted: Fri 30 Oct 2015, 13:23    Post subject:  

mtp only shows the files on the real removable SD card -not the system partitions or internal storage. In order to get the internal storage to be used and seen from outside, you have to edit the fstab and switch the two devices (sdcard0 and sdcard1).
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Fri 30 Oct 2015, 13:59    Post subject:  

Here is fstab on the Slacko box with the smartphone mounted
Code:
/dev/sda1     /            ext3     defaults               0 1
none          /proc        proc     defaults               0 0
none          /sys         sysfs    defaults               0 0
none          /dev/pts     devpts   gid=2,mode=620         0 0
/dev/fd0      /mnt/floppy  auto     noauto,rw              0 0

Is this the fstab that I edit? Where is the fstab to which you refer?

Here is vold.fstab from the smartphone
Code:
# MTP
# dev_mount sdcard2 /mnt/sdcard/external_sd auto /devices/platform/
msm_sdcc.3/mmc_host
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Fri 30 Oct 2015, 19:21    Post subject:  

Your Android device is an older version 2.x , that uses normal mount as your vold.fstab shows .

/etc/fstab is useless, except for `mount -a' and `umount -a' code .

Puppy does not use fstab much, except for shutdown , where in rc.shutdown it executes umount -ar at the very end .

Woof-CE may mount -a at boot, I am not sure . I do not use mount -a .

Android v2 does only give access to the external storage .

Android v4 gives access to the external storage partition and the internal storage partition .

Android refuses SD-Cards that have more than one partition .
I wanted to add some SWAP partition once and it got refused .

Android has up to 15 internal partitions . Cache is a partition for example .
There are also two boot partitions . One for normal boot and one for Recovery Boot .
And a few other partitions .

I have an Huawei x3 with Android v2.3.x that i fetched a custom BOOT ROM on the net for that allowed me to root it .

https://www.clockworkmod.com/

The same ROM bricked my Motorola Fire XT311 , I guess since it has an other internal partition layout .

Such Boot Recovery Images are apparently made while creating CUSTOM OS ROMS for Android .

Here is the git repo of such a SDK :
url = https://github.com/CyanogenMod/android.git

It depends on the whole Android SDK from Git , which is a very huge download .
And such a Custom ROM involves compiling a new linux kernel for it .

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Fri 30 Oct 2015, 23:28    Post subject:  

Motorola is known to be a bit behind when it comes to leading edge technology, but this Moto G 2015 is running Lollipop 5.1.1, and will soon be able to upgrade to Marshmallow (v6.0). It may very well be using an antequated fstab setup, I have no idea. I certainly wish that Android did not have such a zany file system tree, with all the emulations. From what you describe, it seems that installing a ROM is like Russian Roulette. You say it was the non-compliant file structure that deep-sixed your phone? Maybe if I used a liveCD of Android-x86 4.0 I could see something. Thing about that old version, now certainly deprecated, is that it was rooted.
Back to top
View user's profile Send private message 
dancytron

Joined: 18 Jul 2012
Posts: 757

PostPosted: Sat 31 Oct 2015, 00:22    Post subject:  

I've rooted 4 different phones and installed cyanogenmod on each of them. I haven't had any problem.

What I've always done is find my phone on the cyanogen wiki or http://forum.xda-developers.com/ and followed the instructions exactly.

If you download clockwork mod (or safestrap or twrp) and try to wing it, you are begging to brick your device. Find a set of instructions, read them carefully and follow them exactly and you won't have any trouble.
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Sat 31 Oct 2015, 04:04    Post subject:  

I bought this phone a week ago, so I'm not in a rush to void the warranty, especially before the return period is up. Right now I am deciding on whether to buy a $10 case for it. What Android version is cyanogenmod based on? You know, I saw a hack for Mono Audio Out on XDA-developers site, written by a user (not a dev), but I can't find it now. I think I bookmarked it using one of my frugal installs. I am going to post the code here when I find it again, it was only about 10 lines. Basically, IIRC the code mixed stereo down to mono.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Sat 31 Oct 2015, 08:08    Post subject:  

I think, that without root access , one is out of luck .

The Android SDK has in android-sdk-linux/platform-tools

adb

program .

Android v4 apparently does not get detected by older adb version 1.0.31 and earlier .

bash-3.00# ./adb version
Android Debug Bridge version 1.0.32

bash-3.00# ./adb devices -l
List of devices attached
0123456789ABCDEF device usb:1-4 product:BARM865FD model:Endeavour_785 device:BARM865FD

bash-3.00# ./adb shell
shell@BARM865FD:/ $

shell@BARM865FD:/ $ ls -l

Other has almost no permissions .

cat /proc/mtd /proc/mounts
works, as
dmesg
command .

But that is it.

One could use adb push and pull to copy files ,
but even copying write protected files into the PC does not work, when read permissions are not set .

I can not even do a cat /dev/block/mtdblock0 to make a backup image of a partition .

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Mon 09 Nov 2015, 13:56    Post subject:  

I have neglected the fact that I have an LG KitKat phone with the Stereo/Mono switch. All I have to do is find this code on the phone. At first glance the audio_policy.conf file on the LG phone looks very similar to the one on Motorola Lollipop phone. Only way to tell for sure is to copy the file to this thread, the hard way.

By the way, is there some way to disable ES Cleaner? When did ES File Manager put this junkware on the app?

Even if I put cyanogenmod on this phone, there would still be no Mono audio output. I see threads on the XDA website, people begging for a fix for cyanogenmod to get mono audio out, without much luck.

Please have a look at the LG KitKat's audio_policy.conf file in the first post, and let me know if you see a stereo-mono switch, or some provision for mono audio output.

convert stereo to mono, using avconvert
Code:
avconv -i input.mp4 -c:v copy -c:a libmp3lame -ac 1 out.avi
avconv -i input.mp3 -c:a libmp3lame -ac 1 out.avi
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Mon 09 Nov 2015, 21:06    Post subject:  

Boeffla Sound Control
https://play.google.com/store/apps/details?id=com.near.boefflasound
requires Root and Busybox
feature: Mono Downmix
drawbacks: no L-R channel sound balance, last update 2013, based on Android 4.3

Can someone determine whether this app will output media audio in mono:
SoundAbout
https://play.google.com/store/apps/details?id=com.woodslink.android.wiredheadphoneroutingfix&hl=en
[I couldn't do anything with it. Uninstalled it.]

What is the analog dock?

I have an LG phone here. It has an OEM specific, custom setting to downmix stereo to mono. Where would the code for this setting be located in Android? mixer_paths.xml ? Of course the downmixing might not be anywhere because mono is actually available from ALSA, which is integrated into the kernel. How come when I search the file system for ALSA, I get no result?
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Wed 06 Jan 2016, 13:21    Post subject:  

If Google/Android coders ever needed a good reason to implement Mono Audio Output, they just got one. California just made it illegal to drive with both earbuds inserted. Only a single inserted earbud is permissible while driving a motor vehicle or riding a bicycle. For reasons of safety, one ear must be left open to hear the external environment.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2590

PostPosted: Wed 06 Jan 2016, 15:10    Post subject:  

Maybe under Accessibility settings? Which LG model is it?
You are wanting a non-root(ed) solution?
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Fri 08 Jan 2016, 06:23    Post subject:  

It's an LG Optimus L90 aka LG-D415. The setting is in Accessibility. I have heard this setting referred to as a "widget". I seek the location of the code that downmixes stereo to mono, or, alternatively, the code that pulls mono out of ALSA or OSS.

One observation that has me puzzled about LG's implementation of Mono Audio Output is that some mp3 files still play in stereo even when the audio output is set to Mono. While I have not encountered an mp4 that outputs in stereo when audio is set to Mono, there are some moments when I think I am hearing two different audio tracks in either ear. So while I can't complain about mp4 performance in Mono, there are stereo mp3 files that seem unaffected by the Stereo-Mono switch. The puzzlement is how exactly LG implements Mono Audio Output that would account for these discrepancies. Why do some mp3s still play in stereo (ugh), and why am I occasionally hearing mp4 audio in two different tracks? The implication being that the Mono Audio is not coming from kernel component ALSA, but rather from HAL or some software layer in user space, like a playback library that most music players utilize.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2590

PostPosted: Fri 08 Jan 2016, 10:30    Post subject:  

I see something about an called poweramp which may help. As for the location of the code used by the LG, it's anyone's guess -if you mean the source code. Some makes/models are good about making their sources available. Others don't 'get it' and try to hide their proprietary stuff.

And I see that the android native audio library is called AudioFlinger, if that helps and applies to lollipop.
Back to top
View user's profile Send private message 
nubc


Joined: 23 Jan 2007
Posts: 1784
Location: USA

PostPosted: Fri 08 Jan 2016, 11:47    Post subject:  

I'm hoping this is not my problem anymore. How can Android devs ignore that 39 million people cannot legally use both earbuds in a common mobile circumstance, driving a car? I mean, Google could probably buy the California legislature and have the law rescinded, but that is unlikely. We're not talking about several thousand hearing impaired users, or geriatrics with uneven hearing loss/ability. We're talking about 39 million people, the population size of a country, who are restricted to a single earbud while driving. (Canada's population is 35.5 million. Australia's population is 24 million.) Google headquarters is in Mountain View, California.

The simplest solution is to implement mono audio output, and to provide Left-Right channel balance, a solution which gives the most users the most choices. Just like Apple did 6 years ago, and LG and Samsung did as well. Duh. Which doesn't mean that Google will do it that way. Oh no, Google is special. Google will come up with some convoluted beta solution that nobody likes or wants. Like what Android just did with SD cards in Marshmallow, making the SD card part of the internal memory, making users go through the inconvenience of wiping their SD card and starting over. Inconveniencing users is no problem for Google. It's all one grand experiment to Google. No perspective, no foresight = a management problem.

perspective - the capacity to discern what is fundamentally important
foresight - the ability to anticipate and solve problems before implementation

Last edited by nubc on Fri 08 Jan 2016, 15:28; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [26 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0943s ][ Queries: 14 (0.0156s) ][ GZIP on ]