Showing preview only (613K chars total). Download the full file or copy to clipboard to get everything.
Repository: yzyhk904/USB_SampleRate_Changer
Branch: main
Commit: 4c7bed6300a9
Files: 120
Total size: 574.3 KB
Directory structure:
gitextract_2byr8jbn/
├── LICENSE
├── README.md
├── USB_SampleRate_Changer.sh
├── Usage_Samples/
│ ├── Bluetooth/
│ │ ├── change-bluetooth-hal_Status.sh
│ │ ├── change-bluetooth-hal_aosp.sh
│ │ ├── change-bluetooth-hal_legacy.sh
│ │ ├── change-bluetooth-hal_offload.sh
│ │ └── change-bluetooth-hal_sysbta.sh
│ ├── Dump/
│ │ ├── alsa-hw-params_all.sh
│ │ ├── alsa-hw-params_none.sh
│ │ ├── dumpsys-bluetooth-filtered_all.sh
│ │ ├── dumpsys-bluetooth-filtered_none.sh
│ │ ├── dumpsys-filtered_all.sh
│ │ ├── dumpsys-filtered_none.sh
│ │ ├── getConfig_all.sh
│ │ └── getConfig_none.sh
│ ├── Jitter/
│ │ ├── jitter-reducer_++all.sh
│ │ ├── jitter-reducer_++battery.sh
│ │ ├── jitter-reducer_++camera.sh
│ │ ├── jitter-reducer_++effect.sh
│ │ ├── jitter-reducer_++io.sh
│ │ ├── jitter-reducer_++wifi.sh
│ │ ├── jitter-reducer_--all.sh
│ │ ├── jitter-reducer_--battery.sh
│ │ ├── jitter-reducer_--boost-max.sh
│ │ ├── jitter-reducer_--camera.sh
│ │ ├── jitter-reducer_--effect.sh
│ │ ├── jitter-reducer_--io-boost.sh
│ │ ├── jitter-reducer_--most.sh
│ │ ├── jitter-reducer_--wifi.sh
│ │ └── jitter-reducer_Status.sh
│ ├── Resampling/
│ │ ├── change-resampling-quality_159dB_480_92.sh
│ │ ├── change-resampling-quality_165dB_360_104.sh
│ │ ├── change-resampling-quality_179dB_408_99.sh
│ │ ├── change-resampling-quality_194dB_520_100.sh
│ │ ├── change-resampling-quality_Reset.sh
│ │ ├── change-resampling-quality_Status.sh
│ │ ├── change-resampling-quality__Ultra-HiFi.sh
│ │ ├── change-resampling-quality_cheapies_44kHz.sh
│ │ ├── change-resampling-quality_cheapies_44kHz_cheapest.sh
│ │ ├── change-resampling-quality_cheapies_48kHz-cheapest.sh
│ │ ├── change-resampling-quality_cheapies_48kHz.sh
│ │ ├── change-resampling-quality_cheapies_96kHz.sh
│ │ ├── change-resampling-quality_mock-DAC-A.sh
│ │ ├── change-resampling-quality_mock-DAC-B.sh
│ │ ├── change-resampling-quality_mock-DAC-C.sh
│ │ └── change-resampling-quality_mock-Mastering.sh
│ ├── USB/
│ │ ├── USB_44k_32.sh
│ │ ├── USB_48k_16.sh
│ │ ├── USB_48k_24.sh
│ │ ├── USB_48k_24_offload-direct.sh
│ │ ├── USB_48k_24_offload-direct_drc.sh
│ │ ├── USB_48k_24_offload-hifi-playback.sh
│ │ ├── USB_48k_24_offload-hifi-playback_drc.sh
│ │ ├── USB_48k_32.sh
│ │ ├── USB_48k_32_bypass-offload.sh
│ │ ├── USB_48k_32_drc.sh
│ │ ├── USB_48k_32_offload-hifi-playback.sh
│ │ ├── USB_88k_32.sh
│ │ ├── USB_96k_24.sh
│ │ ├── USB_96k_32.sh
│ │ ├── USB_96k_32_bluetooth-qti.sh
│ │ ├── USB_96k_32_drc.sh
│ │ ├── USB_96k_32_legacy.sh
│ │ ├── USB_96k_32_offload-direct.sh
│ │ ├── USB_96k_32_offload-direct_drc.sh
│ │ ├── USB_96k_32_offload-safer.sh
│ │ ├── USB__176k_32.sh
│ │ ├── USB__192k_32.sh
│ │ ├── USB__192k_32_offload-safer.sh
│ │ ├── USB__353k_32.sh
│ │ ├── USB__353k_32_offload-direct.sh
│ │ ├── USB__384k_32.sh
│ │ ├── USB__384k_32_drc.sh
│ │ ├── USB__384k_32_offload-direct.sh
│ │ ├── USB__384k_32_offload-safer.sh
│ │ ├── USB__706k_32.sh
│ │ ├── USB__768k_32.sh
│ │ ├── USB__768k_32_drc.sh
│ │ ├── USB__Reset.sh
│ │ ├── USB__auto_max.sh
│ │ ├── USB__auto_max_drc.sh
│ │ └── USB__test_template.sh
│ └── USB Period/
│ ├── change-usb-period_2000.sh
│ ├── change-usb-period_20375.sh
│ ├── change-usb-period_2250.sh
│ ├── change-usb-period_2500.sh
│ ├── change-usb-period_2750.sh
│ ├── change-usb-period_4000.sh
│ ├── change-usb-period_Reset.sh
│ └── change-usb-period_Status.sh
├── changelog.md
├── extras/
│ ├── alsa-hw-params.sh
│ ├── change-bluetooth-hal.sh
│ ├── change-resampling-quality.sh
│ ├── change-usb-period.sh
│ ├── dumpsys-bluetooth-filtered.sh
│ ├── dumpsys-filtered.sh
│ ├── getConfig.sh
│ ├── jitter-reducer-functions.shlib
│ └── jitter-reducer.sh
├── functions3.shlib
└── templates/
├── Old/
│ ├── bypass_offload_safer_mtk_template.xml
│ ├── bypass_offload_safer_template.xml
│ ├── bypass_offload_template.xml
│ ├── legacy_template.xml
│ ├── offload_direct_template.xml
│ ├── offload_hifi_playback_template.xml
│ ├── offload_template.xml
│ ├── safe_template.xml
│ ├── safest_auto_template.xml
│ ├── safest_template.xml
│ └── usb_only_template.xml
├── bypass_offload_safer_amzm_template.xml
├── bypass_offload_safer_template.xml
├── bypass_offload_template.xml
├── offload_direct_template.xml
├── offload_hifi_playback_template.xml
├── offload_safer_template.xml
└── offload_template.xml
================================================
FILE CONTENTS
================================================
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
================================================
FILE: README.md
================================================
## USB (including a 3.5mm jack and an internal speaker) sample rate changer for Android devices on the fly
This is not a Magisk module but a collection of root shell scripts using Magisk su or phh's SuperUser (uninstall "termux" and magisk modules replacing "toybox" and "busybox" commands if you've used them because they break the Adnroid standard and make this script work wrongly), and can be installed by just unpacking its ZIP archive on your Internal Storage ("/sdcard") or another. Under Magisk environment (<strong>"root name space mount mode" must be changed to "global"</strong> in the settings of Magisk Manager), this script changes the sample rate of the USB (including hardware offloading) audio class driver on Android devices on the fly like the developer setting of Bluetooth LDAC or the Windows mixer for <q><em>avoiding annoying SRC (Sample Rate Conversion) distortion ultimately (i.e., not only the distortion of the OS mixer as usual, but also the over-sampling distortion in DAC's; For those who are curious about such distortion, try my mock equipment parameters in the appendix table)</em></q>. This script signals the audioserver on the "global" mount name space to try to reload an audio policy configuration file generated by this script with a specified sample rate and bit depth, so the "root name space mount mode" change is needed. <br/>
<br/>
Additionally, this script disables DRC (Dynamic Range Control, i.e., a kind of compression) if DRC has been enabled on a stock firmware. For example, smart phones and tablets whose SoC's have an SDM??? or SM???? model number usually enable DRC on all audio outputs, but those whose SoC's have an MT???? model number don't enable DRC on any audio output. (Note: some custom ROM's (not stocks and GSI's) intendedly invert or change the DRC mode on context, then this script cannot disable DRC)<br/>
<br/>
Finally, the Android OS mixer (AudioFlinger) recently changed its behavior so as to always bypass its resampling (or virtual analog low-pass filtering involved by sinc function interpolation) if the sampling frequency of its input is equal to that of its output. So the resampling doesn't distort sound, but does remove an effect easing jitter by buffering satisfying its filter length.
* Usage: `sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh [--reset] [--drc] [--bypass-offload][--bypass-offload-safer][--offload][--offload-hifi-playback][--offload-drect][--offload-safer][--legacy][--safe][--safest][--safest-auto][--usb-only] [[44k|48k|88k|96k|176k|192k|353k|384k|706k|768k] [[16|24|32|float]]]`,
if you unpack the archive under "/sdcard" (Internal Storage). The arguments are a sample rate and a bit depth (or 32bit float) to which you want to change, respectively. Their default values are `44k` (sample rate: 44.1 kHz) and `32` (bit depth: 32 bits (signed integer)) except both safe and safest mode internal outputs (default values: 48 kHz, 32 or 16 bits).
- Options
- `--reset`(without arguments): resets its previous execution results.
- `--drc`: enables DRC (Dynamic Range Control, i.e., compression, typically sticking to all audio outputs on Qcomm devices) for the purpose of comparison to this script's usual DRC-less audio quality (not effective for --usb-only mode). No DRC unless this option. Please unplug your headphones or earphones before executing a command for propagating this effect.
- `--bypass-offload`: changes an audio policy configuration file for bypassing USB & Bluetooth hardware offloading (worse in audio quality) and using a non- hardware offloading USB & Bluetooth audio driver (better in audio quality; A small jitter USB driver and an AOSP Bluetooth driver without unnecessary resampling) while a 3.5 mm jack and an internal speaker use a hardware offloading driver with specified samplerate and audio format but non- hardware offloading drives detect them automatically.
- `--bypass-offload-safer`: changes an audio policy configuration file for bypassing USB & Bluetooth hardware offloading (worse in audio quality) and using a non- hardware offloading USB & Bluetooth audio driver (better in audio quality) while a 3.5 mm jack and an internal speaker use a hardware offloading driver keeping the same settings (48 kHz & 16bit/24 bits).
- `--offload`: changes an audio policy configuration file for USB & Bluetooth hardware offloading (worse in audio quality; a large jitter USB driver and a Bluetooth driver forcing unnecessary resampling, i.e., typically 44.1 kHz -> 48 kHz -> 44.1 kHz double resampling).
- `--offload-hifi-playback`: changes an audio policy configuration file for USB hardware offloading including a USB audio "hifi_playback" mixer (worse in audio quality; its samplerate and audio format are automatically detected (for 7.0 audio implementations) or fixed at 192 kHz/96 kHz 32 bits mode otherwise) while disabling a2dp hardware offloading (better in audio quality).
- `--offload-direct`: changes an audio policy configuration file for USB & Bluetooth hardware offloading (worse in audio quality) with "direct_pcm" and "compressed_offload" modes for 3.5 mm jack, bluetooth and USB audio output bypassing mixers. Added for comparing usual mixer modes to direct modes on Qcomm devices with&without DRC, especially to bluetooth audio "direct_pcm" mode with&without DRC.
- `--offload-safer`: changes an audio policy configuration file for USB hardware offloading (worse in audio quality) except Bluetooth while a 3.5 mm jack and an internal speaker keeping the same settings (48 kHz & 32 bits).
- `--legacy`: changes an audio policy configuration file for a Bluetooth audio legacy HAL (<em>/system/{lib,lib64}/hw/audio.a2dp.default.so</em>).
- `--safe`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps considerably traditional settings for an internal speaker and others.
- `--safest`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps most traditional settings for an internal speaker and others.
- `--safest-auto`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps most traditional settings for an internal speaker and others with automatic max. samplerate detection for USB devices.
- `--usb-only`: changes a USB audio policy configuration file only.
- `--force-bluetooth-qti`: forces to use "bluetooth_qti" bluetooth module (Qcomm's legacy one) instead of usual ones.
- For typical example, `sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh` automatically investigates your device and determines the audio policy configuration type ("offload" (including USB & Bluetooth), "bypass-offload-safer" ("offload" except USB & Bluetooth), "legacy" ("offload" except USB & Bluetooth but using a legacy Bluetooth module "a2dp"), "safe" (for non-offloading devices using the "a2dp") and "safest" (for old devices). And this sets the sample rate and the bit depth of your device to be 44.1 kHz and 32 bits except internal ouputs of "bypass-offload-safer", "safe" and "safest" modes. If you want to set another sample rate and bit depth, please specify specific values.
- I recommend using `sManager` (Script Manager) or the like for easiness (at boot automatic execution, saving many combinations of script options and parameters as aliases, and so on. If your device doesn't allow to install it, try to use `mixplorer` (select and execute in its three dot menu) with "Usage Samples" (if you execute them by `su` on "KernelSU-Next", select "nethunter.root" app profile template for`mixplorer`). Or try `adb install --bypass-low-target-sdk-block sManager-package-name.apk` command on PC to force sManager installation.
- When using a USB DAC, please disconnect the DAC from the USB socket of an Android device once after your execute this script every time, for ensuring the changed audio configuration to be effective completely on the device.
* Don't forget to install another magisk module of mine ["Audio jitter silencer"](https://github.com/Magisk-Modules-Alt-Repo/audio-jitter-silencer) with this tool and uninstall "Digital Wellbeing" app (for reducing very large jitters which this tool cannot reduce as itself)!
* This script and following ones in "extras" folder have been tested on LineageOS and crDroid ROM's, and phh GSI's (Android 10 ~ 16, Qualcomm & MediaTek SoC, and Arm32 & Arm64 combinations).
* Note 1: "USB_SampleRate_Changer.sh" requires unlocking the USB audio class driver's limitation (upto 96 kHz (USB HAL) lock, 384 kHz offload lock for Qcomm devices or 96 kHz offload lock for MTK (actually only bypass to the USB HAL driver) and Tensor devices) if you want to specify greater than 96 kHz or 384 kHz (in case of Qcomm USB hardware offloading, i.e., maybe hardware offload tunneling to the ALSA driver). See my companion magisk module ["usb-samplerate-unlocker"](https://github.com/Magisk-Modules-Alt-Repo/usb-samplerate-unlocker) for non- hardware offload drivers and Tensor specific offload drivers (only supprting 44.1, 48, 96 and 192 kHz with 24 and 32 bits (signed integer) depth). Although you specify a high sample rate for this script execution, you cannot connect your device to a USB DAC with the sample rate unless the USB DAC supports the sample rate (the USB driver will limit the connecting sample rate down to its maximum sample rate).
* Note 2: This script and other extras ones can be executed under "phh's SuperUser" root environment on recent A/B partition phh-GSI's. If you find some errors under the environment, try `setenforce 0` with root permission for making Selinux mode to be permissive. Some phh-GSI's have wrong selinux permission settings.
* Note 3: Entry class USB DAC's usually adopt an interface chip communicating with the adaptive mode or the synchronous one defined in the USB audio standard. As in these modes an Android host controller sends audio sampling rate clock signals to the DAC, jitter generated at the host side affects the audio quality of the DAC tremendously. Higher class DAC's communicate with the asynchronous mode (also defined in the standard) to a host controller, but they actually use a PLL to reduce jitter from the host not to stutter even in heavy jitter situations. As this result, they behave as the adaptive mode with a feedback loop to dynamically adjust the host side sampling clock signals while referring a DAC side clock in a real sense, so even with asynchronous mode they are more or less affected by host side jitter. You can see the mode of your USB DAC by opening "/proc/asound/card1/stream0" on your phone while playing music. Please see a word in parentheses at "Endpoint:" lines; "SYNC", "ADAPTIVE" or "ASYNC" means that your DAC uses "synchronous", "adaptive" or "asynchronous" mode to communicate to your phone, respectively. Moreover, almost all audio peripherals, e.g., bluetooth earphones, internal DAC's, network audio devices have a PLL in themselves and are affected by host side jitter for the same reason.
* Tips 1: You can see the sample rate connecting to a USB DAC during music replaying by a command `cat /proc/asound/card1/pcm0p/sub0/hw_params` (for non- USB hardware offload drivers). You can also see mixer ("AudioFlinger") info by a command `dumpsys media.audio_flinger`. There are corresponding convenient scripts ("alsa-hw-params.sh" and "dumpsys-filtered.sh") and others in "extras" folder.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/alsa-hw-params.sh`
- outputs information of the ALSA audio driver for USB DAC's, 3.5mm Jack and internal speakers.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/dumpsys-filtered.sh [--all][--help]`
- outputs the active peripheral's information from `dumpsys media.audio_flinger`. With `--all` option, this script outputs all peripheral's information from the command.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/dumpsys-bluetooth-filtered.sh [--all][--help]`
- outputs the active bluetooth codec information from `dumpsys bluetooth_manager`. With `--all` option, this script outputs all bluetooth manager information from the command.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/change-bluetooth-hal.sh [--help][--status][aosp | legacy | offload | sysbta]"`
- changes the active bluetooth audio HAL to one you specify. With `--status` option, this script outputs currently enabled bluetooth audio HALs.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/getConfig.sh [--all][--help]`
- outputs brief information of the active audio policy configuration. With `--all` option, this script outputs all the information of the configuration.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/change-usb-period.sh [--status] [--reset][period_usec]`
- changes the USB audio data transfer period to a specified value in usec (default: 2250usec). With "--status" option, this script outputs the current period without changing the period. With "--reset" option, this script reverts the period to the original (5000usec). The best value is usuall around 2250 usec (or 3250 usec), but 20375 usec (or 2250 usec) for POCO F3 and 3875 usec for low performance old devices. Since the value directly affects the jitter of a PLL in a USB DAC, this script may improve the audio quality of the DAC frighteningly.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/change_resampling_quality.sh [--help] [--status] [--reset] [--bypass] [--cheat] [stop_band_dB [half_filter_length [cut_off_percent]]]`
- changes the resampling quality of the OS mixer (AudioFlinger). "--help" and "--status" options specify printing above usage and the status of AudioFlinger's resampling configuration without configuration changes, respectively. With "--reset" option, this script clears previous settings. "--bypass" option specifies to apply this configuration change except toward less than 48 kHz (excluding 48 kHz itself) frequencies. "--cheat" option specifies to switch the mode of third argument "cut_off_percent" (if specified) from "cut off" (i.e., at -3dB point, and also the middle point of a transition band) to "transition band width cheat" (i.e., the start point of a stop band). "stop_band_dB", "half_filter_length" and "cut off percent" specify a stop band attenuation in dB, the number of input data needed before the current point (optional) and a cut off (or a transition band width cheat) percent of the Nyquist frequency (optional), respectively. AOSP standard values are 90 dB and 32 (cut off: 100%), but this script's default values are 179 dB and 408 (cheat or stop band: 99%) as mastering quality values, i.e., no resampling distortion in a real sense (even though the 179dB targeted attenuation is not accomplished in the AOSP implementation).
- Note: the resampler of the Android OS mixer is a pure Kaiser windowed Sinc interpolator (a 16 bit integer polyphase FIR filter and a 32 bits one) that has 127 fixed phase sets of FIR coefficients generated from specified parameters and a variable phase set of FIR coeffcients linearly interpolated from other phase sets. So 2<sup>±n</sup> (phases) type up-sampling and down-sampling are very precise.
- Remark: the Android OS mixer recently changed its behavior so as to always bypass its resampling (or virtual analog low-pass filtering involved by sinc function interpolation) if the sampling frequency of its input is equal to that of its output.
- Appendix A. Examples of Re-sampling Parameters :
| Stop band attenuation (dB) | Half filter length | Cut-off (%) | Stop band (%) | Memo |
| ---: | ---: | ---: | ---: | ---- |
| AOSP parameters: | - | - | - | - |
| 90 | 32 | 100 | | Default Quality|
| 80 | 16 | 100 | | LOW Quality |
| 84 | 16 | 100 | | MED Quality |
| 98 | 32 | 100 | | HIGH Quality |
| Recommended parameters: | - | - | - | - |
| 159 | 480 | 92 | | Old devices of A11 and earlier |
| 165 | 360 | | 104 | Low performance devices of A12 and later |
| 179 | 408 | | 99 | General purpose on A12 and later |
| 194 | 520 | | 98 | Ultra Hi-Fi for very high performance devices |
| 194 | 520 | 83 ~ 86 | | For LDAC bluetooth earphones and DAC's under $30 both having large amp. non-linearity |
| 179 | 520 | 91 ~ 94 | | The same as above but for only 44.1 kHz & 16 bits and 44.1 kHz & 24 bits tracks |
| 194 | 520 | 42,43 | | The same as above but for only 96 kHz & 24 bits Hires. tracks |
| 194 | 520 | 100 | | Bit-perfect when 1:1 resampling (ideal low-pass filtering for 32 bits depth; obsoleted) |
| My mock equipment parameters: | - | - | - | - |
| 150 | 80 | | 109 | Mock DAC-A filter (Fast roll-off N-fold over-sampling) |
| 120 | 80 | 97 | | Mock DAC-B filter (Fast roll-off N-fold over-sampling) |
| 100 | 80 | | 104 | Mock DAC-C filter (Fast roll-off N-fold over-sampling) |
| 159 | 240 | | 99 | Mock Mastering tool filter |
| External examples: | - | - | - | - |
| 100 | 29 | (91) | 109 | AK4493 (Sharp roll-off N-fold over-sampling) |
| 150 | 42 | (91) | 109 | AK4191EQ (Sharp roll-off N-fold over-sampling) |
| 120 | 35 | (97) | 110 | ES9038PRO (Fast roll-off N-fold over-sampling) |
| vary 50 ~ 118 | 34 | 96 | (398) | ES9039PRO (Fast roll-off N-fold over-sampling) |
| 110 | 40 | (96) | 109 | CS43131 (Fast roll-off N-fold over-sampling) |
| 110 | 40 | (96) | 109 | CS43198 (Fast roll-off N-fold over-sampling) |
| 98 | 130 | 98.5 | | MacOS Leopard (guess) |
| 159 | 240 | | 99 | iZotope, No-Alias (guess) |
| 100 | 64 | | 99 | SoX HQ linear phase (guess) |
| 170 | 520 | | 99 | SoX VHQ linear phase (guess) |
* Since Youtube Music's Opus (format:774; 48 kHz & 16 bits output) tracks are ordinarily low-pass filtered with 20 kHz cut off, you probably don't need special re-sampling for cheapie devices except LDAC earphones and internal speakers having very large non-linear distortion.
- Appendix B. Characteristics of my mock DAC's :
| Name | Background opaqueness (aliasing noise) | Pre-echo and ringing | Mellowness (intermodulation) | Memo |
| ---: | ---: | ---: | ---: | ---- |
| DAC-A | light | heavy | heavy | imitating AK4491EQ Sharp roll-off |
| DAC-B | medium | medium | light | imitating ES9039PRO Fast roll-off |
| DAC-C | heavy | light | medium | SoX HQ quality (linear phase) + better |
| Mastering tool | slight | slight | light | imitating iZotope (no alias) |
| Recommended parameters | almost none | almost none | light | Ultra Hi-Fi |
| Recommended parameters | almost none | almost none | very slight | for LDAC bluetooth earphones and DAC's under $30 |
| Recommended parameters | very slight | very slight | medium | for low performance devices |
| Recommended parameters | slight | almost none | almost none | for old devices |
* Tips 2: "jitter-reducer.sh" in "extras" folder is an interactive tool derived from ["Hifi Maximizer"](https://github.com/yzyhk904/hifi-maximizer-mod) which could reduce jitter distortions in all digital audio outputs relating to SELinux mode, thermal controls, doze (battery saving while idling), CPU&GPU governors, logd servers (to interface to logcat or the like), camera server, I/O scheduling, virtual memory, wifi suspension, battery management and the audio effects framework (to interface to equalizers, virtualizers, visualizers, echo cancelers, automatic gain controls, etc.). In my opinion, jitter distortions reduction is the very key to ultimate hifi audio quality.
- Usage: `sh /sdcard/USB_SampleRate_Changer/extras/jitter-reducer.sh [--selinux|++selinux][--thermal|++thermal][--doze|++doze][---governor|++governor][--logd|++logd][--camera|++camera][--io [scheduler [light | m-light | medium | boost]] | ++io][--vm|++vm][--wifi|++wifi][--all|++all][--battery|++battery][--effect|++effect][--status][--help]`
- each "--" prefixed option except "--status" and "--help" options is an enabler for its corresponding jitter reducer, conversely each "++" prefixed option is a disabler for its corresponding jitter reducer. "--all" option is an alias of all "--" prefixed options except "--effect", "--battery", "--status" and "--help" option, and also "++all" option is an alias of all "++" prefixed options except "++effect" and "++battery" option.
- "scheduler" specifies an I/O scheduler for I/O block devices (typically "deadline", "cfq" or "noop", but you may specify "*" for automatic best selection) and has optional four modes "light" (for warmer tone), "m-light" (for slightly warmer tone), "medium" (default) and "boost" (for clearer tone).
- please remember that "--wifi" option is persistent even after reboot, but other options are not.
- and "--doze" option disables doze (light and deep) of your device at all and its battery charge remaining may fall rapidly while idling.
- For most "hifi" example, `sh /sdcard/USB_SampleRate_Changer/extras/jitter-reducer.sh --all --battery --effect --status` enables all jitter reducers including effects framework one and outputs the jitter related statuses. For Bluetooth earphones, you may need to add `--io "*" boost` or `--io "*" m-light` option. For DLNA transmitting, you may need to add `--io "*" boost` option. (If you use "AirMusic" to transmit audio data, I recommend setting around 4607 msec additional delay to reduce jitter distortion on the AirMusic panel to display target device(s). I think DLNA via"AirMusic" from usual streaming app is the best for audio quality among DLNA app's, google cast and various connect features).
* Tips 3: I recommend expert users to manually disable "Manage apps automatically" in "Battery manager" (or "Adaptive battery" of "Adaptive preferences") in the battery section (needless to say, don't enable battery savers, performance limiters and the like), turn off "Adaptive connectivity" in the Network & internet section (if exists), and change "Battery optimization" from "Optimize" to "Don't optimize" (or change "Battery usage" from "Optimized" to "Unrestricted") for following app's manually through the settings UI of Android OS (to lower less than 10Hz jitter making extremely short reverb or foggy sound like distortion) even though disabling the Android doze itself. music (streaming) player apps, their licensing apps (if exist), "AirMusic" (if exists), "AirMusic Recording Service" (system app; if exists), equalizer apps (if exist), "Bluetooth" (system app), "Bluetooth MIDI Service" (system app), "MTP Host" (system app), "NFC Service" (system app; if exists), "Magisk" (if exists), System WebView apps (system app), Browser apps, "PhhTrebleApp" (system app; if exists), "Android Services Library" (system app), "Android Shared Library" (system app), "Android System" (system app), "System UI" (system app), "Input Devices" (system app), {Gesture, 3 Button, 2 Button} Navigation Bar apps (which you are using only; system app), "crDroid System" (system app; if exists), "LineageOS System" (system app; if exists), launcher app, "Google Play Store" (system app), "Google Play services" (system app), "Styles & wallpaper" or the like (system app), {Lineage, crDroid, Arrow, etc.} themes app (system app; if exists), "AOSP panel" (system app; if exists), "OmniJaws" (system app; if exists), "OmniStyle" (system app; if exists), "Active Edge Service" (system app; if exists), "Android Device Security Module" (system app; if exists), "Call Management" (system app; if exists), "Phone" (system app; if exists), "Phone Calls" (system app; if exists), "Phone Services" (system app; if exists), "Phone and Messaging Storage" (system app; if exists), "Storage Manager" (system app), "Default" (system app; if exists), "Default StatusBar" (system app; if exists), "Wfd Service" (system app; if exists), "Wallpaper" or the like (system app), "Adreno Graphics Drivers" (system app; if exists), "com.android.providers.media" (system app), "Files by Google" (system app; if exists), "Google Play Services for AR" (system app; if exists), "Google Services Framework" (system app), "Waterfall cutout" (system app), "Punch Hole cutout" (system app), "Network Manager" (system app), "Companion Device Manager" (system app), "Intent Filter Verification Service" (system app), "Calendar", camera apps, keyboard app, kernel adiutors (if exist), etc. And uninstall "Digital Wellbeing" (system app; if it exists) itself or change "Battery usage" from "Optimized" to "Restricted" (this is very harmful for audio like camera servers). Because ["Audio jitter silencer"](https://github.com/Magisk-Modules-Alt-Repo/audio-jitter-silencer) works automatically as above (but not completely), and needs some maintence after its installation.
* Tips 4: See also my magisk module ["audio-misc-settings"](https://github.com/Magisk-Modules-Alt-Repo/audio-misc-settings). This can increase the number of media volume steps to 100 steps and so on.
<br/>
## DISCLAIMER
* I am not responsible for any damage that may occur to your device, so it is your own choice whether to attempt this script or not.
##
================================================
FILE: USB_SampleRate_Changer.sh
================================================
#!/system/bin/sh
#
# Version: 3.0.10
# by zyhk
MYDIR="${0%/*}"
# Check whether this script has been marked "disable", or not
if [ ! -d "$MYDIR" ]; then
echo "cannot get the current directory!" 1>&2 ;
exit 1
elif [ -e "$MYDIR/disable" ] ; then
echo "this script is now disabled!" 1>&2 ;
exit 0
fi
# End
# Default values
policyMode="auto"
resetMode="false"
testMode="false"
testTemplate="$MYDIR/templates/test_template.xml"
amzmMode="false"
amzmTemplate="$MYDIR/templates/bypass_offload_safer_amzm_template.xml"
DRC_enabled="false"
USB_module="usb"
BT_module="bluetooth"
forceBluetoothQti="false"
# Help message
while [ $# -gt 0 ]; do
case "$1" in
"-o" | "--offload" )
policyMode="offload"
shift
;;
"-oh" | "--offload-hifi-playback" )
policyMode="offload-hifi-playback"
shift
;;
"-od" | "--offload-direct" )
policyMode="offload-direct"
shift
;;
"-os" | "--offload-safer" )
policyMode="offload-safer"
shift
;;
"-b" | "--bypass-offload" )
policyMode="bypass"
shift
;;
"-bs" | "--bypass-offload-safer" )
policyMode="bypass-safer"
shift
;;
"-l" | "--legacy" )
policyMode="legacy"
shift
;;
"-s" | "--safe" )
policyMode="safe"
shift
;;
"-ss" | "--safest" )
policyMode="safest"
shift
;;
"-ssa" | "--safest-auto" )
policyMode="safest-auto"
shift
;;
"-u" | "--usb-only" )
policyMode="usb"
shift
;;
"-fu" | "--force-usbv2" )
USB_module="usbv2"
shift
;;
"-fq" | "--force-bluetooth-qti" )
forceBluetoothQti="true"
shift
;;
"-a" | "--auto" )
policyMode="auto"
shift
;;
"-d" | "--drc" )
DRC_enabled="true"
shift
;;
"-r" | "--reset" )
resetMode="true"
shift
;;
"--amzm" )
amzmMode="true"
shift
;;
"--test" )
testMode="true"
shift
;;
"--test-template" )
# This option takes one argument specifying a template file path whether it is absolute or relative to the template folder
shift
if [ $# -gt 0 ]; then
case "$1" in
/* )
testTemplate="$1"
;;
* )
testTemplate="$MYDIR/templates/$1"
;;
esac
shift
fi
;;
"-h" | "--help" | -* )
echo -n "Usage: ${0##*/} [--reset] [--drc] [--bypass-offload][--bypass-offload-safer][--offload][--offload-hifi-playback][--offload-direct][--offload-safer]" 1>&2
echo "[--legacy][--safe][--safest][--safest-auto][--usb-only] [[44k|48k|88k|96k|176k|192k|353k|384k|706k|768k] [[16|24|32|float]]]" 1>&2
echo -n "\nNote: ${0##*/} requires to unlock the USB audio class driver's limitation (upto 96kHz lock or 384kHz Qcomm offload lock)" 1>&2
echo " if you specify greater than 96kHz or 384kHz (in case of Qcomm offload)." 1>&2
exit 0
;;
* )
break
;;
esac
done
# End of help message
. "$MYDIR/functions3.shlib"
genfile="/data/local/tmp/audio_conf_generated.xml"
# Reset
if "$resetMode"; then
if [ -e "$MYDIR/.config" ]; then
rm -f "$MYDIR/.config"
fi
removeGenFile "$genfile"
reloadAudioServers "all"
exit 0
fi
# Reset End
# Set parameters
sRate="44100"
bDepth="32"
case $# in
0 ) ;;
1 ) sRate="$1";;
2 ) sRate="$1"; bDepth="$2";;
* ) echo "too many arguments (n=$#)!" 1>&2 ; exit 1;;
esac
# End of setting parameters
# Normalize arguments
case "$sRate" in
"44k" | "44.1k" )
sRate="44100"
;;
"48k" )
sRate="48000"
;;
"88k" | "88.2k" )
sRate="88200"
;;
"96k" )
sRate="96000"
;;
"176k" | "176.4k" )
sRate="176400"
;;
"192k" )
sRate="192000"
;;
"352k" | "353k" | "352.8k" )
sRate="352800"
;;
"384k" )
sRate="384000"
;;
"705k" | "706k" | "705.6k" )
sRate="705600"
;;
"768k" )
sRate="768000"
;;
* )
if expr "$sRate" : "[1-9][0-9]*$" 1>"/dev/null" 2>&1; then
if [ $sRate -lt 44100 -o $sRate -gt 768000 ]; then
echo "unsupported sample rate (rate=$sRate)!" 1>&2
exit 1
fi
else
echo "unsupported sample rate (rate=$sRate)!" 1>&2
exit 1
fi
;;
esac
aFormat="AUDIO_FORMAT_PCM_32_BIT"
case "$bDepth" in
16 )
aFormat="AUDIO_FORMAT_PCM_16_BIT"
;;
24 )
aFormat="AUDIO_FORMAT_PCM_24_BIT_PACKED"
;;
32 )
aFormat="AUDIO_FORMAT_PCM_32_BIT"
;;
"float" )
aFormat="AUDIO_FORMAT_PCM_FLOAT"
;;
* )
echo "unknow bit depth specified (depth=$bDepth)!" 1>&2
exit 1
;;
esac
# End of argument normalization
# Overlay a generated audio policy configuration file on "/vendor/etc/audio_policy_configuration.xml" (e.g. typical)
if [ ! -r "$MYDIR/.config" ]; then
makeConfigFile "$MYDIR/.config"
fi
if [ -r "$MYDIR/.config" ]; then
. "$MYDIR/.config"
fi
if [ -z "$PolicyFile" -o "$PolicyFile" = "N/A" ]; then
# Very recent devices, e.g., Pixel 9 series
echo "Recent AIDL only devices are not supported!" 1>&2
exit 1
else
overlayTarget="$PolicyFile"
fi
if [ "$policyMode" = "auto" -a -n "$BluetoothHal" ];then
policyMode="$BluetoothHal"
fi
case "$policyMode" in
"legacy" | "safe" | "safest" | "safest-auto" )
BT_module="a2dp"
;;
* )
if [ "`getprop ro.board.platform`" = "pineapple" -a -r "/vendor/lib64/hw/audio.bluetooth_qti.default.so" ]; then
# A workaround for Pineapple devices for no using the AOSP bluetooth module temporary
BT_module="bluetooth_qti"
elif [ "`getprop ro.product.board`" = "taro" -a -r "/vendor/lib64/hw/audio.bluetooth_qti.default.so" ]; then
# An exception for Asus Zenfone 9
BT_module="bluetooth_qti"
else
BT_module="bluetooth"
fi
;;
esac
# Force the bluetooth HAL to be "bluetooth_qti"
if "$forceBluetoothQti"; then
BT_module="bluetooth_qti"
if [ ! -r "/vendor/lib64/hw/audio.bluetooth_qti.default.so" -a ! -r "/vendor/lib/hw/audio.bluetooth_qti.default.so" ]; then
echo " Warning: ${0##*/} detected no \"bluetooth_qti\" audio HAL module on this device" 1>&2
fi
fi
SysbtaCapable="`getprop persist.bluetooth.system_audio_hal.enabled`"
if [ "$SysbtaCapable" = "1" ]; then
BT_module="sysbta"
fi
if [ -n "$SysbtaCapable" -a "`getprop init.svc.system.bt-audio-hal`" != "stopped" ]; then
if [ "$policyMode" = "offload" -o "$policyMode" = "offload-direct" ]; then
echo " Warning: ${0##*/} detected that \"sysbta\" (System Wide Bluetooth HAL) service was running" 1>&2
if [ "$SysbtaCapable" = "1" ]; then
echo " Info: \"sysbta\" rewrites bluetooth audio parts from \"$policyMode\" to its own forcibly on the fly! \
If you like \"$policyMode\" to be unmodified anyway, please use \"extras/change-bluetooth-hal.sh\" \
to change the active bluetooth audio HAL to \"offload\"" 1>&2
else
echo " Info: Please use \"extras/change-bluetooth-hal.sh\" to change the active bluetooth audio HAL to \"offload\", \
or your bluetooth device cannot output sound!" 1>&2
fi
fi
fi
if [ ! \( "$policyMode" = "offload" -o "$policyMode" = "offload-hifi-playback" -o "$policyMode" = "offload-direct" \
-o "$policyMode" = "offload-safer" -o "$policyMode" = "bypass-offload" \) -a $sRate -gt 96000 ]; then
if [ ! -e "/data/adb/modules/usb-samplerate-unlocker" -a ! -e "/data/adb/modules/audio-samplerate-changer" \
-a ! -e "/data/adb/modules/hifi-maximizer-mod" ]; then
echo " Warning: ${0##*/} requires to unlock the USB HAL driver's limitation (upto 96kHz lock) by \"usb-samplerate-unlocker\" or \"audio-samplerate-changer\"" 1>&2
fi
elif [ "$policyMode" = "offload" -o "$policyMode" = "offload-direct" -o "$policyMode" = "offload-safer" ]; then
case "`getprop ro.board.platform`" in
mt* | exynos* )
if [ $sRate -gt 96000 ]; then
echo -n " Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation" 1>&2
echo " (upto 96kHz lock)" 1>&2
fi
;;
gs10? )
if [ ! -e "/data/adb/modules/usb-samplerate-unlocker" -a ! -e "/data/adb/modules/audio-samplerate-changer" \
-a ! -e "/data/adb/modules/hifi-maximizer-mod" ]; then
if [ $sRate -gt 96000 ]; then
echo -n " Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation" 1>&2
echo " (upto 96kHz lock)" 1>&2
fi
elif [ $sRate -gt 192000 ]; then
echo -n " Warning: ${0##*/} canot change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation" 1>&2
echo " (upto 192kHz lock)" 1>&2
fi
;;
gs* | zuma* )
if [ $sRate -gt 192000 ]; then
echo -n " Warning: ${0##*/} canot change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation" 1>&2
echo " (upto 192kHz lock)" 1>&2
fi
;;
* )
if [ $sRate -gt 384000 ]; then
echo -n " Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation" 1>&2
echo " (upto 384kHz lock)" 1>&2
fi
;;
esac
fi
if IsSeventhAudio; then
case "$policyMode" in
"offload" )
template="$MYDIR/templates/offload_template.xml"
;;
"offload-hifi-playback" )
template="$MYDIR/templates/offload_hifi_playback_template.xml"
;;
"offload-direct" )
template="$MYDIR/templates/offload_direct_template.xml"
;;
"offload-safer" )
case "`getprop ro.board.platform`" in
gs* | zuma* )
USB_module="usbv2"
esac
template="$MYDIR/templates/offload_safer_template.xml"
;;
"bypass" )
template="$MYDIR/templates/bypass_offload_template.xml"
;;
"bypass-safer" )
case "`getprop ro.board.platform`" in
gs* | zuma* )
USB_module="usbv2"
#template="$MYDIR/templates/offload_safer_template.xml"
template="$MYDIR/templates/bypass_offload_safer_template.xml"
;;
* )
template="$MYDIR/templates/bypass_offload_safer_template.xml"
;;
esac
;;
"legacy" )
template="$MYDIR/templates/Old/legacy_template.xml"
;;
"safe" )
template="$MYDIR/templates/bypass_offload_safer_template.xml"
;;
"safest-auto" )
template="$MYDIR/templates/bypass_offload_template.xml"
sRate="48000"
aFormat="AUDIO_FORMAT_PCM_16_BIT"
;;
"usb" )
template="$MYDIR/templates/Old/usb_only_template.xml"
if [ -r "/vendor/etc/usb_audio_policy_configuration.xml" ]; then
overlayTarget="/vendor/etc/usb_audio_policy_configuration.xml"
elif [ -r "/vendor/etc/usbv2_audio_policy_configuration.xml" -a -r "/vendor/lib64/hw/audio.usbv2.default.so" ]; then
overlayTarget="/vendor/etc/usbv2_audio_policy_configuration.xml"
USB_module="usbv2"
else
echo "target USB configuration file (\"/vendor/etc/usb_audio_policy_configuration.xml\") not found!" 1>&2
exit 1
fi
;;
"safest" | * )
template="$MYDIR/templates/Old/safest_template.xml"
;;
esac
else
case "$policyMode" in
"offload" )
template="$MYDIR/templates/Old/offload_template.xml"
;;
"offload-hifi-playback" )
case "`getprop ro.board.platform`" in
mt* )
echo " Warning: ${0##*/} changed to \"--bypass-offload-safer\" mode because of the hardware offloading driver's restrictions" 1>&2
template="$MYDIR/templates/Old/bypass_offload_safer_mtk_template.xml"
;;
* )
template="$MYDIR/templates/Old/offload_hifi_playback_template.xml"
;;
esac
;;
"offload-direct" )
template="$MYDIR/templates/Old/offload_direct_template.xml"
;;
"bypass" )
template="$MYDIR/templates/Old/bypass_offload_template.xml"
;;
"bypass-safer" )
case "`getprop ro.board.platform`" in
mt* )
template="$MYDIR/templates/Old/bypass_offload_safer_mtk_template.xml"
;;
* )
template="$MYDIR/templates/Old/bypass_offload_safer_template.xml"
;;
esac
;;
"legacy" )
template="$MYDIR/templates/Old/legacy_template.xml"
;;
"usb" )
template="$MYDIR/templates/Old/usb_only_template.xml"
if [ -r "/vendor/etc/usb_audio_policy_configuration.xml" ]; then
overlayTarget="/vendor/etc/usb_audio_policy_configuration.xml"
elif [ -r "/vendor/etc/usbv2_audio_policy_configuration.xml" -a -r "/vendor/lib64/hw/audio.usbv2.default.so" ]; then
overlayTarget="/vendor/etc/usbv2_audio_policy_configuration.xml"
USB_module="usbv2"
else
echo "target USB configuration file (\"/vendor/etc/usb_audio_policy_configuration.xml\") not found!" 1>&2
exit 1
fi
;;
"safe" )
template="$MYDIR/templates/Old/safe_template.xml"
;;
"safest" )
template="$MYDIR/templates/Old/safest_template.xml"
;;
"safest-auto" )
template="$MYDIR/templates/Old/safest_auto_template.xml"
;;
* )
template="$MYDIR/templates/Old/safe_template.xml"
;;
esac
fi
# Am@zon Music template mode
if "$amzmMode"; then
template="$amzmTemplate"
fi
# Am@zon Music template mode End
# Test template mode
if "$testMode"; then
template="$testTemplate"
fi
# Test template mode End
if [ -r "$template" ]; then
removeGenFile "$genfile"
if [ "$USB_module" = "usb" -a ! -r "/vendor/lib64/hw/audio.usb.default.so" -a -r "/vendor/lib64/hw/audio.usbv2.default.so" ]; then
USB_module="usbv2"
fi
sed -e "s|%DRC_ENABLED%|$DRC_enabled|" -e "s|%USB_MODULE%|$USB_module|" -e "s|%BT_MODULE%|$BT_module|" \
-e "s|%SAMPLING_RATE%|$sRate|" -e "s|%AUDIO_FORMAT%|$aFormat|" \
-e "s|%VOLUME_FILE%|$VolumeFile|" -e "s|%DEFAULT_VOLUME_FILE%|$DefaultVolumeFile|" "$template" >"$genfile"
if [ $? -eq 0 ]; then
chmod 644 "$genfile"
chcon u:object_r:vendor_configs_file:s0 "$genfile"
targetDir=${overlayTarget%/*}
if [ -r "$overlayTarget" -o "${targetDir##*_}" = "qssi" ]; then
# "${targetDir##*_}" = "qssi" is for some OnePlus ROM's (probably a bug?)
isMounted "/proc/self/mountinfo" "$overlayTarget" "ExcludeMagisk" "NoShowKey"
if [ $? -eq 0 ]; then
umount "$overlayTarget" 1>"/dev/null" 2>&1
fi
mount -o bind "$genfile" "$overlayTarget"
if [ $? -gt 0 ]; then
echo "failed to overlay a generated audio policy configuration XML file!" 1>&2
exit 1
fi
else
echo "overlaying target (\"$overlayTarget\") doesn't exist!" 1>&2
exit 1
fi
else
echo "audio policy XML file genaration failed!" 1>&2
exit 1
fi
else
echo "an audio configuration template file (\"$template\") not found!" 1>&2
exit 1
fi
# End of overlay system files
# Reload audio policy configuration files.
reloadAudioServers
# End of reload
================================================
FILE: Usage_Samples/Bluetooth/change-bluetooth-hal_Status.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh --status"
================================================
FILE: Usage_Samples/Bluetooth/change-bluetooth-hal_aosp.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh aosp"
================================================
FILE: Usage_Samples/Bluetooth/change-bluetooth-hal_legacy.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh legacy"
================================================
FILE: Usage_Samples/Bluetooth/change-bluetooth-hal_offload.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh offload"
================================================
FILE: Usage_Samples/Bluetooth/change-bluetooth-hal_sysbta.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh sysbta"
================================================
FILE: Usage_Samples/Dump/alsa-hw-params_all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh --all"
================================================
FILE: Usage_Samples/Dump/alsa-hw-params_none.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh"
================================================
FILE: Usage_Samples/Dump/dumpsys-bluetooth-filtered_all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh --all"
================================================
FILE: Usage_Samples/Dump/dumpsys-bluetooth-filtered_none.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh"
================================================
FILE: Usage_Samples/Dump/dumpsys-filtered_all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh --all"
================================================
FILE: Usage_Samples/Dump/dumpsys-filtered_none.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh"
================================================
FILE: Usage_Samples/Dump/getConfig_all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/getConfig.sh --all"
================================================
FILE: Usage_Samples/Dump/getConfig_none.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/getConfig.sh"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++battery.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++battery --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++camera.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++camera --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++effect.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++effect --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++io.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++io --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_++wifi.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++wifi --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--all.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--battery.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --battery --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--boost-max.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --io '*' boost --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--camera.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --camera --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--effect.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --effect --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--io-boost.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --io '*' boost --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--most.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --wifi --logd --vm --camera --io '*' boost --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_--wifi.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --wifi --status"
================================================
FILE: Usage_Samples/Jitter/jitter-reducer_Status.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --status"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_159dB_480_92.sh
================================================
#!/system/bin/sh
#
# General purpos re-sampling filter at a very mastering quality (for old devices)
#
# Characteristics: slight in background aliasing noise, almost none in pre-echo and ringing, and almost none in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 159dB_480_92 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 159 480 92"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_165dB_360_104.sh
================================================
#!/system/bin/sh
#
# General purpos re-sampling filter at a mastering quality (for low performance devices)
#
# Characteristics: very slight in background aliasing noise, very slight in pre-echo and ringing, and medium in intermodulation
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 165 360 104"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_179dB_408_99.sh
================================================
#!/system/bin/sh
#
# General purpos re-sampling filter at a very mastering quality (for devices except low performance ones)
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and light in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 179 408 99"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_194dB_520_100.sh
================================================
#!/system/bin/sh
#
# The ideal re-sampling (bit-perfect) only when 1:1 ratio frequency re-sampling and 32 bit depth
#
# Characteristics (except 1:1 re-sampling) : almost none in background aliasing noise, light in pre-echo and ringing, and light in intermodulation
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 100"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_Reset.sh
================================================
#!/system/bin/sh
#
# Reset and revert to the original system configuration for audio re-sampling
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --reset"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_Status.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --status"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality__Ultra-HiFi.sh
================================================
#!/system/bin/sh
#
# Ultra Hi-Fi mastering quality re-sampling filter (for very high performance devices)
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and light in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and this ultra-hifi after setting from 48kHz to 768kHz (16x) or 384kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 194 520 98"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz.sh
================================================
#!/system/bin/sh
#
# For LDAC earphones and DAC's under $30 having large non-linear distortion
#
# If you feel your LDAC earphones or "cheapie" DAC wouldn't become to sound good at all,
# try replacing "92" (below) with "91", "93" or "94" for appropriately cutting off ultrasonic noise causing intermodulation.
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation
#
# Try to use this for investigating differences of 179dB_408_99 and "cheapies_44kHz" after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 92"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz_cheapest.sh
================================================
#!/system/bin/sh
#
# For LDAC earphones and DAC's under $30 having large non-linear distortion
#
# If you feel your LDAC earphones or "cheapie" DAC wouldn't become to sound good at all,
# try replacing "92" (below) with "91", "93" or "94" for appropriately cutting off ultrasonic noise causing intermodulation.
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation
#
# Try to use this for investigating differences of 179dB_408_99 and "cheapies_44kHz_cheapest" after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 91"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz-cheapest.sh
================================================
#!/system/bin/sh
#
# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 16 and 24 bits tracks (possibly 44.1 kHz ones)
#
# If you feel your LDAC earphones or internal speakers wouldn't become to sound good at all,
# try replacing "83" (below) with "84", "85" or "86" for appropriately cutting off ultrasonic noise causing intermodulation.
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation
#
# Try to use this for investigating differences of 179dB_408_99 and "cheapies_48kHz-cheapest" after setting from 48kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 83"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz.sh
================================================
#!/system/bin/sh
#
# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 16 and 24 bits tracks (possibly 44.1 kHz ones)
#
# If you feel your LDAC earphones or internal speakers wouldn't become to sound good at all,
# try replacing "84" (below) with "83", "85" or "86" for appropriately cutting off ultrasonic noise causing intermodulation.
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation
#
# Try to use this for investigating differences of 179dB_408_99 and "cheapies_48kHz" after setting from 48kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 84"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_cheapies_96kHz.sh
================================================
#!/system/bin/sh
#
# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 96 kHz & 24 bits Hires. tracks
#
# If you feel your LDAC earphones or "cheapie" DAC wouldn't become to sound good at all,
# try replacing "42" (below) with "43" for appropriately cutting off ultrasonic noise causing intermodulation.
#
# Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation
#
# Try to use this for investigating differences of 179dB_408_99 and "cheapies_96kHz" after setting from 96kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass-hires 194 520 42"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_mock-DAC-A.sh
================================================
#!/system/bin/sh
#
# My mock AK4191EQ-ish in-DAC N-fold Over-sampling filer (sharp roll-off type) when larger than or equal to 48kHz frequency up-sampling
#
# Characteristics: light in background aliasing noise, heavy in pre-echo and ringing, and heavy in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 150 80 109"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_mock-DAC-B.sh
================================================
#!/system/bin/sh
#
# My mock ES9039PRO-ish in-DAC N-fold Over-sampling filer (fast roll-off type)
#
# Characteristics: medium in background aliasing noise, medium in pre-echo and ringing, and light in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 120 80 97"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_mock-DAC-C.sh
================================================
#!/system/bin/sh
#
# My mock cheap in-DAC N-fold Over-sampling filer (fast roll-off type) of which quality level is set to be a bit better than that of SoX HQ linear phase
# when larger than or equal to 48kHz frequency up-sampling
#
# Characteristics: heavy in background aliasing noise, light in pre-echo and ringing, and medium in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 100 80 104"
================================================
FILE: Usage_Samples/Resampling/change-resampling-quality_mock-Mastering.sh
================================================
#!/system/bin/sh
#
# My mock iZotope-ish mastering tool filer (no alias type)
#
# Characteristics: light in background aliasing noise, slight in pre-echo and ringing, and light in intermodulation
#
# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling
#
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 159 240 99"
================================================
FILE: Usage_Samples/USB/USB_44k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 44k 32"
================================================
FILE: Usage_Samples/USB/USB_48k_16.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 16"
================================================
FILE: Usage_Samples/USB/USB_48k_24.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 24"
================================================
FILE: Usage_Samples/USB/USB_48k_24_offload-direct.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 48k 24"
================================================
FILE: Usage_Samples/USB/USB_48k_24_offload-direct_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-direct 48k 24"
================================================
FILE: Usage_Samples/USB/USB_48k_24_offload-hifi-playback.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-hifi-playback 48k 24"
================================================
FILE: Usage_Samples/USB/USB_48k_24_offload-hifi-playback_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-hifi-playback 48k 24"
================================================
FILE: Usage_Samples/USB/USB_48k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 32"
================================================
FILE: Usage_Samples/USB/USB_48k_32_bypass-offload.sh
================================================
#!/system/bin/sh
# Internal speakers: 48kHz & 32bit; USB HAL & Bluetooth HAL: automatically detecting the best samplerate and audio format
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --bypass-offload 48k 32"
================================================
FILE: Usage_Samples/USB/USB_48k_32_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 48k 32"
================================================
FILE: Usage_Samples/USB/USB_48k_32_offload-hifi-playback.sh
================================================
#!/system/bin/sh
# Internal speakers: 48kHz & 32bit; offload USB driver & Bluetooth HAL: automatically detecting the best samplerate and audio format
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-hifi-playback 48k 32"
================================================
FILE: Usage_Samples/USB/USB_88k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 88k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_24.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 24"
================================================
FILE: Usage_Samples/USB/USB_96k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_bluetooth-qti.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --force-bluetooth-qti 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_legacy.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --legacy 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_offload-direct.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_offload-direct_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-direct 96k 32"
================================================
FILE: Usage_Samples/USB/USB_96k_32_offload-safer.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 96k 32"
================================================
FILE: Usage_Samples/USB/USB__176k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 176k 32"
================================================
FILE: Usage_Samples/USB/USB__192k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 192k 32"
================================================
FILE: Usage_Samples/USB/USB__192k_32_offload-safer.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 192k 32"
================================================
FILE: Usage_Samples/USB/USB__353k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 353k 32"
================================================
FILE: Usage_Samples/USB/USB__353k_32_offload-direct.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 353k 32"
================================================
FILE: Usage_Samples/USB/USB__384k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 384k 32"
================================================
FILE: Usage_Samples/USB/USB__384k_32_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 384k 32"
================================================
FILE: Usage_Samples/USB/USB__384k_32_offload-direct.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 384k 32"
================================================
FILE: Usage_Samples/USB/USB__384k_32_offload-safer.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 384k 32"
================================================
FILE: Usage_Samples/USB/USB__706k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 706k 32"
================================================
FILE: Usage_Samples/USB/USB__768k_32.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 768k 32"
================================================
FILE: Usage_Samples/USB/USB__768k_32_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 768k 32"
================================================
FILE: Usage_Samples/USB/USB__Reset.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --reset"
================================================
FILE: Usage_Samples/USB/USB__auto_max.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
case "`getprop ro.board.platform`" in
gs* | zuma* )
# for Tensor devices (Internal speaker: 48kHz 32bit; offload USB driver: automatic max. detection (<=192kHz) for even non-HiRes. tracks)
# because they wouldn't run the USB HAL driver
Args="--offload-hifi-playback 48k 32"
;;
* )
if [ ! -e "/vendor/lib64/hw/audio.bluetooth.default.so" ]; then
# for old devices (under Android 10; various configurations)
Args="--safest-auto"
elif [ "`getprop persist.bluetooth.bluetooth_audio_hal.disabled`" = "true" ]; then
# for legacy configuration devices (using "a2dp" legacy Bluetooth module)
Args="--safest-auto"
elif [ "`getprop ro.hardware.lights`" = "qcom" -o "`getprop ro.hardware`" = "qcom" ]; then
# for Qcom devices (Internal speaker: 384kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)
Args="--bypass-offload 384k 32"
else
# for MTK and other devices (Internal speaker: 48kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)
Args="--bypass-offload 48k 32"
fi
;;
esac
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh $Args"
================================================
FILE: Usage_Samples/USB/USB__auto_max_drc.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
case "`getprop ro.board.platform`" in
gs* | zuma* )
# for Tensor devices (Internal speaker: 48kHz 32bit; offload USB driver: automatic max. detection (<=192kHz) for even non-HiRes. tracks)
# because they wouldn't run the USB HAL driver
Args="--offload-hifi-playback 48k 32"
;;
* )
if [ ! -e "/vendor/lib64/hw/audio.bluetooth.default.so" ]; then
# for old devices (under Android 10; various configurations)
Args="--safest-auto"
elif [ "`getprop persist.bluetooth.bluetooth_audio_hal.disabled`" = "true" ]; then
# for legacy configuration devices (using "a2dp" legacy Bluetooth module)
Args="--safest-auto"
elif [ "`getprop ro.hardware.lights`" = "qcom" -o "`getprop ro.hardware`" = "qcom" ]; then
# for Qcom devices (Internal speaker: 384kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)
Args="--bypass-offload 384k 32"
else
# for MTK and other devices (Internal speaker: 48kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)
Args="--bypass-offload 48k 32"
fi
;;
esac
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc $Args"
================================================
FILE: Usage_Samples/USB/USB__test_template.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su --mount-master -c "/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --test 48k 32"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_2000.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2000"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_20375.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 20375"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_2250.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2250"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_2500.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2500"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_2750.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2750"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_4000.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 4000"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_Reset.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --reset"
================================================
FILE: Usage_Samples/USB Period/change-usb-period_Status.sh
================================================
#!/system/bin/sh
MODDIR=${0%/*/*/*}
su -c "/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --status"
================================================
FILE: changelog.md
================================================
## Change logs
# v3.0.10
* Added "--offload-safer" mode (primary sample rate is fixed at 48 kHz & 32bit, but USB one varies by specified values)
* Tuned I/O scheduling parameters for POCO F6, POCO F3, Motorola G54's and Pixel 6's
# v3.0.9
* Changed the bypass-offload-safer mode template for Tensor devices. Maybe a bug fixed sp that "usbv2" USB HAL driver can work now
* Tuned I/O scheduling parameters for Tensor devices to optimize for "usbv2" HAL driver
* Fixed a bug warning necessity to unlock USB sample rates even when Hifi maximizer was installed
#v3.0.8
* Tuned I/O scheduling parameters for MTK Dimensity
# v3.07
* Adjusted for dumpsys audioFlinger on A16 Pixles
* Tuned I/O scheduling parameters for POCO F6
* Stop AOCXD daemon on Tensor devices
# v3.0.6
* Tuned I/O scheduler tunables for Snapdragon, Dimensity and Tensor devices to reduce jitter
* Added additional usage samples
# v3.0.5
* Tuned for POCO F3 and other "kona" board devices by adjusteding their core control parameters
* Fixed disabling thermal core control for phones with big:1, mid:4 and little:3 CPU cores, e.g., POCO F6
* Improved and fixed GPU boosting for recent Qcomm and Mtk SoC's
# v3.0.4
* Fixed Wired Headset Mic to be enabled
* Tuned for POCO F6 (optimized for the ISIS kernel)
* Tuned for POCO F6 (optimized for the stock kernel, but not for the ISIS kernel)
* Fixed for InfiR kernel about VM tunables
# v3.0.3
* Added a script which enables "DRC" with max samplerate detection
# v3.0.2
* Added an exception for Asus Zenfone 9 to change its Bluetooth HAL form "bluetooth" to "bluetooth_qti"
* Added a cheapies-48kHz-cheapest resampler
# v3.0.1
* Added "--safest-auto" mode for automatic max. USB samplerate detection for old devices
* Fixed to adjust volume curve table links in an audio policy configuration template dynamically for avoiding miss-linking
# v3.0.0
* Added 7.0 audio policy configuration supports
* Added automatic max. sample rate detection (for USB devices) supports
# v2.8.7
* Added a workaround for Pineapple devices for no using the AOSP bluetooth module temporary
* Added a support for Tensor G4 (zuma pro)
* Tuned I/O scheduler tunables especially for "resampling-for-cheapies"
# v2.8.6
* Changed the default Bluetooth sample rate of "safer" templates from 44.1 kHz to 48 kHz for Am@zon music SD (Opus 48 kHz & 192 kbps vbr stereo) tracks
* Adjusted jitter optimizations and others for YTM's format change from AAC (141; 44.1 kHz & 256 kbps cbr stereo) to Opus (774; 48 kHz & 256 kbps vbr stereo)
# v2.8.5
* Changed dirty_ratio and dirty_background_ration to be 100 to reduce jitter
* Changed adjustSoC_mq for A14 and later clover not to round I/O parameters
* Adjusted cfq I/O parameters for SDM69x devices
* Added a new resampler script specially tuned for LDAC BT and DAC's under $30 devices both having large non-linear amp. distortion in "Usage Samples/Resampling"
# v2.8.4
* Changed read ahead buffer sizes from 16960 kB to 17000 kB to reduce I/O jitter
* Adjusted NrRequests of I/O scheduling
* Adjusted "extras/jitter-reducer.sh" for Galaxy S4 (A12)
* Added mock equipment filters (in-DAC over-sampling filters and a mastering tool resampler) in "Usage Samples/Resampling"
# v2.8.3
* Fixed io-scheduler reverting (++io option) for Galaxy S4 (A12)
* Fixed thermal-jitter-reducer in "extras/jitter-reducer.sh" (killing vendor.thermal-engine)
* Fixed Pixel7's default USB sample rate limiter (96kHz -> 192kHz) for adapting to a recent change
* Added a workaround for recent Pixel Firmwares (not to reboot when superuser resetprop'ing over props modified through system.prop of a magisk module)
* Reorganized "Usage Samples"
# v2.8.2
* Fixed for Pixel 8's
* Fixed Usage samples for executing on KernelSU ("exec su" to "su" for correct expansion of shell variables)
# v2.8.1
* Tuned "extras/jitter-reducer.sh" for reducing I/O scheduling jitter on Tensor devices
* Fixed a bug for "--force-bluetooth-qti" option
* Tuned "extras/jitter-reducer.sh" for reducing CFQ I/O scheduling jitter on Qcomm devices
# v2.8.0
* Tuned "extras/jitter-reducer.sh" for reducing I/O scheduling jitter on most devices
* Added "Usage_Samples" to easily execute every script with its typical parameters on file explorers with some sh script execution capability like "mixplorer"
# v2.7.3
* Fixed "extras/jitter-reducer.sh" to change "performance" governor of GPU without fail
* Tuned "extras/jitter-reducer.sh" for reducing I/O scheduling jitter on Tensor devices
# v2.7.2
* Tuned "extras/jitter-reducer.sh" for reducing I/O scheduling jitter, especially for Tensor devices
* Fixed a bug for Magisk 26.x
# v2.7.1
* Optimized "extras/jitter-reducer.sh" for reducing I/O scheduling jitter
* "extras/jitter-reducer.sh" now confirms and sets the cpu scaling max freq to its available max (sometimes the scaling max freq has been lowered before by a controller on some devices)
* Removed "raw" mixers from template files
* Fixed and adjusted "extras/jitter-reducer.sh" for Tensor devices (e.g., GPU max freq and the mq-deadline scheduler)
* Added supports to Tensor devices; Tensor specific --offload-hifi-playback mode (USB 96kHz or 192kHz fixed for non- hires. music while 48kHz did on stock ROMs) and --bypass-offload-safer mode (only 44kHz, 48kHz, 96kHz and 192kHz are available by using Tensor device's offload driver)
* Note: Audio outputs of stock Tensor devices work by 48kHz & float mode for non-hires. music, 96kHz & 32bit for hires. one, and exceptionally 44.1kHz & 16bit for AAC music files (compressed offload feature) without third party proprietary USB drivers. Till now, the usbv2 HAL driver cannot work at all after AOC (new USB Direct Access feature) was introduced. Tensor's hardware offload driver wouldn't change its sample rate except 44.1kHz, 48kHz, 96kHz and 192kHz (float and 32bit int format).
# v2.7.0
* Optimized "extras/jitter-reducer.sh" for reducing I/O scheduling jitter
* Added a support for "sysbta" (System Wide Bluetooth Hal) of recent GSI's and "bluetooth_qti" (experimental)
# v2.6.5
* Optimized "extras/jitter-reducer.sh" for reducing I/O scheduling jitter
* Added extras/dumpsys-bluetooth-filtered.sh command for displaying the active codec information
# v2.6.4
* Optimized "extras/jitter-reducer.sh" for reducing I/O scheduling jitter
* Fixed bugs related to bluetooth SCO Headset (Hands-free) when "--bypass-offload-safer" modes
* Improved "extras/dumpsys-filtered.sh" for bluetooth SCO
# v2.6.3
* Adjusted bluetooth device formats for letting Am*zon music app to output 44kHz & 32bit float format
Note: The Am*zon app determines its output format (of its internal resampler) for bluetooth by looking at the bluetooth device format (picking up the max sample rate if multiple rates specified) in the audio policy configuration XML file on each phone, e.g. outputting 48kHz & 16bit for 48kHz & 16bit phones, 96kHz & 16bit for 96kHz & 16bit phones, 44.1kHz & 32bit float for 44.1kHz & 24bit or 32bit (used by my script). Please choose 44.1kHz & 32bit (or the possible largest bits) in developer settings.
If you like to specify the Am*zon's output format on recent phones, specify "--offload-hifi-playback" and "96k 32", "48k 24", etc. This option changes the initial format of bluetooth devices only, so you can change the current format through developer settings afterward.
# v2.6.2
* Added "--offload-direct" mode for comparing usual (non-a2dp hardware offload) mixer modes to "direct_pcm" and "compressed_offload" modes with&without DRC, especially for bluetooth audio
Note: "direct_pcm" and "compressed_offload" modes cannot avoid default DRC on Qcomm devices. As some recent custom ROM's sometimes reverse on/off of the DRC switch, please confirm the difference by your ears.
# v2.6.1
* Added a bypass offload safer mode for recent MTK devices
* Changed the default behavior to prefer bypass offload safer modes to bypass offload modes for limiting effect only on USB audio
# v2.6.0
* Added support for the usbv2 HAL module
* Tuned for LDAC TWS's (use extras/jitter-reducer.sh --io * medium).
Note: For crDroid Alioth users, try "--bypass-offload-safer 96k 32" or "--offload-hifi-playback 48k 24" option.
# v2.5.5
* Tuned "extras/jitter-reducer.sh" with respect to tunables for "mq-deadline", "kyber" and "none" I/O scheduler (latest kernel common schedulers?)
* Added forgotten wired phone entries in "bypass-offload-safer" mode
* Fixed for the Nyx kernel 4.19 (expiration tunables of its mq-deadline scheduler were changed in 10msec resolution from 3msec)
* Disabled the work queue power efficient mode for reducing jitter if possible (especially for the Nyx kernel and other latest ones)
# v2.5.4
* Fixed a telephone audio configuration issue on Qcomm SoC Android 12 caused by a hal version mismatch
* Added "--bypass-offload-safer" option for keeping the sample rate and the bit depth of internal speakers and a 3.5mm jack to be 48kHz 16/24bit
# v2.5.3
* Tuned "extras/jitter-reducer.sh" for Bluetooth devices, USB DAC's and DLNA receivers
"extras/jitter-reducer.sh --all --io deadline medium" for Bluetooth devices
"extras/jitter-reducer.sh --all --io deadline boost" for USB DAC's and DLNA receivers
# v2.5.2
* Added a workaround for Android 12 SELinux bug w.r.t. "ro.audio.usb.period_us" property
* Tuned kernel tunables for clearer audio quality
# v2.5.0
* Added extras/change-resampling-quality.sh (to reduce resampling distortion) and extras/change-usb-period.sh (to reduce the jitter of a PLL in a DAC)directly)
* Tuned kernel tunables by assuming an audio scheduling tunable "vendor.audio.adm.buffering.ms" to be "2" (please set this property by my magisk modules ["usb-samplerate-unlocker"](https://github.com/Magisk-Modules-Alt-Repo/usb-samplerate-unlocker) and/or ["audio-misc-settings"](https://github.com/Magisk-Modules-Alt-Repo/audio-misc-settings))
# v2.4.11
* extras/jitter-reducer.sh:
1. Disabled the Android doze itself for reducing jitter considerably unless disabling battery optimizations of app's
2. Tuned kernel tunables for recent Qcomm and MTK devices
* USB_SampleRate_Changer.sh:
1. Added an option specifying "float" bit depth.
* Fixed an audioserver hang-up after setprop restart on A12 low performance devices (by sending a SIGHUP signal to the server)
* Added resampling parameter examples in README
# v2.4.10
* Tuned for POCO F3 (SD870) on phh GSI's because I abandoned tuning for custom ROM's on POCO F3 except phh GSI's
* Tuned for SD845 devices; Perhaps also SD855 & SD865 & SD880 devices
* Tuned I/O scheduler and virtual memory parameters, especially on bluetooth earphones
# v2.4.9
* Improved "extras/jitter-reducer.sh" about thermal controls of performance Snapdragon's
* Optimized for POCO F3, but some of its custom ROM's cannot disable DRC (ArrowOS has inverted the DRC switch, so add "--drc" option to disable DRC)
# v2.4.8
* Tuned tunable values of the I/O jitter reducer and added "transition band cheat" option (specifying a cut-off point over the Nyquist frequency) to "extras/change-resampling-quality.sh"
* Fixed too many argument for resetprop
# v2.4.7
* Improved the I/O jitter-reducer
# v2.4.6
* Fixed a bug of usb-samplerate-unlocker detection
* Added AudioFlinger's current resampling quality print option to "extras/change-resampling-quality.sh"
* Improved "extras/change-resampling-quality.sh" for 1:1 ratio resampling, especially 44.1kHz 32bit data pass-through
* Tuned parameters of the I/O jitter reducer
# v2.4.5
* "extras/change-resampling-quality.sh" (a changer for the resampling quality of AudioFlinger (the OS mixer)) was added
# v2.4.4
* Enhanced the vm jitter reducer in /extras/jitter-reducer.sh to handle "swap_ratio" and "swap_ratio_enable" for Snapdradons
* Optimized tunables of the I/O jitter reducer
* Added LICENSE
# v2.4.3
* Improved "extras/jitter-reducer.sh" by fixing the GPU frequency at the max one for Qualcomm SoC (min_pwrlevel to the max level 0) and MTK SoC (fixed frequency at the max one with no governor)
Remarks: Don't forget to disable "adaptive battery" in the battery section of "settings" and battery optimizations for "System UI" (system app), etc. to lower reverb like jitter distortion in digital audio outputs.
# v2.4.2
* Optimized the I/O jitter reducer in "extras/jitter-reducer.sh" for Snapdragon devices
# v2.4.1
* Added an "m-light" tone mode for the I/O jitter reducer to "extras'jitter-reduce.sh"
The mode is optimal for somewhat insensitive bluetooth earphones
# v2.4.0 (pre-release)
* Enhanced extras/jitter-reducer.sh by replacing the I/O jitter reducer with that of the hifi maximizer which uses "deadline" and "cfq" I/O schedulers and their optimized tunable values
# v2.3.0
* Enhanced extras/jitter-reducer.sh by adding a wifi jitter reducer which is especially effective for music streaming services (both online and offline), Pixel's and other high performance devices
* Cleaned up source codes
# v2.2.5
* Made "--io" option of "extras/jitter-reducer.sh" to have a parameter "nr_requests" (or presets "light", "medium" and "boost") for adjusting various peripheral devices (especially bluetooth earphones)
# v2.2.4
* "extras/jitter-reducer.sh" was improved for CPU&GPU governor and I/O scheduler (especially effective to bluetooth earphones)
# v2.2.3
* "extras/jitter-reducer.sh" was improved especially for old Qcomm devices
# v2.2.2 (pre-release)
* "extras/jitter-reducer.sh" was improved for virtual memory related jitters
# v2.2.1 (pre-release)
* "extras/jitter-reducer.sh" improved especially for old MTK SoC devices
# v2.2.0
* "extras/jitter-reducer.sh" (a simplified version of my ["Hifi Maximizer"](https://github.com/yzyhk904/hifi-maximizer-mod)) added
# v2.1.0
* ``--drc`` option added for the porpus of comparison to usual DRC-less audio quality
# v2.0.1
* "--safe", "--safest" and "--usb-only" options added
# v2.0.0 (pre-release)
* Supported "disable a2dp hardware-offload" in dev. settings and PHH treble GSI's "force disable a2dp hardware-offload"
* Set an r_submix HAL to be 44.1kHz 16bit mode
* Added "auto" mode for investigating device's environment and guessing best settings
# v1.3.2
* Over umounting and mount points loss issues was fixed
# v1.3.1
* Initial public release (on the Github)
# v1.3.0
* Selinux enforcing mode bug fixed
Now this script can be used under both selinux enforcing and permissive modes
# v1.2.0
* (USB) hardware offload support added (currently experimental)
* Bypass (USB) offload (using a non- USB hardware offload driver while the 3.5mm jack and internal speaker use a hardware offload driver) support added (currently experimental)
# v1.1.0
* Recent higher sample rates added
# v1.0.0
* Initial limited release
##
================================================
FILE: extras/alsa-hw-params.sh
================================================
#!/system/bin/sh
rst="closed"
file="/proc/asound/card1/pcm0p/sub0/hw_params"
if [ -r "$file" ]; then
# For non-hardware offload use
rst="`cat $file`"
if [ ! "$rst" = "closed" ];then
echo "DAC Connection Status:"
echo "$rst"
fi
fi
if [ "$rst" = "closed" ]; then
# For USB hardware offload use
for i in `seq 0 90`; do
file="/proc/asound/card0/pcm${i}p/sub0/hw_params"
if [ -r "$file" ]; then
rst="`cat $file`"
if [ ! "$rst" = "closed" ];then
echo "Active Audio Connection Status (/proc/asound/card0/pcm${i}p):"
echo "$rst"
break
fi
fi
done
fi
if [ -r "/proc/asound/card1/id" ]; then
if [ ! "`cat /proc/asound/card1/id`" = "closed" -a -r "/proc/asound/card1/stream0" ];then
echo "\nDAC Hardware Profile:"
cat '/proc/asound/card1/stream0'
fi
fi
================================================
FILE: extras/change-bluetooth-hal.sh
================================================
#!/system/bin/sh
function usage()
{
echo "Usage: ${0##*/} [--help] [--status] [ aosp | legacy | offload | sysbta ]" 1>&2
}
function which_resetprop_command()
{
type resetprop 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop"
else
type resetprop_phh 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop_phh"
else
return 1
fi
fi
return 0
}
function reloadAudioserver()
{
# wait for system boot completion and audiosever boot up
local i
for i in `seq 1 3` ; do
if [ "`getprop sys.boot_completed`" = "1" -a -n "`getprop init.svc.audioserver`" ]; then
break
fi
sleep 1
done
if [ -n "`getprop init.svc.audioserver`" ]; then
setprop ctl.restart audioserver
sleep 0.2
if [ "`getprop init.svc.audioserver`" != "running" ]; then
# workaround for Android 12 old devices hanging up the audioserver after "setprop ctl.restart audioserver" is executed
local pid="`getprop init.svc_debug_pid.audioserver`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
for i in `seq 1 10` ; do
sleep 0.2
if [ "`getprop init.svc.audioserver`" = "running" ]; then
break
elif [ $i -eq 10 ]; then
echo "audioserver reload failed!" 1>&2
return 1
fi
done
fi
if [ $# -gt 0 -a "$1" = "all" -a -n "`getprop init.svc.vendor.audio-hal`" ]; then
setprop ctl.restart "vendor.audio-hal" 1>"/dev/null" 2>&1
sleep 0.2
if [ "`getprop init.svc.vendor.audio-hal`" != "running" ]; then
kill "`getprop init.svc_debug_pid.vendor.audio-hal`" 1>"/dev/null" 2>&1
fi
fi
else
echo "audioserver is not found!" 1>&2
return 1
fi
}
function BluetoothHalStatus()
{
if [ "`getprop persist.bluetooth.system_audio_hal.enabled`" = 1 -o "`getprop persist.bluetooth.system_audio_hal.enabled`" = "true" ]; then
echo "sysbta (\"sysbta\" HAL) : enabled" 1>&2
else
if [ "`getprop persist.bluetooth.bluetooth_audio_hal.disabled`" != "true" -a -r "/vendor/lib64/hw/audio.bluetooth.default.so" ]; then
echo "aosp (\"bluetooth\" HAL) : enabled" 1>&2
elif [ -r "/system/lib64/hw/audio.a2dp.default.so" -o -r "/system/lib/hw/audio.a2dp.default.so" ]; then
echo "legacy (\"a2dp\" HAL) : enabled" 1>&2
elif [ -r "/vendor/lib64/hw/audio.bluetooth_qti.default.so" -o -r "/vendor/lib/hw/audio.bluetooth_qti.default.so" ]; then
echo "legacy (\"bluetooth_qti\" HAL) : enabled" 1>&2
fi
if [ "`getprop ro.bluetooth.a2dp_offload.supported`" = "true" -a "`getprop persist.bluetooth.a2dp_offload.disabled`" = "false" ]; then
echo "offload (\"primary.$(getprop ro.board.platform)\" a2dp offload HAL) : enabled" 1>&2
fi
fi
}
AudioHALs="
vendor.audio-hal
audio_proxy_service
audio-hal
audio-hal-2-0
vendor.audio-hal-2-0
vendor.audio-hal-4-0-msd
vendor.audio-hal-7-0
"
function restartAudioHalExceptSysbta()
{
local x
for x in $AudioHALs "system.bt-audio-hal"; do
if [ "`getprop init.svc.${x}`" = "running" ]; then
stop ${x}
fi
done
for x in $AudioHALs; do
if [ "`getprop init.svc.${x}`" = "stopped" ]; then
start ${x}
fi
done
}
function startSysbtaHal()
{
local x
for x in $AudioHALs "system.bt-audio-hal"; do
if [ "`getprop init.svc.${x}`" = "stopped" ]; then
start ${x}
fi
done
}
BTmode="aosp"
if [ $# -eq 1 ]; then
case "$1" in
"aosp" | "legacy" | "offload" | "sysbta" )
BTmode="$1"
;;
"-s" | "--status" )
BluetoothHalStatus
exit 0
;;
"-h" | "--help" )
usage
exit 0
;;
-* | * )
usage
exit 1
;;
esac
else
usage
exit 0
fi
resetprop_command="`which_resetprop_command`"
if [ -z "$resetprop_command" ]; then
echo "${0##*/} cannot change Bluetooth HAL; (no resetprop commands found)" 1>&2
exit 1
fi
if [ -n "`getprop persist.bluetooth.system_audio_hal.enabled`" ]; then
if [ "$BTmode" = "sysbta" ]; then
setprop persist.bluetooth.bluetooth_audio_hal.disabled false
setprop persist.bluetooth.a2dp_offload.disabled true
"$resetprop_command" ro.bluetooth.a2dp_offload.supported false
setprop persist.bluetooth.system_audio_hal.enabled 1
else
"$resetprop_command" --delete persist.bluetooth.bluetooth_audio_hal.disabled
"$resetprop_command" --delete persist.bluetooth.a2dp_offload.disabled
"$resetprop_command" --delete ro.bluetooth.a2dp_offload.supported
setprop persist.bluetooth.system_audio_hal.enabled 0
fi
fi
case "$BTmode" in
"aosp" )
if [ -r "/vendor/lib64/hw/audio.bluetooth.default.so" -o -r "/vendor/lib/hw/audio.bluetooth.default.so" ]; then
reloadAudioserver
setprop persist.bluetooth.bluetooth_audio_hal.disabled false
restartAudioHalExceptSysbta
else
echo "${0##*/} cannot change to \"${BTmode}\"; (no ${BTmode} HAL module)" 1>&2
exit 1
fi
;;
"legacy" )
if [ -r "/system/lib64/hw/audio.a2dp.default.so" -o -r "/system/lib/hw/audio.a2dp.default.so" ]; then
reloadAudioserver
setprop persist.bluetooth.bluetooth_audio_hal.disabled true
restartAudioHalExceptSysbta
elif [ -r "/vendor/lib64/hw/audio.bluetooth_qti.default.so" -o -r "/vendor/lib/hw/audio.bluetooth_qti.default.so" ]; then
reloadAudioserver
setprop persist.bluetooth.bluetooth_audio_hal.disabled true
setprop persist.bluetooth.a2dp_offload.disabled false
"$resetprop_command" ro.bluetooth.a2dp_offload.supported true
restartAudioHalExceptSysbta
else
echo "${0##*/} cannot change to \"${BTmode}\"; (no ${BTmode} HAL module)" 1>&2
exit 1
fi
;;
"offload" )
if [ -n "`getprop persist.bluetooth.a2dp_offload.cap`" -o -n "`getprop persist.vendor.qcom.bluetooth.a2dp_offload_cap`" ]; then
reloadAudioserver
setprop persist.bluetooth.bluetooth_audio_hal.disabled false
setprop persist.bluetooth.a2dp_offload.disabled false
"$resetprop_command" ro.bluetooth.a2dp_offload.supported true
restartAudioHalExceptSysbta
else
echo "${0##*/} cannot change to \"${BTmode}\"; (no ${BTmode} HAL module)" 1>&2
exit 1
fi
;;
"sysbta" )
if [ -n "`getprop init.svc.system.bt-audio-hal`" ]; then
reloadAudioserver
startSysbtaHal
else
echo "${0##*/} cannot change to \"${BTmode}\"; (no ${BTmode} HAL module)" 1>&2
exit 1
fi
;;
esac
BluetoothHalStatus
exit 0
================================================
FILE: extras/change-resampling-quality.sh
================================================
#!/system/bin/sh
# Items Stop_Band_Attenuation Half_Filter_Length Cut_Off_Percent or Stop_Band_Cheat (% of Nyquist freq.)
# -- AOSP standard parameters --
# DYN_LOW_QUALITY(5): 80dB 8 100
# DYN_MEDIUM_QUALITY(6): 84dB 16 100
# AOSP default (>=48kHz): 90dB 32 100 (options: --bypass)
# DYN_HIGH_QUALITY(7): 98dB 32 100
#
# -- Recommended parameters --
# This script's old default (for old Androids): 159dB 480 92
# For low perf Android 12+ (in general): 165dB 360 104 (options: --bypass --cheat)
# For Android 12+ (in general; new default): 179dB 408 99 (options: --cheat)
# For bit perfect when 1:1 ratio: 194dB 520 100
#
# -- My mock series --
# Mock DAC-A over-sampling: 150dB 48 109 (options: --bypass --cheat)
# Mock DAC-B over-sampling: 118dB 40 96
# Mock mastering filter: 159dB 240 99 (options: --cheat)
#
if [ $# -ge 1 ]; then
stopBand=159
filterLength=480
cutOffPercent=92
cheatFlag=0
else
stopBand=179
filterLength=408
cutOffPercent=99
cheatFlag=1
fi
resetFlag=0
bypassFlag=0
function usage()
{
echo "Usage: ${0##*/} [--help] [--status] [--reset] [--bypass] [--cheat] [stop_band_dB [half_filter_length [cut_off_percent]]]" 1>&2
}
function which_resetprop_command()
{
type resetprop 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop"
else
type resetprop_phh 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop_phh"
else
return 1
fi
fi
return 0
}
function reloadAudioserver()
{
# wait for system boot completion and audiosever boot up
local i
for i in `seq 1 3` ; do
if [ "`getprop sys.boot_completed`" = "1" -a -n "`getprop init.svc.audioserver`" ]; then
break
fi
sleep 0.9
done
if [ -n "`getprop init.svc.audioserver`" ]; then
setprop ctl.restart audioserver
sleep 0.2
if [ "`getprop init.svc.audioserver`" != "running" ]; then
# workaround for Android 12 old devices hanging up the audioserver after "setprop ctl.restart audioserver" is executed
local pid="`getprop init.svc_debug_pid.audioserver`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
for i in `seq 1 10` ; do
sleep 0.2
if [ "`getprop init.svc.audioserver`" = "running" ]; then
break
elif [ $i -eq 10 ]; then
echo "audioserver reload failed!" 1>&2
return 1
fi
done
fi
return 0
else
echo "audioserver is not found!" 1>&2
return 1
fi
}
function PrintStatus()
{
if [ $# -eq 5 ]; then
echo "AudioFlinger's current resampling configuration:" 1>&2
if [ -n "$2" ]; then
echo " Effective Freq. (kHz) >= : $2" 1>&2
fi
if [ -n "$3" ]; then
echo " Stop Band (dB): $3" 1>&2
fi
if [ -n "$4" ]; then
echo " Half Filter Length: $4" 1>&2
fi
if [ -n "$5" ]; then
if [ "$1" = "cheat" ]; then
echo " Cheat (% Nyquist freq.): $5" 1>&2
else
echo " Cut Off (% Nyquist freq.): $5" 1>&2
fi
fi
fi
}
function AudioFlingerStatus()
{
local val1 val2 val3 val4
val1="`getprop ro.audio.resampler.psd.enable_at_samplerate`"
if [ -n "$val1" ]; then
val1=`echo "scale=1; $val1 / 1000.0" | bc`
val2="`getprop ro.audio.resampler.psd.stopband`"
val3="`getprop ro.audio.resampler.psd.halflength`"
val4="`getprop ro.audio.resampler.psd.tbwcheat`"
if [ -n "$val4" -a "$val4" -gt 0 ]; then
PrintStatus "cheat" "$val1" "$val2" "$val3" "$val4"
else
val4="`getprop ro.audio.resampler.psd.cutoff_percent`"
PrintStatus "cut-off" "$val1" "$val2" "$val3" "$val4"
fi
else
PrintStatus "cut-off" 48.0 90 32 100
fi
}
while [ $# -gt 0 ]; do
case "$1" in
"-s" | "--status" )
AudioFlingerStatus
exit 0
;;
"-r" | "--reset" )
resetFlag=1
shift
;;
"-b" | "--bypass" )
bypassFlag=1
shift
;;
"-bh" | "--bypass-hires" )
bypassFlag=2
shift
;;
"-c" | "--cheat" )
cheatFlag=1
cutOffPercent=99
shift
;;
"-h" | "--help" | -* )
usage
exit 0
;;
* )
break
;;
esac
done
if [ $# -ge 1 ]; then
if expr "$1" : "[1-9][0-9]*$" 1>"/dev/null" 2>&1; then
if [ $1 -lt 20 -o $1 -gt 242 ]; then
echo "unsupported stop band dB ($1; valid: 20~242)!" 1>&2
usage
exit 1
else
stopBand="$1"
if [ $stopBand -le 60 ]; then
filterLength=72
elif [ $stopBand -le 84 ]; then
filterLength=112
elif [ $stopBand -le 90 ]; then
filterLength=152
elif [ $stopBand -le 98 ]; then
filterLength=192
else
filterLength="`expr 192 + \( $1 - 98 \) / 8 \* 8 \* 4`"
fi
fi
else
echo "unsupported stop band dB ($1; valid: 20~242)!" 1>&2
usage
exit 1
fi
fi
if [ $# -ge 2 ]; then
if expr "$2" : "[1-9][0-9]*$" 1>"/dev/null" 2>&1; then
if [ $2 -lt 8 -o $2 -gt 640 ]; then
echo "unsupported half filter length ($2; valid: 8~640)!" 1>&2
usage
exit 1
else
filterLength="`expr $2 / 8 \* 8`"
fi
else
echo "unsupported half filter length ($2; valid: 8~640)!" 1>&2
usage
exit 1
fi
fi
if [ $# -ge 3 ]; then
if expr "$3" : "[1-9][0-9]*$" 1>"/dev/null" 2>&1; then
if [ $cheatFlag -gt 0 ]; then
if [ $3 -le 0 -o $3 -gt 200 ]; then
echo "unsupported cheat percent ($3; valid: 1~200)!" 1>&2
usage
exit 1
else
cutOffPercent=$3
fi
elif [ $3 -lt 0 -o $3 -gt 100 ]; then
echo "unsupported cut off percent ($3; valid: 0~100)!" 1>&2
usage
exit 1
else
cutOffPercent=$3
fi
else
if [ $cheatFlag -gt 0 ]; then
echo "unsupported cheat percent ($3; valid: 1~200)!" 1>&2
else
echo "unsupported cut off percent ($3; valid: 0~100)!" 1>&2
fi
usage
exit 1
fi
fi
resetprop_command="`which_resetprop_command`"
if [ -n "$resetprop_command" ]; then
if [ $resetFlag -gt 0 ]; then
"$resetprop_command" --delete af.resampler.quality 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.enable_at_samplerate 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.stopband 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.halflength 1>/dev/null 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1
else
# Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)
"$resetprop_command" --delete af.resampler.quality 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.enable_at_samplerate 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.stopband 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.halflength 1>/dev/null 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1
# End of workaround
"$resetprop_command" af.resampler.quality 7 1>"/dev/null" 2>&1
if [ $bypassFlag -gt 1 ]; then
"$resetprop_command" ro.audio.resampler.psd.enable_at_samplerate 96000 1>"/dev/null" 2>&1
elif [ $bypassFlag -gt 0 ]; then
"$resetprop_command" ro.audio.resampler.psd.enable_at_samplerate 48000 1>"/dev/null" 2>&1
else
"$resetprop_command" ro.audio.resampler.psd.enable_at_samplerate 44100 1>"/dev/null" 2>&1
fi
"$resetprop_command" ro.audio.resampler.psd.stopband "$stopBand" 1>"/dev/null" 2>&1
"$resetprop_command" ro.audio.resampler.psd.halflength "$filterLength" 1>"/dev/null" 2>&1
if [ $cheatFlag -gt 0 ]; then
"$resetprop_command" ro.audio.resampler.psd.tbwcheat "$cutOffPercent" 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1
else
"$resetprop_command" ro.audio.resampler.psd.cutoff_percent "$cutOffPercent" 1>"/dev/null" 2>&1
"$resetprop_command" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1
fi
fi
reloadAudioserver
else
echo "cannot change resampling quality (no resetprop commands found)" 1>&2
exit 1
fi
AudioFlingerStatus
exit 0
================================================
FILE: extras/change-usb-period.sh
================================================
#!/system/bin/sh
period_us=2250
resetFlag=0
function usage()
{
echo "Usage: ${0##*/} [--help] [--status] [--reset] [period_usec]" 1>&2
echo " (default: 2250 usec)" 1>&2
}
function which_resetprop_command()
{
type resetprop 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop"
else
type resetprop_phh 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop_phh"
else
return 1
fi
fi
return 0
}
function reloadAudioserver()
{
# wait for system boot completion and audiosever boot up
local i
for i in `seq 1 3` ; do
if [ "`getprop sys.boot_completed`" = "1" -a -n "`getprop init.svc.audioserver`" ]; then
break
fi
sleep 0.9
done
if [ -n "`getprop init.svc.audioserver`" ]; then
setprop ctl.restart audioserver
sleep 0.2
if [ "`getprop init.svc.audioserver`" != "running" ]; then
# workaround for Android 12 old devices hanging up the audioserver after "setprop ctl.restart audioserver" is executed
local pid="`getprop init.svc_debug_pid.audioserver`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
for i in `seq 1 10` ; do
sleep 0.2
if [ "`getprop init.svc.audioserver`" = "running" ]; then
break
elif [ $i -eq 10 ]; then
echo "audioserver reload failed!" 1>&2
return 1
fi
done
fi
return 0
else
echo "audioserver is not found!" 1>&2
return 1
fi
}
function PrintStatus()
{
if [ $# -eq 1 ]; then
echo "USB driver's transfer property:" 1>&2
if [ -n "$1" ]; then
echo " period = $1 usec" 1>&2
fi
fi
}
function AudioDriverStatus()
{
local val
val="`getprop vendor.audio.usb.perio`"
if [ -z "$val" ]; then
val="`getprop ro.audio.usb.period_us`"
fi
if [ -n "$val" ]; then
PrintStatus "$val"
elif [ $resetFlag -eq 0 ]; then
echo "Warning: root permisson is needed for the right answer!" 1>&2
PrintStatus "5000(?)"
else
PrintStatus "5000(?)"
fi
}
while [ $# -gt 0 ]; do
case "$1" in
"-s" | "--status" )
AudioDriverStatus
exit 0
;;
"-r" | "--reset" )
resetFlag=1
shift
;;
"-h" | "--help" | -* )
usage
exit 0
;;
* )
break
;;
esac
done
if [ $# -ge 1 ]; then
if expr "$1" : "[1-9][0-9]*$" 1>"/dev/null" 2>&1; then
if [ $1 -lt 125 -o $1 -gt 50000 ]; then
echo "unsupported transfer period ($1; valid: 125~50000 usec)!" 1>&2
usage
exit 1
else
period_us="`expr $1 / 125 \* 125`"
fi
else
echo "unsupported transfer period ($1; valid: 125~50000 usec)!" 1>&2
usage
exit 1
fi
fi
resetprop_command="`which_resetprop_command`"
if [ -n "$resetprop_command" ]; then
if [ $resetFlag -gt 0 ]; then
"$resetprop_command" --delete ro.audio.usb.period_us 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.perio 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.out.period_us 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.out.period_count 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio_hal.period_multiplier 1>"/dev/null" 2>&1
else
# Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)
"$resetprop_command" --delete ro.audio.usb.period_us 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.perio 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.out.period_us 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio.usb.out.period_count 1>"/dev/null" 2>&1
"$resetprop_command" --delete vendor.audio_hal.period_multiplier 1>"/dev/null" 2>&1
# End of workaround
"$resetprop_command" "ro.audio.usb.period_us" "$period_us" 1>"/dev/null" 2>&1
"$resetprop_command" "vendor.audio.usb.perio" "$period_us" 1>"/dev/null" 2>&1
"$resetprop_command" "vendor.audio.usb.out.period_us" "$period_us" 1>"/dev/null" 2>&1
"$resetprop_command" "vendor.audio.usb.out.period_count" "2" 1>"/dev/null" 2>&1
"$resetprop_command" "vendor.audio_hal.period_multiplier" "1" 1>"/dev/null" 2>&1
fi
reloadAudioserver
else
echo "cannot change the USB transfer period (no resetprop commands found)" 1>&2
exit 1
fi
AudioDriverStatus
exit 0
================================================
FILE: extras/dumpsys-bluetooth-filtered.sh
================================================
#!/system/bin/sh
allFlag=0
if [ $# -gt 0 ];then
case "$1" in
"-a" | "--all" )
allFlag=1
;;
"-h" | "--help" )
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 0
;;
* )
echo "wrong argument ($1)" 1>&2
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 1
;;
esac
fi
dumpsys bluetooth_manager | sed -e '/^Bluetooth Status/,/^A2DP State:/d' -e '/^A2DP Sink State:/,$d' \
| awk -v allFlag=$allFlag '
BEGIN {
RS=""
FS="\n"
printFlag=1
if (allFlag == 1)
print "A2DP State:"
}
allFlag==1 || (printFlag==1 && /\n Config: Rate/) {
print $0 "\n"
if (allFlag == 0)
printFlag=0
}'
================================================
FILE: extras/dumpsys-filtered.sh
================================================
#!/system/bin/sh
allFlag=0
if [ $# -gt 0 ];then
case "$1" in
"-a" | "--all" )
allFlag=1
;;
"-h" | "--help" )
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 0
;;
* )
echo "wrong argument ($1)" 1>&2
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 1
;;
esac
fi
dumpsys media.audio_flinger | sed -e '/^ Hal stream dump/,/^ Normal mixer raw underrun counters:/d' -e '/^-/d' -e '/^Output thread/,/^$/!d' \
| awk '
/^$/ ||
/^Output thread/ ||
/^ Sample rate:/ ||
/^ HAL format:/ ||
/^ Timestamp stats:/ ||
/^ AudioStreamOut:/ ||
/^ Output devices?:/ ||
/^ Local log:/ ||
/^ [0-1][0-9]-[0-3][0-9] [0-9.:]+ AT::add / {
print
}' \
| awk -v allFlag=$allFlag '
BEGIN {
RS=""
FS="\n"
}
(allFlag==1 && /Output devices?:[^(]+\(AUDIO_DEVICE_OUT_SPEAKER\)/) ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_EARPIECE\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_USB_HEADSET\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_USB_DEVICE\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_WIRED_HEADSET\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_WIRED_HEADPHONE\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_LINE\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_REMOTE_SUBMIX\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\)/ ||
/Output devices?:[^(]+\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\)/ {
print $0 "\n"
}'
================================================
FILE: extras/getConfig.sh
================================================
#!/system/bin/sh
allFlag=0
if [ $# -gt 0 ];then
case "$1" in
"-a" | "--all" )
allFlag=1
;;
"-h" | "--help" )
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 0
;;
* )
echo "wrong argument ($1)" 1>&2
echo "Usage: ${0##*/} [--all][--help]" 1>&2
exit 1
;;
esac
fi
dumpsys media.audio_policy | sed -e '/^Supported/,/^$/d' -e '/^ Outputs/,$d' \
| awk -v allFlag=$allFlag '
function getDRCswitch(fname)
{
v=0
if (system("test -r " fname) > 0)
return(-1)
for (;;) {
r=(getline x < fname)
if (r < 0)
retrun(-1)
else if ( r == 0) {
v=0
break
}
else {
if (x ~ /speaker_drc_enabled[:space:]*=[:space:]*\"true\"/) {
v=1
break
}
else if (x ~ /speaker_drc_enabled[:space:]*=[:space:]*\"false\"/) {
v=0
break
}
}
}
close(fname)
return(v)
}
allFlag==1 {
print
}
allFlag!=1 &&
( /^- HW Module / || /^ - name: / ) {
print
}
allFlag!=1 &&
/^ Config source: / {
print " Config source: \"" $3 "\""
v=getDRCswitch($3)
if (v == 1)
print " DRC switch: on"
else if (v == 0)
print " DRC switch: off"
}
allFlag!=1 &&
/^ [1-9][0-9]*\. Handle:/ {
print "\n\n HW module: " $4
}
allFlag!=1 &&
/^ [1-9][0-9]*\. [^{]+\{AUDIO_DEVICE/ {
print
}'
================================================
FILE: extras/jitter-reducer-functions.shlib
================================================
#!/system/bin/sh
function forceOnlineCPUs()
{
local i st en
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
for i in `seq $st $en`; do
if [ -e "/sys/devices/system/cpu/cpu$i/online" ]; then
chmod 644 "/sys/devices/system/cpu/cpu$i/online"
echo '1' >"/sys/devices/system/cpu/cpu$i/online"
fi
done
fi
}
function searchDefaultCpuGovernor()
{
# Search default CPU governor
local gov=""
local i
for i in `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`; do
if [ "$i" = "walt" -o "$i" = "sugov_ext" -o "$i" = "sched_pixel" -o "$i" = "schedutil" ]; then
gov="$i"
break;
elif [ ! "$gov" = "schedplus" ]; then
if [ "$i" = "schedplus" ]; then
gov="$i"
elif [ ! "$gov" = "interactive" ]; then
gov="$i"
fi
fi
done
if [ -z "$gov" ]; then
gov="performance"
fi
echo "$gov"
}
function reduceSelinuxJitter()
{
if [ $# -eq 2 ]; then
local flag="$1"
local printStatus="$2"
if [ $flag -gt 0 ]; then
setenforce 0
elif [ $flag -lt 0 ]; then
if [ "`getprop ro.build.product`" = "jfltexx" -a "`getprop ro.system.build.version.release`" -ge "12" ]; then
echo "Warning: ignored trying to change Selinux mode" 1>&2
else
setenforce 1
fi
fi
if [ $printStatus -gt 0 ]; then
echo " Selinux mode: `getenforce`"
fi
else
return 1
fi
}
function reduceThermalJitter()
{
if [ $# -eq 2 ]; then
local flag="$1"
local printStatus="$2"
if [ $flag -gt 0 ]; then
# Stop thermal core control
if [ -w "/sys/module/msm_thermal/core_control/enabled" ]; then
echo '0' > "/sys/module/msm_thermal/core_control/enabled"
fi
if [ -r "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
local i st en
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
if [ -w "/sys/devices/system/cpu/cpu7/core_ctl/enable" ]; then
# SD850 or higher type core control
local ncpu_remained=7
echo '1' > "/sys/devices/system/cpu/cpu7/core_ctl/enable"
echo '1' > "/sys/devices/system/cpu/cpu7/core_ctl/min_cpus"
echo '55' > "/sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres"
echo '0' > "/sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres"
echo '2900' > "/sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms"
echo '0' > "/sys/devices/system/cpu/cpu7/core_ctl/enable"
if [ -w "/sys/devices/system/cpu/cpu3/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu3/core_ctl/enable"
# min_cpus cannot be set to be 4, so 3
echo '3' > "/sys/devices/system/cpu/cpu3/core_ctl/min_cpus"
echo '55 55 55' > "/sys/devices/system/cpu/cpu3/core_ctl/busy_down_thres"
echo '0 0 0' > "/sys/devices/system/cpu/cpu3/core_ctl/busy_up_thres"
echo '2900' > "/sys/devices/system/cpu/cpu3/core_ctl/offline_delay_ms"
echo '0' > "/sys/devices/system/cpu/cpu3/core_ctl/enable"
ncpu_remained=3
elif [ -w "/sys/devices/system/cpu/cpu4/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
echo '3' > "/sys/devices/system/cpu/cpu4/core_ctl/min_cpus"
echo '55 55 55' > "/sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres"
echo '0 0 0' > "/sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres"
echo '2900' > "/sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms"
echo '0' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
ncpu_remained=4
fi
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo "$ncpu_remained" > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
echo '55 55 55 55' > "/sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres"
echo '0 0 0 0' > "/sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres"
echo '2900' > "/sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms"
echo '0' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
elif [ -w "/sys/devices/system/cpu/cpu6/core_ctl/enable" ]; then
# Dimensity type core control
echo '1' > "/sys/devices/system/cpu/cpu6/core_ctl/enable"
echo '2' > "/sys/devices/system/cpu/cpu6/core_ctl/min_cpus"
echo '0' > "/sys/devices/system/cpu/cpu6/core_ctl/enable"
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo '6' > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
echo '0' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
elif [ -w "/sys/devices/system/cpu/cpu4/core_ctl/enable" ]; then
# SD840 or lower type core control
echo '1' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
echo '4' > "/sys/devices/system/cpu/cpu4/core_ctl/min_cpus"
echo '0' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo '4' > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
echo '0' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
elif [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
# unknown type core control
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo '4' > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
echo '0' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
fi
fi
# Stop the MPDecision (CPU hotplug)
if [ "`getprop init.svc.mpdecision`" = "running" ]; then
setprop ctl.stop mpdecision
forceOnlineCPUs
elif [ "`getprop init.svc.mpdecision`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.mpdecision`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
forceOnlineCPUs
fi
elif [ "`getprop init.svc.vendor.mpdecision`" = "running" ]; then
setprop ctl.stop vendor.mpdecision
forceOnlineCPUs
elif [ "`getprop init.svc.vendor.mpdecision`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.vendor.mpdecision`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
forceOnlineCPUs
fi
fi
# Stop the thermal server
if [ "`getprop init.svc.thermal`" = "running" ]; then
setprop ctl.stop thermal
elif [ "`getprop init.svc.thermal`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.thermal`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
elif [ "`getprop init.svc.vendor.thermal`" = "running" ]; then
setprop ctl.stop vendor.thermal
elif [ "`getprop init.svc.vendor.thermal`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.vendor.thermal`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
# Stop MTK thermald and thermal_core
if [ "`getprop init.svc.thermald`" = "running" ]; then
setprop ctl.stop thermald
elif [ "`getprop init.svc.thermald`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.thermald`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
if [ "`getprop init.svc.thermal_core`" = "running" ]; then
setprop ctl.stop thermal_core
elif [ "`getprop init.svc.thermal_core`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.thermal_core`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
# Stop the mi_thermald server
if [ "`getprop init.svc.mi_thermald`" = "running" ]; then
setprop ctl.stop mi_thermald
elif [ "`getprop init.svc.mi_thermald`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.mi_thermald`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
elif [ "`getprop init.svc.vendor.mi_thermald`" = "running" ]; then
setprop ctl.stop vendor.mi_thermald
elif [ "`getprop init.svc.vendor.mi_thermald`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.vendor.mi_thermald`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
# Stop the thermal-engine server
if [ "`getprop init.svc.thermal-engine`" = "running" ]; then
setprop ctl.stop thermal-engine
elif [ "`getprop init.svc.thermal-engine`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.thermal-engine`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
elif [ "`getprop init.svc.vendor.thermal-engine`" = "running" ]; then
setprop ctl.stop vendor.thermal-engine
elif [ "`getprop init.svc.vendor.thermal-engine`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.vendor.thermal-engine`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
# For MediaTek CPU's
if [ -w "/proc/cpufreq/cpufreq_sched_disable" ]; then
echo '1' > "/proc/cpufreq/cpufreq_sched_disable"
forceOnlineCPUs
fi
elif [ $flag -lt 0 ]; then
# Start thermal core control
if [ -w "/sys/module/msm_thermal/core_control/enabled" ]; then
echo '1' > "/sys/module/msm_thermal/core_control/enabled"
fi
if [ -r "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
local st en
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
if [ -w "/sys/devices/system/cpu/cpu7/core_ctl/enable" ]; then
local ncpu_remained=7
# SD850 or higher type core control
echo '1' > "/sys/devices/system/cpu/cpu7/core_ctl/enable"
echo '0' > "/sys/devices/system/cpu/cpu7/core_ctl/min_cpus"
echo '30' > "/sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres"
echo '60' > "/sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres"
echo '100' > "/sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms"
if [ -w "/sys/devices/system/cpu/cpu3/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu3/core_ctl/enable"
echo '3' > "/sys/devices/system/cpu/cpu3/core_ctl/min_cpus"
echo '30 30 30' > "/sys/devices/system/cpu/cpu3/core_ctl/busy_down_thres"
echo '60 60 60' > "/sys/devices/system/cpu/cpu3/core_ctl/busy_up_thres"
echo '100' > "/sys/devices/system/cpu/cpu3/core_ctl/offline_delay_ms"
ncpu_remained=3
elif [ -w "/sys/devices/system/cpu/cpu4/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
echo '2' > "/sys/devices/system/cpu/cpu4/core_ctl/min_cpus"
echo '30 30 30' > "/sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres"
echo '60 60 60' > "/sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres"
echo '100' > "/sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms"
ncpu_remained=4
fi
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo "$ncpu_remained" > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
echo '0 0 0 0' > "/sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres"
echo '0 0 0 0' > "/sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres"
echo '100' > "/sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms"
echo '0' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
elif [ -w "/sys/devices/system/cpu/cpu6/core_ctl/enable" ]; then
# Dimensity type core control
echo '1' > "/sys/devices/system/cpu/cpu6/core_ctl/enable"
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
elif [ -w "/sys/devices/system/cpu/cpu4/core_ctl/enable" ]; then
# SD840 or lower type core control
echo '1' > "/sys/devices/system/cpu/cpu4/core_ctl/enable"
echo '1' > "/sys/devices/system/cpu/cpu4/core_ctl/min_cpus"
if [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
fi
elif [ -w "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
# unknown type core control
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/enable"
echo '1' > "/sys/devices/system/cpu/cpu0/core_ctl/min_cpus"
fi
fi
fi
# Start the MPDecision (CPU hotplug)
if [ "`getprop init.svc.mpdecision`" = "stopped" ]; then
setprop ctl.start mpdecision
forceOnlineCPUs
elif [ "`getprop init.svc.vendor.mpdecision`" = "stopped" ]; then
setprop ctl.start vendor.mpdecision
forceOnlineCPUs
fi
# Start the thermal server
if [ "`getprop init.svc.thermal`" = "stopped" ]; then
setprop ctl.start thermal
elif [ "`getprop init.svc.vendor.thermal`" = "stopped" ]; then
setprop ctl.start vendor.thermal
fi
# Start the MTK thermald and thermal_core server
if [ "`getprop init.svc.thermald`" = "stopped" ]; then
setprop ctl.start thermald
fi
if [ "`getprop init.svc.thermal_core`" = "stopped" ]; then
setprop ctl.start thermal_core
fi
# Start the mi_thermald server
if [ "`getprop init.svc.mi_thermald`" = "stopped" ]; then
setprop ctl.start mi_thermald
elif [ "`getprop init.svc.vendor.mi_thermald`" = "stopped" ]; then
setprop ctl.start vendor.mi_thermald
fi
# Start the thermal-engine server
if [ "`getprop init.svc.thermal-engine`" = "stopped" ]; then
setprop ctl.start thermal-engine
elif [ "`getprop init.svc.vendor.thermal-engine`" = "stopped" ]; then
setprop ctl.start vendor.thermal-engine
fi
# For MediaTek CPU's
if [ -w "/proc/cpufreq/cpufreq_sched_disable" ]; then
val="`searchDefaultCpuGovernor`"
if [ "$val" = "schedutil" -a "`getprop ro.vendor.build.version.release`" -lt "11" ]; then
echo " Notice: EAS hasn't been enabled, so skipping thermal MTK EAS+ enabling" 1>&2
else
echo '0' > "/proc/cpufreq/cpufreq_sched_disable"
fi
fi
fi
if [ $printStatus -gt 0 ]; then
local found=0
# Qualcomm Core control
if [ -w "/sys/module/msm_thermal/core_control/enabled" ]; then
if [ "`cat /sys/module/msm_thermal/core_control/enabled`" -eq 0 ]; then
echo " Thermal msm_thermal: disabled"
else
echo " Thermal msm_thermal: enabled"
fi
found=1
fi
if [ -r "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
local i st en ctl_enabled=0
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
if [ -r "/sys/devices/system/cpu/cpu7/core_ctl/enable" ]; then
read ctl_enabled <"/sys/devices/system/cpu/cpu7/core_ctl/enable"
elif [ -r "/sys/devices/system/cpu/cpu6/core_ctl/enable" ]; then
read ctl_enabled <"/sys/devices/system/cpu/cpu6/core_ctl/enable"
elif [ -r "/sys/devices/system/cpu/cpu4/core_ctl/enable" ]; then
read ctl_enabled <"/sys/devices/system/cpu/cpu4/core_ctl/enable"
elif [ -r "/sys/devices/system/cpu/cpu0/core_ctl/enable" ]; then
read ctl_enabled <"/sys/devices/system/cpu/cpu0/core_ctl/enable"
fi
if [ "$ctl_enabled" -gt 0 ]; then
echo " Thermal core_ctl: enabled"
else
echo " Thermal core_ctl: disabled"
fi
found=1
fi
fi
if [ -n "`getprop init.svc.thermal`" ]; then
echo " Thermal server: `getprop init.svc.thermal`"
found=1
elif [ -n "`getprop init.svc.vendor.thermal`" ]; then
echo " Thermal server: `getprop init.svc.vendor.thermal`"
found=1
fi
if [ -n "`getprop init.svc.thermald`" ]; then
echo " Thermal MTK thermald: `getprop init.svc.thermald`"
found=1
fi
if [ -n "`getprop init.svc.thermal_core`" ]; then
echo " Thermal MTK thermal_core: `getprop init.svc.thermal_core`"
found=1
fi
if [ -n "`getprop init.svc.mi_thermald`" ]; then
echo " Thermal mi_thermald: `getprop init.svc.mi_thermald`"
found=1
elif [ -n "`getprop init.svc.vendor.mi_thermald`" ]; then
echo " Thermal mi_thermald: `getprop init.svc.vendor.mi_thermald`"
found=1
fi
if [ -n "`getprop init.svc.thermal-engine`" ]; then
echo " Thermal thermal-engine: `getprop init.svc.thermal-engine`"
found=1
elif [ -n "`getprop init.svc.vendor.thermal-engine`" ]; then
echo " Thermal thermal-engine: `getprop init.svc.vendor.thermal-engine`"
found=1
fi
# MPDecision
if [ -n "`getprop init.svc.mpdecision`" ]; then
echo " Thermal MPDecision: `getprop init.svc.mpdecision`"
found=1
elif [ -n "`getprop init.svc.vendor.mpdecision`" ]; then
echo " Thermal MPDecision: `getprop init.svc.vendor.mpdecision`"
found=1
fi
# MediaTek EAS+ scheduling
if [ -r "/proc/cpufreq/cpufreq_sched_disable" ]; then
set `cat /proc/cpufreq/cpufreq_sched_disable`
val=$3
if [ "$val" -eq '1' ]; then
echo " Thermal MTK EAS+: stopped"
else
echo " Thermal MTK EAS+: running"
fi
found=1
fi
if [ $found -eq 0 ]; then
echo " Thermal control: N/A"
fi
# End of status print section
fi
else
return 1
fi
}
function reduceDozeJitter()
{
if [ $# -eq 2 ]; then
local flag="$1"
local printStatus="$2"
if [ $flag -gt 0 ]; then
# Disable Doze of the device
dumpsys deviceidle disable all 1>"/dev/null" 2>&1
elif [ $flag -lt 0 ]; then
# Enable Doze of the device
dumpsys deviceidle enable all 1>"/dev/null" 2>&1
fi
if [ $printStatus -gt 0 ]; then
if [ "`dumpsys deviceidle enabled all`" -gt 0 ]; then
echo " Doze battery saver: enabled"
else
echo " Doze battery saver: disabled"
fi
fi
else
return 1
fi
}
function getQcomGpuFreq()
{
local isMax="0"
if [ $# -eq 1 -a "$1" = "max" ]; then
isMax="1"
fi
if [ -r "/sys/class/kgsl/kgsl-3d0/gpu_available_frequencies" -a -r "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" ]; then
local tab x y freq=""
read tab <"/sys/class/kgsl/kgsl-3d0/gpu_available_frequencies"
if [ -z "$tab" ]; then
return 1
fi
set $tab 1>"/dev/null" 2>&1
if [ "$isMax" -eq 1 ]; then
freq="$1"
elif [ -r "/sys/class/kgsl/kgsl-3d0/default_pwrlevel" ]; then
read x <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
read y <"/sys/class/kgsl/kgsl-3d0/default_pwrlevel"
if [ "$y" -lt "$x" ]; then
x="$y"
fi
if [ "$x" -lt $# ]; then
shift $x
fi
freq="$1"
else
# no estimation possible, so check the current real GPU clock
read freq <"/sys/class/kgsl/kgsl-3d0/gpuclk"
fi
if [ -n "$freq" ]; then
echo "$freq"
return 0
else
return 1
fi
else
return 1
fi
}
function getMtkGpuFreqKhz()
{
local isMax="0"
if [ $# -eq 1 -a "$1" = "max" ]; then
isMax="1"
fi
if [ -r "/proc/gpufreq/gpufreq_opp_dump" ]; then
local x1 x2 x3 x4 x5 freq="" IFS=" ,"
if [ "$isMax" -eq 1 ]; then
read x1 x2 x3 x4 x5 <"/proc/gpufreq/gpufreq_opp_dump"
freq="$x4"
else
while read x1 x2 x3 x4 x5; do
freq="$x4"
done <"/proc/gpufreq/gpufreq_opp_dump"
fi
if [ -n "$freq" ]; then
echo "$freq"
return 0
else
return 1
fi
elif [ -r "/proc/gpufreqv2/gpu_working_opp_table" -a "$isMax" -eq 1 ]; then
local x1 x2 x3 x4 freq="" IFS=" ,"
read x1 x2 x3 x4 <"/proc/gpufreqv2/gpu_working_opp_table"
freq="$x3"
if [ -n "$freq" ]; then
echo "$freq"
return 0
else
return 1
fi
elif [ -r "/proc/gpufreqv2/gpufreq_status" ]; then
local x1 x2 x3 x4 x5 x6 x7 freq="" IFS=" ,"
{
read
read x1 x2 x3 x4 x5 x6
freq="$x5"
if [ -n "$freq" ]; then
echo "$freq"
return 0
else
return 1
fi
} <"/proc/gpufreqv2/gpufreq_status"
return 0
else
return 1
fi
}
function getTensorGpuFreqKhz()
{
local isMax="0"
if [ $# -eq 1 -a "$1" = "max" ]; then
isMax="1"
elif [ $# -eq 1 -a "$1" = "min" ]; then
isMax="-1"
fi
if [ -r "/sys/devices/platform/1c500000.mali/available_frequencies" ]; then
local tab x freq=""
read tab <"/sys/devices/platform/1c500000.mali/available_frequencies"
if [ -z "$tab" ]; then
return 1
fi
set $tab 1>"/dev/null" 2>&1
if [ "$isMax" -eq 1 ]; then
freq="$1"
elif [ "$isMax" -eq -1 ]; then
freq="$(eval echo '$'{$#})"
else
# return the current GPU clock
read freq <"/sys/devices/platform/1c500000.mali/cur_freq"
fi
if [ -n "$freq" ]; then
echo "$freq"
return 0
else
return 1
fi
else
return 1
fi
}
function isMtkGpuFreqFixed()
{
if [ -r "/proc/gpufreq/gpufreq_opp_freq" ]; then
local x1 x2 x3 x4 x5
read x1 x2 x3 x4 x5 <"/proc/gpufreq/gpufreq_opp_freq"
if [ "$x5" = "enabled" ]; then
return 0
else
return 1
fi
elif [ -r "/proc/gpufreqv2/fix_target_opp_index" ]; then
local x1 x2 x3 x4 x5 x6
read x1 x2 x3 x4 x5 x6 <"/proc/gpufreqv2/fix_target_opp_index"
if [ "$x6" = "disabled" ]; then
return 1
else
return 0
fi
else
return 1
fi
}
function validGpuGovernor()
{
if [ $# -eq 2 -a -r "$1" ]; then
local lst
local gov="$2"
local i
lst="`cat <\"$1\"`"
for i in $lst; do
if [ "$i" = "$gov" ]; then
return 0
fi
done
return 1
else
return 1
fi
}
function getGpuBusmonPath()
{
local x
if [ -e "/sys/class/devfreq/soc:qcom,kgsl-busmon" ]; then
x="/sys/class/devfreq/soc:qcom,kgsl-busmon"
elif [ -e "/sys/class/devfreq/kgsl-busmon" ]; then
x="/sys/class/devfreq/kgsl-busmon"
else
x=""
fi
echo "$x"
return 0
}
function reduceGovernorJitter()
{
if [ $# -eq 2 ]; then
local flag="$1"
local printStatus="$2"
local x
if [ $flag -gt 0 ]; then
# CPU governor
# prevent CPU offline stuck by forcing online between double governor writing
local i st en
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
for i in `seq $st $en`; do
if [ -e "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor" ]; then
chmod 644 "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
echo 'performance' >"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
chmod 644 "/sys/devices/system/cpu/cpu$i/online"
echo '1' >"/sys/devices/system/cpu/cpu$i/online"
# Set the cpu max freq to the scaling_max_freq because some devices sometimes set it to be lower
read x <"/sys/devices/system/cpu/cpu$i/cpufreq/cpuinfo_max_freq"
chmod 644 "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
echo "$x" >"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
echo 'performance' >"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
fi
done
fi
# Support for the Nyx kernel and others; Disable a workqueue power efficient featute
if [ -e "/sys/module/workqueue/parameters/power_efficient" ]; then
chmod 644 "/sys/module/workqueue/parameters/power_efficient"
echo 'N' >"/sys/module/workqueue/parameters/power_efficient"
fi
# GPU's
if [ -w "/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor" ]; then
# For old Qcomm GPU's
echo 'performance' >"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor"
if [ -w "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" ]; then
# Set the min power level to be maximum
read x <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
if [ "$x" -ne 0 ]; then
echo "0" >"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
fi
fi
elif [ -w "/sys/class/kgsl/kgsl-3d0/devfreq/governor" ]; then
# For Qcomm GPU's
if validGpuGovernor "/sys/class/kgsl/kgsl-3d0/devfreq/available_governors" "performance"; then
# Check whether "performance" governor exists or not because some Qcomm recent GPU's don't have the governor
echo 'performance' >"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
sleep 0.1
fi
if [ -w "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq" ]; then
# Set the min freq
read x <"/sys/class/kgsl/kgsl-3d0/devfreq/max_freq"
if [ "$x" -ne 0 ]; then
echo "$x" >"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq"
fi
fi
if [ -w "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" ]; then
# Set the min power level to be maximum
read x <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
if [ "$x" -ne 0 ]; then
echo "0" >"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
fi
fi
if [ -w "/sys/class/kgsl/kgsl-3d0/default_pwrlevel" ]; then
# Set the default power level to be maximum
read x <"/sys/class/kgsl/kgsl-3d0/default_pwrlevel"
if [ "$x" -ne 0 ]; then
echo "0" >"/sys/class/kgsl/kgsl-3d0/default_pwrlevel"
fi
fi
# For some Qcomm GPU's, because they revert the governor after setting min_pwrlevel several times
if validGpuGovernor "/sys/class/kgsl/kgsl-3d0/devfreq/available_governors" "performance"; then
for i in `seq 1 9`; do
x="`echo \"scale=1;${i}/10\" | bc`"
sleep $x
read x <"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
if [ "$x" = "performance" ]; then
break
fi
echo 'performance' >"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
done
fi
if [ -w "/sys/class/kgsl/kgsl-3d0/throttling" ]; then
echo "0" >"/sys/class/kgsl/kgsl-3d0/throttling"
fi
if [ -w "/sys/class/devfreq/soc:qcom,gpubw/min_freq" ]; then
# Set the min freq
read x <"/sys/class/devfreq/soc:qcom,gpubw/max_freq"
if [ "$x" -ne 0 ]; then
echo "$x" >"/sys/class/devfreq/soc:qcom,gpubw/min_freq"
fi
fi
local busmon="`getGpuBusmonPath`"
if [ -w "${busmon}/min_freq" ]; then
# Set the min freq
read x <"${busmon}/max_freq"
if [ "$x" -ne 0 ]; then
echo "$x" >"${busmon}/min_freq"
fi
echo "performance" >"${busmon}/governor"
fi
elif [ -w "/proc/gpufreq/gpufreq_opp_freq" ]; then
# Maximum fixed frequency setting for MediaTek GPU's
local freq="`getMtkGpuFreqKhz \"max\"`"
if [ -n "$freq" ]; then
echo "$freq" >"/proc/gpufreq/gpufreq_opp_freq"
fi
elif [ -w "/proc/gpufreqv2/fix_target_opp_index" ]; then
# Maximum fixed frequency (index 0) setting for MediaTek GPU's
echo "0" >"/proc/gpufreqv2/fix_target_opp_index"
elif [ -w "/sys/devices/platform/1c500000.mali/hint_min_freq" ]; then
# Maximum fixed frequency setting for Tensor GPU's
# This makes audio quality poor really, so is avoided
local freq="`getTensorGpuFreqKhz \"max\"`"
if [ -n "$freq" ]; then
#echo "$freq" >"/sys/devices/platform/1c500000.mali/hint_min_freq"
:
fi
fi
elif [ $flag -lt 0 ]; then
# CPU's governor
local gov="`searchDefaultCpuGovernor`"
# prevent CPU offline stuck by forcing online between double governor writing
local i st en
IFS="-" read st en <"/sys/devices/system/cpu/present"
if [ -n "$st" -a -n "$en" -a "$st" -ge 0 -a "$en" -ge 0 ]; then
for i in `seq $st $en`; do
if [ -e "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor" ]; then
chmod 644 "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
echo "$gov" >"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
chmod 644 "/sys/devices/system/cpu/cpu$i/online"
echo '1' >"/sys/devices/system/cpu/cpu$i/online"
echo "$gov" >"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
fi
done
fi
# Support for the Nyx kernel and others; Revert a workqueue power efficient featute
if [ -e "/sys/module/workqueue/parameters/power_efficient" ]; then
chmod 644 "/sys/module/workqueue/parameters/power_efficient"
echo 'Y' >"/sys/module/workqueue/parameters/power_efficient"
fi
# GPU's
if [ -w "/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor" ]; then
# Default GPU governor for old Qcomm GPU's
if [ "`getprop ro.build.product`" = "jfltexx" -a "`getprop ro.system.build.version.release`" -ge "12" ]; then
echo 'performance' >"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor"
else
echo 'ondemand' >"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor"
fi
if [ -r "/sys/class/kgsl/kgsl-3d0/num_pwrlevels" -a -w "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" ]; then
# Set the min power level to be minimum
local x="4"
local tmp
read x <"/sys/class/kgsl/kgsl-3d0/num_pwrlevels"
x="`expr $x - 1`"
if [ -n "$x" ]; then
read tmp <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
if [ "$tmp" -ne "$x" ]; then
echo "$x" >"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
fi
fi
fi
elif [ -w "/sys/class/kgsl/kgsl-3d0/devfreq/governor" ]; then
local x
# Default GPU governor for Qcomm GPU's
echo 'msm-adreno-tz' >"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
sleep 0.1
if [ -r "/sys/class/kgsl/kgsl-3d0/num_pwrlevels" -a -w "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" ]; then
# Set the min power level to be minimum
x="6"
local tmp
read x <"/sys/class/kgsl/kgsl-3d0/num_pwrlevels"
x="`expr $x - 1`"
if [ -n "$x" ]; then
read tmp <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
if [ "$tmp" -ne "$x" ]; then
echo "$x" >"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
fi
fi
fi
if [ -r "/sys/class/kgsl/kgsl-3d0/min_pwrlevel" -a -w "/sys/class/kgsl/kgsl-3d0/default_pwrlevel" ]; then
read x <"/sys/class/kgsl/kgsl-3d0/min_pwrlevel"
if [ -n "$x" ]; then
echo "$x" >"/sys/class/kgsl/kgsl-3d0/default_pwrlevel"
fi
fi
if [ -w "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq" ]; then
# Set the min freq to the lowest
echo "0" >"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq"
fi
# For some Qcomm GPU's, because they revert the governor after setting min_pwrlevel several times
for i in `seq 1 9`; do
x="`echo \"scale=1;${i}/10\" | bc`"
sleep $x
read x <"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
if [ "$x" = "msm-adreno-tz" ]; then
break
fi
echo 'msm-adreno-tz' >"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
done
if [ -w "/sys/class/kgsl/kgsl-3d0/throttling" ]; then
echo "1" >"/sys/class/kgsl/kgsl-3d0/throttling"
fi
if [ -w "/sys/class/devfreq/soc:qcom,gpubw/min_freq" ]; then
echo "0" >"/sys/class/devfreq/soc:qcom,gpubw/min_freq"
fi
local busmon="`getGpuBusmonPath`"
if [ -w "${busmon}/min_freq" ]; then
# Set the min freq
echo "0" >"${busmon}/min_freq"
echo "gpubw_mon" >"${busmon}/governor"
fi
elif [ -w "/proc/gpufreq/gpufreq_opp_freq" ]; then
# Variable frequency setting for MediaTek GPU's
echo '0' >"/proc/gpufreq/gpufreq_opp_freq"
elif [ -w "/proc/gpufreqv2/fix_target_opp_index" ]; then
# Variable frequency (index -1) setting for MediaTek GPU's
echo "-1" >"/proc/gpufreqv2/fix_target_opp_index"
elif [ -w "/sys/devices/platform/1c500000.mali/hint_min_freq" ]; then
# Variable frequency setting for Tensor GPU's
local freq="`getTensorGpuFreqKhz \"min\"`"
if [ -n "$freq" ]; then
echo "$freq" >"/sys/devices/platform/1c500000.mali/hint_min_freq"
fi
fi
fi
if [ $printStatus -gt 0 ]; then
#CPU Governor
if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" ]; then
# Support for the Nyx kernel and others; Print the status of a workqueue power efficient featute
if [ -r "/sys/module/workqueue/parameters/power_efficient" ]; then
local pf
read pf <"/sys/module/workqueue/parameters/power_efficient"
if [ "$pf" = "Y" ]; then
pf="yes"
else
pf="no"
fi
echo " Gov. CPU: `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` (wq psave: $pf)"
else
echo " Gov. CPU: `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`"
fi
fi
if [ -r "/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor" ]; then
# For old Qcomm GPU Governor
local freq gov
read gov <"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor"
if [ "$gov" = "performance" ]; then
freq="`getQcomGpuFreq \"max\"`"
freq="`expr $freq / 1000000`MHz"
echo " Gov. GPU: performance (fixed: $freq)"
else
freq="`getQcomGpuFreq \"typical\"`"
freq="`expr $freq / 1000000`Mhz"
echo " Gov. GPU: $gov (typ.: $freq)"
fi
elif [ -w "/sys/class/kgsl/kgsl-3d0/devfreq/governor" ]; then
# For Qcomm GPU Governor
local freq gov def_pwrl
read gov <"/sys/class/kgsl/kgsl-3d0/devfreq/governor"
if [ -r "/sys/class/kgsl/kgsl-3d0/default_pwrlevel" ]; then
read def_pwrl <"/sys/class/kgsl/kgsl-3d0/default_pwrlevel"
else
def_pwrl="1"
fi
if [ "$gov" = "performance" -o "$def_pwrl" -eq 0 ]; then
freq="`getQcomGpuFreq \"max\"`"
freq="`expr $freq / 1000000`MHz"
echo " Gov. GPU: $gov (fixed: $freq)"
else
freq="`getQcomGpuFreq \"typical\"`"
freq="`expr $freq / 1000000`MHz"
echo " Gov. GPU: $gov (typ.: $freq)"
fi
elif [ -r "/proc/gpufreq/gpufreq_opp_freq" -o -r "/proc/gpufreqv2/gpu_working_opp_table" ]; then
# For getting MediaTek GPU settings
local freq
if isMtkGpuFreqFixed; then
freq="`getMtkGpuFreqKhz \"max\"`"
freq="`expr $freq / 1000`MHz"
echo " Gov. GPU: max freq (fixed: $freq)"
else
freq="`getMtkGpuFreqKhz \"typical\"`"
freq="`expr $freq / 1000`MHz"
echo " Gov. GPU: variable freq (typ.: $freq)"
fi
elif [ -r "/sys/devices/platform/1c500000.mali/cur_freq" ]; then
# Get the current Tensor GPU frequency
local freq="`getTensorGpuFreqKhz`"
if [ "$freq" = "`getTensorGpuFreqKhz \"max\"`" ]; then
freq="`expr $freq / 1000`MHz"
echo " Gov. GPU: max freq (fixed: $freq)"
else
freq="`expr $freq / 1000`MHz"
echo " Gov. GPU: variable freq (typ.: $freq)"
fi
fi
fi
else
return 1
fi
}
function reduceLogdJitter()
{
if [ $# -eq 2 ]; then
local flag="$1"
local printStatus="$2"
if [ $flag -gt 0 ]; then
# Stop the Logd servers
if [ "`getprop init.svc.logd`" = "running" ]; then
setprop ctl.stop logd
elif [ "`getprop init.svc.logd`" = "stopping" ]; then
local pid="`getprop init.svc_debug_pid.logd`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
if [ "`getprop init.svc.traced`" = "running
gitextract_2byr8jbn/
├── LICENSE
├── README.md
├── USB_SampleRate_Changer.sh
├── Usage_Samples/
│ ├── Bluetooth/
│ │ ├── change-bluetooth-hal_Status.sh
│ │ ├── change-bluetooth-hal_aosp.sh
│ │ ├── change-bluetooth-hal_legacy.sh
│ │ ├── change-bluetooth-hal_offload.sh
│ │ └── change-bluetooth-hal_sysbta.sh
│ ├── Dump/
│ │ ├── alsa-hw-params_all.sh
│ │ ├── alsa-hw-params_none.sh
│ │ ├── dumpsys-bluetooth-filtered_all.sh
│ │ ├── dumpsys-bluetooth-filtered_none.sh
│ │ ├── dumpsys-filtered_all.sh
│ │ ├── dumpsys-filtered_none.sh
│ │ ├── getConfig_all.sh
│ │ └── getConfig_none.sh
│ ├── Jitter/
│ │ ├── jitter-reducer_++all.sh
│ │ ├── jitter-reducer_++battery.sh
│ │ ├── jitter-reducer_++camera.sh
│ │ ├── jitter-reducer_++effect.sh
│ │ ├── jitter-reducer_++io.sh
│ │ ├── jitter-reducer_++wifi.sh
│ │ ├── jitter-reducer_--all.sh
│ │ ├── jitter-reducer_--battery.sh
│ │ ├── jitter-reducer_--boost-max.sh
│ │ ├── jitter-reducer_--camera.sh
│ │ ├── jitter-reducer_--effect.sh
│ │ ├── jitter-reducer_--io-boost.sh
│ │ ├── jitter-reducer_--most.sh
│ │ ├── jitter-reducer_--wifi.sh
│ │ └── jitter-reducer_Status.sh
│ ├── Resampling/
│ │ ├── change-resampling-quality_159dB_480_92.sh
│ │ ├── change-resampling-quality_165dB_360_104.sh
│ │ ├── change-resampling-quality_179dB_408_99.sh
│ │ ├── change-resampling-quality_194dB_520_100.sh
│ │ ├── change-resampling-quality_Reset.sh
│ │ ├── change-resampling-quality_Status.sh
│ │ ├── change-resampling-quality__Ultra-HiFi.sh
│ │ ├── change-resampling-quality_cheapies_44kHz.sh
│ │ ├── change-resampling-quality_cheapies_44kHz_cheapest.sh
│ │ ├── change-resampling-quality_cheapies_48kHz-cheapest.sh
│ │ ├── change-resampling-quality_cheapies_48kHz.sh
│ │ ├── change-resampling-quality_cheapies_96kHz.sh
│ │ ├── change-resampling-quality_mock-DAC-A.sh
│ │ ├── change-resampling-quality_mock-DAC-B.sh
│ │ ├── change-resampling-quality_mock-DAC-C.sh
│ │ └── change-resampling-quality_mock-Mastering.sh
│ ├── USB/
│ │ ├── USB_44k_32.sh
│ │ ├── USB_48k_16.sh
│ │ ├── USB_48k_24.sh
│ │ ├── USB_48k_24_offload-direct.sh
│ │ ├── USB_48k_24_offload-direct_drc.sh
│ │ ├── USB_48k_24_offload-hifi-playback.sh
│ │ ├── USB_48k_24_offload-hifi-playback_drc.sh
│ │ ├── USB_48k_32.sh
│ │ ├── USB_48k_32_bypass-offload.sh
│ │ ├── USB_48k_32_drc.sh
│ │ ├── USB_48k_32_offload-hifi-playback.sh
│ │ ├── USB_88k_32.sh
│ │ ├── USB_96k_24.sh
│ │ ├── USB_96k_32.sh
│ │ ├── USB_96k_32_bluetooth-qti.sh
│ │ ├── USB_96k_32_drc.sh
│ │ ├── USB_96k_32_legacy.sh
│ │ ├── USB_96k_32_offload-direct.sh
│ │ ├── USB_96k_32_offload-direct_drc.sh
│ │ ├── USB_96k_32_offload-safer.sh
│ │ ├── USB__176k_32.sh
│ │ ├── USB__192k_32.sh
│ │ ├── USB__192k_32_offload-safer.sh
│ │ ├── USB__353k_32.sh
│ │ ├── USB__353k_32_offload-direct.sh
│ │ ├── USB__384k_32.sh
│ │ ├── USB__384k_32_drc.sh
│ │ ├── USB__384k_32_offload-direct.sh
│ │ ├── USB__384k_32_offload-safer.sh
│ │ ├── USB__706k_32.sh
│ │ ├── USB__768k_32.sh
│ │ ├── USB__768k_32_drc.sh
│ │ ├── USB__Reset.sh
│ │ ├── USB__auto_max.sh
│ │ ├── USB__auto_max_drc.sh
│ │ └── USB__test_template.sh
│ └── USB Period/
│ ├── change-usb-period_2000.sh
│ ├── change-usb-period_20375.sh
│ ├── change-usb-period_2250.sh
│ ├── change-usb-period_2500.sh
│ ├── change-usb-period_2750.sh
│ ├── change-usb-period_4000.sh
│ ├── change-usb-period_Reset.sh
│ └── change-usb-period_Status.sh
├── changelog.md
├── extras/
│ ├── alsa-hw-params.sh
│ ├── change-bluetooth-hal.sh
│ ├── change-resampling-quality.sh
│ ├── change-usb-period.sh
│ ├── dumpsys-bluetooth-filtered.sh
│ ├── dumpsys-filtered.sh
│ ├── getConfig.sh
│ ├── jitter-reducer-functions.shlib
│ └── jitter-reducer.sh
├── functions3.shlib
└── templates/
├── Old/
│ ├── bypass_offload_safer_mtk_template.xml
│ ├── bypass_offload_safer_template.xml
│ ├── bypass_offload_template.xml
│ ├── legacy_template.xml
│ ├── offload_direct_template.xml
│ ├── offload_hifi_playback_template.xml
│ ├── offload_template.xml
│ ├── safe_template.xml
│ ├── safest_auto_template.xml
│ ├── safest_template.xml
│ └── usb_only_template.xml
├── bypass_offload_safer_amzm_template.xml
├── bypass_offload_safer_template.xml
├── bypass_offload_template.xml
├── offload_direct_template.xml
├── offload_hifi_playback_template.xml
├── offload_safer_template.xml
└── offload_template.xml
Condensed preview — 120 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (627K chars).
[
{
"path": "LICENSE",
"chars": 34523,
"preview": " GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C)"
},
{
"path": "README.md",
"chars": 25149,
"preview": "## USB (including a 3.5mm jack and an internal speaker) sample rate changer for Android devices on the fly\n\nThis is not "
},
{
"path": "USB_SampleRate_Changer.sh",
"chars": 17398,
"preview": "#!/system/bin/sh\n#\n# Version: 3.0.10\n# by zyhk\n\nMYDIR=\"${0%/*}\"\n\n# Check whether this script has been marked \"disabl"
},
{
"path": "Usage_Samples/Bluetooth/change-bluetooth-hal_Status.sh",
"chars": 110,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh --status\"\n"
},
{
"path": "Usage_Samples/Bluetooth/change-bluetooth-hal_aosp.sh",
"chars": 106,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh aosp\"\n"
},
{
"path": "Usage_Samples/Bluetooth/change-bluetooth-hal_legacy.sh",
"chars": 108,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh legacy\"\n"
},
{
"path": "Usage_Samples/Bluetooth/change-bluetooth-hal_offload.sh",
"chars": 109,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh offload\"\n"
},
{
"path": "Usage_Samples/Bluetooth/change-bluetooth-hal_sysbta.sh",
"chars": 108,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh sysbta\"\n"
},
{
"path": "Usage_Samples/Dump/alsa-hw-params_all.sh",
"chars": 101,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh --all\"\n"
},
{
"path": "Usage_Samples/Dump/alsa-hw-params_none.sh",
"chars": 95,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh\"\n"
},
{
"path": "Usage_Samples/Dump/dumpsys-bluetooth-filtered_all.sh",
"chars": 113,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh --all\"\n"
},
{
"path": "Usage_Samples/Dump/dumpsys-bluetooth-filtered_none.sh",
"chars": 107,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh\"\n"
},
{
"path": "Usage_Samples/Dump/dumpsys-filtered_all.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh --all\"\n"
},
{
"path": "Usage_Samples/Dump/dumpsys-filtered_none.sh",
"chars": 97,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh\"\n"
},
{
"path": "Usage_Samples/Dump/getConfig_all.sh",
"chars": 96,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/getConfig.sh --all\"\n"
},
{
"path": "Usage_Samples/Dump/getConfig_none.sh",
"chars": 90,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/getConfig.sh\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++all.sh",
"chars": 110,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++battery.sh",
"chars": 114,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++battery --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++camera.sh",
"chars": 113,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++camera --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++effect.sh",
"chars": 113,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++effect --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++io.sh",
"chars": 109,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++io --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_++wifi.sh",
"chars": 111,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++wifi --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--all.sh",
"chars": 110,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--battery.sh",
"chars": 114,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --battery --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--boost-max.sh",
"chars": 125,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --io '*' boost --sta"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--camera.sh",
"chars": 113,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --camera --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--effect.sh",
"chars": 113,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --effect --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--io-boost.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --io '*' boost --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--most.sh",
"chars": 153,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --wifi --logd --vm -"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_--wifi.sh",
"chars": 111,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --wifi --status\"\n"
},
{
"path": "Usage_Samples/Jitter/jitter-reducer_Status.sh",
"chars": 104,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --status\"\n"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_159dB_480_92.sh",
"chars": 529,
"preview": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a very mastering quality (for old devices)\n#\n# Characteristi"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_165dB_360_104.sh",
"chars": 360,
"preview": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a mastering quality (for low performance devices)\n#\n# Charac"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_179dB_408_99.sh",
"chars": 560,
"preview": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a very mastering quality (for devices except low performance o"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_194dB_520_100.sh",
"chars": 370,
"preview": "#!/system/bin/sh\n#\n# The ideal re-sampling (bit-perfect) only when 1:1 ratio frequency re-sampling and 32 bit depth\n#\n# "
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_Reset.sh",
"chars": 194,
"preview": "#!/system/bin/sh\n#\n# Reset and revert to the original system configuration for audio re-sampling\n\nMODDIR=${0%/*/*/*}\nsu "
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_Status.sh",
"chars": 115,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --status\"\n"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality__Ultra-HiFi.sh",
"chars": 542,
"preview": "#!/system/bin/sh\n#\n# Ultra Hi-Fi mastering quality re-sampling filter (for very high performance devices)\n#\n# Characte"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz.sh",
"chars": 725,
"preview": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion\n#\n# If you feel your LDA"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz_cheapest.sh",
"chars": 734,
"preview": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion\n#\n# If you feel your LDA"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz-cheapest.sh",
"chars": 807,
"preview": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 1"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz.sh",
"chars": 798,
"preview": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 1"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_96kHz.sh",
"chars": 769,
"preview": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 96 kHz & 2"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-A.sh",
"chars": 587,
"preview": "#!/system/bin/sh\n#\n# My mock AK4191EQ-ish in-DAC N-fold Over-sampling filer (sharp roll-off type) when larger than or eq"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-B.sh",
"chars": 514,
"preview": "#!/system/bin/sh\n#\n# My mock ES9039PRO-ish in-DAC N-fold Over-sampling filer (fast roll-off type)\n#\n# Characteristics:"
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-C.sh",
"chars": 664,
"preview": "#!/system/bin/sh\n#\n# My mock cheap in-DAC N-fold Over-sampling filer (fast roll-off type) of which quality level is set "
},
{
"path": "Usage_Samples/Resampling/change-resampling-quality_mock-Mastering.sh",
"chars": 502,
"preview": "#!/system/bin/sh\n#\n# My mock iZotope-ish mastering tool filer (no alias type)\n#\n# Characteristics: light in background"
},
{
"path": "Usage_Samples/USB/USB_44k_32.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 44k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB_48k_16.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 16\"\n"
},
{
"path": "Usage_Samples/USB/USB_48k_24.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 24\"\n"
},
{
"path": "Usage_Samples/USB/USB_48k_24_offload-direct.sh",
"chars": 135,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB_48k_24_offload-direct_drc.sh",
"chars": 141,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --of"
},
{
"path": "Usage_Samples/USB/USB_48k_24_offload-hifi-playback.sh",
"chars": 142,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB_48k_24_offload-hifi-playback_drc.sh",
"chars": 148,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --of"
},
{
"path": "Usage_Samples/USB/USB_48k_32.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB_48k_32_bypass-offload.sh",
"chars": 258,
"preview": "#!/system/bin/sh\n\n# Internal speakers: 48kHz & 32bit; USB HAL & Bluetooth HAL: automatically detecting the best samplera"
},
{
"path": "Usage_Samples/USB/USB_48k_32_drc.sh",
"chars": 124,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 48k "
},
{
"path": "Usage_Samples/USB/USB_48k_32_offload-hifi-playback.sh",
"chars": 276,
"preview": "#!/system/bin/sh\n\n# Internal speakers: 48kHz & 32bit; offload USB driver & Bluetooth HAL: automatically detecting the be"
},
{
"path": "Usage_Samples/USB/USB_88k_32.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 88k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB_96k_24.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 24\"\n"
},
{
"path": "Usage_Samples/USB/USB_96k_32.sh",
"chars": 118,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB_96k_32_bluetooth-qti.sh",
"chars": 140,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --force-bl"
},
{
"path": "Usage_Samples/USB/USB_96k_32_drc.sh",
"chars": 124,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 96k "
},
{
"path": "Usage_Samples/USB/USB_96k_32_legacy.sh",
"chars": 127,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --legacy 9"
},
{
"path": "Usage_Samples/USB/USB_96k_32_offload-direct.sh",
"chars": 135,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB_96k_32_offload-direct_drc.sh",
"chars": 141,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --of"
},
{
"path": "Usage_Samples/USB/USB_96k_32_offload-safer.sh",
"chars": 134,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB__176k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 176k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__192k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 192k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__192k_32_offload-safer.sh",
"chars": 135,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB__353k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 353k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__353k_32_offload-direct.sh",
"chars": 136,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB__384k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 384k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__384k_32_drc.sh",
"chars": 125,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 384k"
},
{
"path": "Usage_Samples/USB/USB__384k_32_offload-direct.sh",
"chars": 136,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB__384k_32_offload-safer.sh",
"chars": 135,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-"
},
{
"path": "Usage_Samples/USB/USB__706k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 706k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__768k_32.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 768k 32\"\n"
},
{
"path": "Usage_Samples/USB/USB__768k_32_drc.sh",
"chars": 125,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 768k"
},
{
"path": "Usage_Samples/USB/USB__Reset.sh",
"chars": 119,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --reset\"\n"
},
{
"path": "Usage_Samples/USB/USB__auto_max.sh",
"chars": 1365,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\n\ncase \"`getprop ro.board.platform`\" in\n gs* | zuma* )\n # for Tensor devic"
},
{
"path": "Usage_Samples/USB/USB__auto_max_drc.sh",
"chars": 1371,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\n\ncase \"`getprop ro.board.platform`\" in\n gs* | zuma* )\n # for Tensor devic"
},
{
"path": "Usage_Samples/USB/USB__test_template.sh",
"chars": 125,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --test 48k"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_2000.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2000\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_20375.sh",
"chars": 104,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 20375\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_2250.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2250\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_2500.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2500\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_2750.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2750\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_4000.sh",
"chars": 103,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 4000\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_Reset.sh",
"chars": 106,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --reset\"\n"
},
{
"path": "Usage_Samples/USB Period/change-usb-period_Status.sh",
"chars": 107,
"preview": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --status\"\n"
},
{
"path": "changelog.md",
"chars": 14724,
"preview": "## Change logs\n\n# v3.0.10\n* Added \"--offload-safer\" mode (primary sample rate is fixed at 48 kHz & 32bit, but USB one va"
},
{
"path": "extras/alsa-hw-params.sh",
"chars": 963,
"preview": "#!/system/bin/sh\n\nrst=\"closed\"\nfile=\"/proc/asound/card1/pcm0p/sub0/hw_params\"\nif [ -r \"$file\" ]; then\n # For non-hard"
},
{
"path": "extras/change-bluetooth-hal.sh",
"chars": 7291,
"preview": "#!/system/bin/sh\n\nfunction usage()\n{\n echo \"Usage: ${0##*/} [--help] [--status] [ aosp | legacy | offload | sysbta ]\""
},
{
"path": "extras/change-resampling-quality.sh",
"chars": 10357,
"preview": "#!/system/bin/sh\n\n# Items Stop_Band_Attenuation Half_Filter_Length Cu"
},
{
"path": "extras/change-usb-period.sh",
"chars": 4860,
"preview": "#!/system/bin/sh\n\nperiod_us=2250\n\nresetFlag=0\n\nfunction usage()\n{\n echo \"Usage: ${0##*/} [--help] [--status] [--reset"
},
{
"path": "extras/dumpsys-bluetooth-filtered.sh",
"chars": 850,
"preview": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n case \"$1\" in\n \"-a\" | \"--all\" )\n allFlag=1\n "
},
{
"path": "extras/dumpsys-filtered.sh",
"chars": 2003,
"preview": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n case \"$1\" in\n \"-a\" | \"--all\" )\n allFlag=1\n "
},
{
"path": "extras/getConfig.sh",
"chars": 1748,
"preview": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n case \"$1\" in\n \"-a\" | \"--all\" )\n allFlag=1\n "
},
{
"path": "extras/jitter-reducer-functions.shlib",
"chars": 96421,
"preview": "#!/system/bin/sh\n\nfunction forceOnlineCPUs()\n{\n local i st en\n IFS=\"-\" read st en <\"/sys/devices/system/cpu/presen"
},
{
"path": "extras/jitter-reducer.sh",
"chars": 7762,
"preview": "#!/system/bin/sh\n#\n# Version: 2.6.0\n# by zyhk\n\nMYDIR=\"${0%/*}\"\n\n# Check whether this script has been marked \"disable"
},
{
"path": "functions3.shlib",
"chars": 7933,
"preview": "#!/system/bin/sh\n#\n\nMYDIR=${0%/*}\n\n# Forcing to reload audioservers\nfunction reloadAudioServers() \n{\n # wait for syst"
},
{
"path": "templates/Old/bypass_offload_safer_mtk_template.xml",
"chars": 16168,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/bypass_offload_safer_template.xml",
"chars": 16182,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/bypass_offload_template.xml",
"chars": 20359,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/legacy_template.xml",
"chars": 14003,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2016 The Android Open Source Project\n Lic"
},
{
"path": "templates/Old/offload_direct_template.xml",
"chars": 28061,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/offload_hifi_playback_template.xml",
"chars": 20479,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/offload_template.xml",
"chars": 20928,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights r"
},
{
"path": "templates/Old/safe_template.xml",
"chars": 19576,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\n\n Li"
},
{
"path": "templates/Old/safest_auto_template.xml",
"chars": 17694,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\n\n Li"
},
{
"path": "templates/Old/safest_template.xml",
"chars": 17949,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\n\n Li"
},
{
"path": "templates/Old/usb_only_template.xml",
"chars": 2750,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\n\n Licensed under the "
},
{
"path": "templates/bypass_offload_safer_amzm_template.xml",
"chars": 19136,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/bypass_offload_safer_template.xml",
"chars": 19138,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/bypass_offload_template.xml",
"chars": 18950,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/offload_direct_template.xml",
"chars": 27418,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/offload_hifi_playback_template.xml",
"chars": 19100,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/offload_safer_template.xml",
"chars": 19188,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
},
{
"path": "templates/offload_template.xml",
"chars": 18965,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\n Lic"
}
]
About this extraction
This page contains the full source code of the yzyhk904/USB_SampleRate_Changer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 120 files (574.3 KB), approximately 143.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.