snapshot
This commit is contained in:
14
libraries/audio-tools/.github/FUNDING.yml
vendored
Normal file
14
libraries/audio-tools/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
polar: # Replace with a single Polar username
|
||||||
|
buy_me_a_coffee: philschatzh
|
||||||
|
custom: ['https://www.paypal.com/paypalme/pschatzmann?country.x=CH&locale.x=en_US']
|
||||||
58
libraries/audio-tools/.github/ISSUE_TEMPLATE/Issue-report.yml
vendored
Normal file
58
libraries/audio-tools/.github/ISSUE_TEMPLATE/Issue-report.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
name: Bug report
|
||||||
|
description: Report only a bugs here!
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
* Before reporting a new bug please check and search the [list of existing issues](https://github.com/pschatzmann/arduino-audio-tools/issues?q=)
|
||||||
|
* Please check [the Readme](https://github.com/pschatzmann/arduino-audio-tools) and [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki)
|
||||||
|
* Don't forget to check [the discusions](https://github.com/pschatzmann/arduino-audio-tools/discussions)
|
||||||
|
* If still experiencing the issue, please provide as many details as possible below about your hardware, computer setup and code.
|
||||||
|
- type: textarea
|
||||||
|
id: Description
|
||||||
|
attributes:
|
||||||
|
label: Problem Description
|
||||||
|
description: Please describe your problem here and expected behaviour
|
||||||
|
placeholder: ex. Can't connect/weird behaviour/wrong function/missing parameter..
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: Board
|
||||||
|
attributes:
|
||||||
|
label: Device Description
|
||||||
|
description: What development board are you using
|
||||||
|
placeholder: e.g. ESP32 Wroom, Desktop Build, RP2040
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: sketch
|
||||||
|
attributes:
|
||||||
|
label: Sketch
|
||||||
|
description: Please provide full minimal sketch/code which can be run to reproduce your issue
|
||||||
|
placeholder: ex. Related part of the code to replicate the issue
|
||||||
|
render: cpp
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: other-remarks
|
||||||
|
attributes:
|
||||||
|
label: Other Steps to Reproduce
|
||||||
|
description: Is there any other information you can think of which will help us reproduce this problem? Any additional info can be added as well.
|
||||||
|
placeholder: ex. I also tried on other OS, HW...it works correctly on that setup.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: sceanario
|
||||||
|
attributes:
|
||||||
|
label: What is your development environment (incl. core version info)
|
||||||
|
description: Please provide the information about your development/runtime environment
|
||||||
|
placeholder: Arduino ESP 2.0.14, IDF 5.3.2, STM32-Cube MX, PlatformIO ESP32 6.10.0, JupyterLab, Desktop Build
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: confirmation
|
||||||
|
attributes:
|
||||||
|
label: I have checked existing issues, discussions and online documentation (incl. the Wiki)
|
||||||
|
description: You agree to check all the resources above before opening a new issue.
|
||||||
|
options:
|
||||||
|
- label: I confirm I have checked existing issues, discussions and online documentation
|
||||||
|
required: true
|
||||||
1
libraries/audio-tools/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
libraries/audio-tools/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
17
libraries/audio-tools/.github/workflows/doxygen-gh-pages.yml
vendored
Normal file
17
libraries/audio-tools/.github/workflows/doxygen-gh-pages.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: Doxygen GitHub Pages Deploy Action
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: DenverCoder1/doxygen-github-pages-action@v1.2.0
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
folder: docs/html
|
||||||
|
branch: doxygen
|
||||||
|
|
||||||
7
libraries/audio-tools/.gitignore
vendored
Normal file
7
libraries/audio-tools/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
docs/html/
|
||||||
|
build/
|
||||||
|
.vscode/
|
||||||
|
_deps/
|
||||||
|
.ipynb_checkpoints/
|
||||||
|
.DS_Store
|
||||||
|
miniaudio.h
|
||||||
3
libraries/audio-tools/.gitmodules
vendored
Normal file
3
libraries/audio-tools/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "tests-cmake/build/ArduinoCore-API"]
|
||||||
|
path = tests-cmake/build/ArduinoCore-API
|
||||||
|
url = https://github.com/arduino/ArduinoCore-API.git
|
||||||
63
libraries/audio-tools/CMakeLists.txt
Normal file
63
libraries/audio-tools/CMakeLists.txt
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
if (DEFINED ESP_PLATFORM)
|
||||||
|
|
||||||
|
# idf component
|
||||||
|
idf_component_register(
|
||||||
|
# SRC_DIRS src
|
||||||
|
INCLUDE_DIRS src
|
||||||
|
REQUIRES bt esp_common freertos hal log nvs_flash driver esp_adc esp_http_client
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(${COMPONENT_LIB} INTERFACE -DESP32_CMAKE=1 -Wno-error -Wno-format -fpermissive)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
# set the project name
|
||||||
|
project(arduino-audio-tools)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
|
||||||
|
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
add_library(arduino-audio-tools INTERFACE)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||||
|
option(ADD_PORTAUDIO "Add Portaudio Library" OFF)
|
||||||
|
option(ADD_ARDUINO_EMULATOR "Add Arduino Emulator Library" ON)
|
||||||
|
|
||||||
|
|
||||||
|
# make include directory available to calling projects
|
||||||
|
target_include_directories (arduino-audio-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# installation of all header files
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" # source directory
|
||||||
|
DESTINATION "include/arduino-audio-tools" # target directory
|
||||||
|
FILES_MATCHING # install only matched files
|
||||||
|
PATTERN "*.h" # select header files
|
||||||
|
)
|
||||||
|
|
||||||
|
if (ADD_PORTAUDIO)
|
||||||
|
# Add Portaduio for desktop build
|
||||||
|
FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG v19.7.0 )
|
||||||
|
FetchContent_GetProperties(portaudio)
|
||||||
|
if(NOT portaudio_POPULATED)
|
||||||
|
FetchContent_Populate(portaudio)
|
||||||
|
add_subdirectory(${portaudio_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/portaudio)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (ADD_ARDUINO_EMULATOR)
|
||||||
|
# Build with Linux Arduino Emulator
|
||||||
|
FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
|
||||||
|
FetchContent_GetProperties(arduino_emulator)
|
||||||
|
if(NOT arduino_emulator_POPULATED)
|
||||||
|
FetchContent_Populate(arduino_emulator)
|
||||||
|
add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
2619
libraries/audio-tools/Doxyfile
Normal file
2619
libraries/audio-tools/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
216
libraries/audio-tools/License.txt
Normal file
216
libraries/audio-tools/License.txt
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
Copyright © 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 General Public License is a free, copyleft license for software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is 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. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
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 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. Use with the GNU Affero General Public License.
|
||||||
|
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 Affero 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 special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU 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 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 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 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 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||||
|
|
||||||
|
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 GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
140
libraries/audio-tools/README.md
Normal file
140
libraries/audio-tools/README.md
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# Arduino Audio Tools
|
||||||
|
|
||||||
|
Some basic __header-only C++ classes__ that can be used for __Audio Processing__ provided as __Arduino and cmake C++ Library__:
|
||||||
|
|
||||||
|
- We provide different ["Audio Sources" and "Audio Sinks"](https://github.com/pschatzmann/arduino-audio-tools/wiki/Audio-Sources-and-Sinks)
|
||||||
|
- Support for different [Encoders](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_encoder.html) and [Decoders](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_decoder.html) for MP3, AAC, WAV, FLAC, etc for [EncodedAudioStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_encoded_audio_stream.html)
|
||||||
|
- Integrates with different [DSP libraries](https://github.com/pschatzmann/arduino-audio-tools/wiki/DSP-Libraries)
|
||||||
|
- Helps to [communicate](https://github.com/pschatzmann/arduino-audio-tools/wiki/Communication) audio over the wire or wirelessly
|
||||||
|
- Different [Sound Generators](https://pschatzmann.github.io/arduino-audio-tools/group__generator.html) (e.g. to generate a sine tone) for [GeneratedSoundStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_generated_sound_stream.html)
|
||||||
|
- Support for [Sound Effects](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect_stream.html) with different [Effect Implementations](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect.html) (e.g. Boost, Distortion, Echo, Reverb...) for [AudioEffectStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_effect_stream_t.html)
|
||||||
|
- Provides a [3 Band Equalizer](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_equalizer3_bands.html)
|
||||||
|
- Different [Converters](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_base_converter.html) for [ConverterStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_converter_stream.html)
|
||||||
|
- Different [Filters](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_filter.html) for [FilteredStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_filtered_stream.html)
|
||||||
|
- [Musical Notes](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_musical_notes.html) (with frequencies of notes)
|
||||||
|
- Different [Buffer Implementations](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_base_buffer.html) for [QueueStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_queue_stream.html)
|
||||||
|
- A [Repeating Timer](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_timer_alarm_repeating.html) (e.g. for sampling audio data using exact times) for [TimerCallbackAudioStream](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_timer_callback_audio_stream.html)
|
||||||
|
- Desktop Integration: Building of Arduino Audio Sketches to be run on [Linux, Windows and OS/X](https://github.com/pschatzmann/arduino-audio-tools/wiki/Running-an-Audio-Sketch-on-the-Desktop)
|
||||||
|
|
||||||
|
This functionality provides the glue which makes different audio processing components and [libraries](https://github.com/pschatzmann/arduino-audio-tools/wiki/Optional-Libraries) work together.
|
||||||
|
|
||||||
|
We also provide [plenty of examples](https://github.com/pschatzmann/arduino-audio-tools/wiki/Examples) that demonstrate how to implement the different scenarios. The __design philosophy__ is based on the Arduino conventions: we use the ```begin()``` and ```end()``` methods to start and stop the processing and we propagate the __use of Streams__.
|
||||||
|
|
||||||
|
We all know the Arduino [Print](https://www.arduino.cc/reference/en/language/functions/communication/print/) and [Stream](https://www.arduino.cc/reference/en/language/functions/communication/stream) classes: We usually use them to write out print messages and sometimes we use them to read the output from Serial, Files, Ethernet, etc. The same thing applies to “Audio Streams”: You can read audio data from [“Audio Sources” and you write them to “Audio Sinks”](https://github.com/pschatzmann/arduino-audio-tools/wiki/Audio-Sources-and-Sinks).
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Here is a simple example which streams a file from the Flash Memory and writes it to I2S:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "StarWars30.h"
|
||||||
|
|
||||||
|
uint8_t channels = 2;
|
||||||
|
uint16_t sample_rate = 22050;
|
||||||
|
uint8_t bits_per_sample = 16;
|
||||||
|
|
||||||
|
MemoryStream music(StarWars30_raw, StarWars30_raw_len);
|
||||||
|
I2SStream i2s; // Output to I2S
|
||||||
|
StreamCopy copier(i2s, music); // copies sound into i2s
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
auto config = i2s.defaultConfig(TX_MODE);
|
||||||
|
config.sample_rate = sample_rate;
|
||||||
|
config.channels = channels;
|
||||||
|
config.bits_per_sample = bits_per_sample;
|
||||||
|
i2s.begin(config);
|
||||||
|
|
||||||
|
music.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
Each stream has it's own [configuration object](https://pschatzmann.github.io/arduino-audio-tools/structaudio__tools_1_1_audio_info.html) that should be passed to the begin method. The defaultConfig() method is providing a default proposal which will usually "just work". Please consult
|
||||||
|
the [class documentation](https://pschatzmann.github.io/arduino-audio-tools/modules.html) for the available configuration parameters. You can also __easily adapt__ any provided examples: If you e.g. replace the I2SStream with the AnalogAudioStream class, you will get analog instead of digital output.
|
||||||
|
|
||||||
|
I suggest you continue to read the more [detailed introduction](https://github.com/pschatzmann/arduino-audio-tools/wiki/Introduction).
|
||||||
|
|
||||||
|
Further examples can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Examples).
|
||||||
|
|
||||||
|
Dependent on the example you might need to install some [additional libaries](https://github.com/pschatzmann/arduino-audio-tools/wiki/Optional-Libraries)
|
||||||
|
|
||||||
|
### AudioPlayer
|
||||||
|
|
||||||
|
The library also provides a versatile [AudioPlayer](https://pschatzmann.github.io/arduino-audio-tools/classaudio__tools_1_1_audio_player.html). Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/The-Audio-Player-Class)
|
||||||
|
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
|
||||||
|
The application uses a built in logger: By default we use the log level warning and the logging output is going to Serial. You can change this in your sketch by calling e.g:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Debug);
|
||||||
|
```
|
||||||
|
You can log to any object that is a subclass of Print and valid log level values are: Debug, Info, Warning, Error.
|
||||||
|
|
||||||
|
|
||||||
|
You can also deactivate the logging by changing USE_AUDIO_LOGGING to false in the AudioConfig.h to decrease the memory usage:
|
||||||
|
|
||||||
|
```C++
|
||||||
|
#define USE_AUDIO_LOGGING false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Show and Tell
|
||||||
|
|
||||||
|
Get some inspiration [from projects that were using this library](https://github.com/pschatzmann/arduino-audio-tools/discussions/categories/show-and-tell) or share your projects with the community.
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Please use this before you raise any issue or start a discussion!
|
||||||
|
|
||||||
|
- Read the [Tutorial & Documentation in the Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki)
|
||||||
|
- Have a look at the [Examples](https://github.com/pschatzmann/arduino-audio-tools/wiki/Examples)
|
||||||
|
- Check the [Class Documentation by Topic](https://pschatzmann.github.io/arduino-audio-tools/topics.html).
|
||||||
|
- Find your class in [All Classes Alphabetically](https://pschatzmann.github.io/arduino-audio-tools/namespaceaudio__tools.html)
|
||||||
|
- You also might find further information in [one of my Blogs](https://www.pschatzmann.ch/home/category/machine-sound/)
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
I spent a lot of time to provide a comprehensive and complete documentation.
|
||||||
|
So please read the documentation first and check the issues and discussions before posting any new ones on Github.
|
||||||
|
|
||||||
|
Open __issues only for bugs__ and if it is not a bug, use a discussion: Provide enough information about
|
||||||
|
- the selected scenario/sketch
|
||||||
|
- what exactly you are trying to do
|
||||||
|
- your hardware
|
||||||
|
- your software version (from the Boards Manager) and library versions
|
||||||
|
- what exactly your problem is
|
||||||
|
|
||||||
|
to enable others to understand and reproduce your issue.
|
||||||
|
|
||||||
|
Finally, __don't__ send me any e-mails or post questions on my personal website!
|
||||||
|
|
||||||
|
Please note that discussions and issues which have already been answered before or where the answer can be found in the documentation may get deleted w/o reply.
|
||||||
|
|
||||||
|
## Installation in Arduino
|
||||||
|
|
||||||
|
You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ~/Documents/Arduino/libraries
|
||||||
|
git clone https://github.com/pschatzmann/arduino-audio-tools.git
|
||||||
|
```
|
||||||
|
|
||||||
|
I recommend to use git because you can easily update to the latest version just by executing the ```git pull``` command in the project folder.
|
||||||
|
If you want to use the library on other patforms, you can find [further information in the Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki).
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsor Me
|
||||||
|
|
||||||
|
This software is totally free, but you can make me happy by rewarding me with a treat
|
||||||
|
|
||||||
|
- [Buy me a coffee](https://www.buymeacoffee.com/philschatzh)
|
||||||
|
- [Paypal me](https://paypal.me/pschatzmann?country.x=CH&locale.x=en_US)
|
||||||
4
libraries/audio-tools/component.mk
Normal file
4
libraries/audio-tools/component.mk
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#
|
||||||
|
# "main" pseudo-component makefile.
|
||||||
|
#
|
||||||
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
37
libraries/audio-tools/docs/ext/Printable.h
Normal file
37
libraries/audio-tools/docs/ext/Printable.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2016 Arduino LLC. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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 Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
class Print;
|
||||||
|
|
||||||
|
/** The Printable class provides a way for new classes to allow themselves to be printed.
|
||||||
|
By deriving from Printable and implementing the printTo method, it will then be possible
|
||||||
|
for users to print out instances of this class by passing them into the usual
|
||||||
|
Print::print and Print::println methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Printable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual size_t printTo(Print& p) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
6
libraries/audio-tools/docs/index.html
Normal file
6
libraries/audio-tools/docs/index.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0; URL=https://pschatzmann.github.io/arduino-audio-tools/modules.html" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>If you are not redirected, <a href="https://pschatzmann.github.io/arduino-audio-tools/modules.html">click here</a>.</p>
|
||||||
|
</body>
|
||||||
2
libraries/audio-tools/examples/README.md
Normal file
2
libraries/audio-tools/examples/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
see [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Examples)
|
||||||
154
libraries/audio-tools/examples/README_ESP32.md
Normal file
154
libraries/audio-tools/examples/README_ESP32.md
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
# ESP32 Configuration
|
||||||
|
|
||||||
|
If you are using ESP32 by Espressif Systems version 3.0.0 and later, audio tools will use the new adc_continuous API.
|
||||||
|
|
||||||
|
For the adc_continuous API, audio tools provides the following options:
|
||||||
|
|
||||||
|
- **sample_rate** (per channel), the effective ADC sampling rate is the number of channels x sample rate and can be:
|
||||||
|
- ESP32: 20kHz to 2MHz
|
||||||
|
- ESP32 S2, S3, H2, C6, C3: 611Hz to 83.333kHz
|
||||||
|
|
||||||
|
for example:
|
||||||
|
|
||||||
|
- 306
|
||||||
|
- 4,000
|
||||||
|
- 5,000
|
||||||
|
- 8,000
|
||||||
|
- 10,000
|
||||||
|
- 11,025
|
||||||
|
- 16,000
|
||||||
|
- 20,000
|
||||||
|
- 22,050
|
||||||
|
- 40,000
|
||||||
|
- 44,100
|
||||||
|
- 48,000
|
||||||
|
- 88,200
|
||||||
|
- 96,000
|
||||||
|
- 176,400
|
||||||
|
- 192,200
|
||||||
|
- 352,800
|
||||||
|
- 384,000
|
||||||
|
- 500,000
|
||||||
|
- 1,000,000
|
||||||
|
|
||||||
|
- **adc_bit_with**
|
||||||
|
- 9, 10, 11, 12 depending on ESP32 model
|
||||||
|
- audio stream is int16_t
|
||||||
|
- **adc_calibration_active**: values measured are in mV
|
||||||
|
- **is_auto_center_read**: subtraction of current estimated average from samples
|
||||||
|
- **adc_attenuation**:
|
||||||
|
|
||||||
|
| attenuation | range | accurate range |
|
||||||
|
| ------------ | --------| -------------- |
|
||||||
|
| ADC_ATTEN_DB_0 | 0..1.1V | 100-950mV |
|
||||||
|
| ADC_ATTEN_DB_2_5| 0..1.5V | 100-1250mV |
|
||||||
|
| ADC_ATTEN_DB_6 | 0..2.2V | 150-1750mV |
|
||||||
|
| ADC_ATTEN_DB_12 | 0..3.9V | 150-2450mV |
|
||||||
|
|
||||||
|
- **channels**:
|
||||||
|
- mono = 1
|
||||||
|
- stereo = 2
|
||||||
|
- **adc_channels**: defining the channels (only channels on ADC unit 1 are supported) e.g.:
|
||||||
|
- A3 on Sparkfun ESP32 Thing Plus is ADC_CHANNEL_3
|
||||||
|
- A4 on Sparkfun ESP32 Thing Plus is ADC_CHANNEL_0
|
||||||
|
- D5 on Adafruit ESP32-S3 is ADC_CHANNEL_4
|
||||||
|
- D6 on Adafruit ESP32-S3 is ADC_CHANNEL_5
|
||||||
|
|
||||||
|
- **buffer_size**
|
||||||
|
- maximum is 2048
|
||||||
|
- minimum is number of channels
|
||||||
|
- number needs to be divisible by number of channels
|
||||||
|
- care must be taken because some streams in audio tools can not exceed 1024 bytes
|
||||||
|
|
||||||
|
## Example Configuration
|
||||||
|
```
|
||||||
|
auto adcConfig = adc.defaultConfig(RX_MODE);
|
||||||
|
adcConfig.sample_rate = 44100;
|
||||||
|
adcConfig.adc_bit_width = 12;
|
||||||
|
adcConfig.adc_calibration_active = true;
|
||||||
|
adcConfig.is_auto_center_read = false;
|
||||||
|
adcConfig.adc_attenuation = ADC_ATTEN_DB_12;
|
||||||
|
adcConfig.channels = 2;
|
||||||
|
adcConfig.adc_channels[0] = ADC_CHANNEL_4;
|
||||||
|
adcConfig.adc_channels[1] = ADC_CHANNEL_5;
|
||||||
|
```
|
||||||
|
|
||||||
|
## ADC unit 1 channels on common ESP32 boards
|
||||||
|
Audio tools continuous ADC framework supports ADC Unit 1 only.
|
||||||
|
|
||||||
|
### Sparkfun ESP32 Thing Plus (ESP32)
|
||||||
|
- A2, ADC1_CH6
|
||||||
|
- A3, ADC1_CH3
|
||||||
|
- A4, ADC1_CH0
|
||||||
|
- 32, ADC1_CH4
|
||||||
|
- 33, ADC1_CH5
|
||||||
|
|
||||||
|
### Sparkfun ESP32 Thing Plus C (ESP32)
|
||||||
|
- A2, ADC1_CH6
|
||||||
|
- A3, ADC1_CH3
|
||||||
|
- A4, ADC1_CH0
|
||||||
|
- A5, ADC1_CH7
|
||||||
|
- 32/6, ADC1_CH4
|
||||||
|
- 33/10, ADC1_CH5
|
||||||
|
|
||||||
|
### Sparkfun ESP32 Qwiic Pocket Development (ESP32C6)
|
||||||
|
- 2, ADC1_CH2
|
||||||
|
- 3, ADC1_CH3
|
||||||
|
- 4, ADC1_CH4
|
||||||
|
- 5, ADC1_CH5
|
||||||
|
|
||||||
|
### ESP32-C6-DevKit
|
||||||
|
- 4, ADC1_CH4
|
||||||
|
- 5, ADC1_CH5
|
||||||
|
- 6, ADC1_CH6
|
||||||
|
- 7, ADC1_CH0
|
||||||
|
- 0, ADC1_CH1
|
||||||
|
- 2, ADC1_CH2
|
||||||
|
- 3, ADC1_CH3
|
||||||
|
|
||||||
|
### ESP32-H2-DevKit
|
||||||
|
- 1, ADC1_CH0
|
||||||
|
- 2, ADC1_CH1
|
||||||
|
- 3, ADC1_CH2
|
||||||
|
- 4, ADC1_CH3
|
||||||
|
- 5, ADC1_CH4
|
||||||
|
|
||||||
|
### ESP32-S3-DevKit
|
||||||
|
- 1, ADC1_CH0
|
||||||
|
- 2, ADC1_CH1
|
||||||
|
- 4, ADC1_CH3
|
||||||
|
- 5, ADC1_CH4
|
||||||
|
- 6, ADC1_CH5
|
||||||
|
- 7, ADC1_CH6
|
||||||
|
- 8, ADC1_CH7
|
||||||
|
- 3, ADC1_CH2
|
||||||
|
- 9, ADC1_CH8
|
||||||
|
- 10, ADC1_CH9
|
||||||
|
|
||||||
|
### ESP32-C3-DevKit
|
||||||
|
- 4, IO2, ADC1_CH2
|
||||||
|
- 5, IO3, ADC1_CH3
|
||||||
|
- 9, IO0, ADC1_CH0
|
||||||
|
- 10, IO1, ADC1_CH1
|
||||||
|
- 11, IO4, ADC1_CH4
|
||||||
|
|
||||||
|
### Adafruit ESP32 Feather V2
|
||||||
|
- D32, ADC1_CH4
|
||||||
|
- D33, ADC1_CH5
|
||||||
|
- A2, ADC1_CH6
|
||||||
|
- A3, ADC1_CH3
|
||||||
|
- A4, ADC1_CH0
|
||||||
|
- D37, ADC1_CH1
|
||||||
|
|
||||||
|
### Adafruit ESP32-S3 Feather
|
||||||
|
- D5, ADC1_CH4
|
||||||
|
- D6, ADC1_CH5
|
||||||
|
- D9, ADC1_CH8
|
||||||
|
- D10, ADC1_CH9
|
||||||
|
- A5, ADC1_CH7
|
||||||
|
|
||||||
|
### Adafruit QT Py ESP32-C3
|
||||||
|
- A0, ADC1-CH4
|
||||||
|
- A1, ADC1-CH3
|
||||||
|
- A2, ADC1-CH1
|
||||||
|
- A3, ADC1-CH0
|
||||||
18
libraries/audio-tools/examples/build-arch-log.txt
Normal file
18
libraries/audio-tools/examples/build-arch-log.txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
esp32:esp32:esp32 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32c3 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32c5 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32c6 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32s2 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32s3 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32h2 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp32:esp32:esp32p4 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
esp8266:esp8266:generic ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
rp2040:rp2040:generic ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:avr:nano ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:samd:arduino_zero_native ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:renesas_uno:unor4wifi ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:mbed_nano:nano33ble ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:mbed_rp2040:pico ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:mbed_giga:giga ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
arduino:zephyr:nano33ble ./examples-stream/streams-generator-serial -> rc=0
|
||||||
|
STMicroelectronics:stm32:GenF4 ./examples-stream/streams-generator-serial -> rc=0
|
||||||
41
libraries/audio-tools/examples/build-arch.sh
Executable file
41
libraries/audio-tools/examples/build-arch.sh
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
##
|
||||||
|
# We compile an example for different architectures using arduino-cli in order to identify compile errors
|
||||||
|
# The return codes are made available in the build-examples-log.txt file.
|
||||||
|
# -> rc=0: success
|
||||||
|
# -> rc=1: error
|
||||||
|
##
|
||||||
|
git -C .. pull
|
||||||
|
git -C ../../ESP32-A2DP pull
|
||||||
|
|
||||||
|
function compile_example {
|
||||||
|
ARCH=$1
|
||||||
|
FILE="./examples-stream/streams-generator-serial"
|
||||||
|
# take action on each file. $f store current file name
|
||||||
|
arduino-cli compile -b "$ARCH" "$FILE"
|
||||||
|
EC=$?
|
||||||
|
echo -e "$ARCH $FILE -> rc=$EC" >> "build-arch-log.txt"
|
||||||
|
}
|
||||||
|
|
||||||
|
rm build-arch-log.txt
|
||||||
|
compile_example "esp32:esp32:esp32"
|
||||||
|
compile_example "esp32:esp32:esp32c3"
|
||||||
|
compile_example "esp32:esp32:esp32c5"
|
||||||
|
compile_example "esp32:esp32:esp32c6"
|
||||||
|
compile_example "esp32:esp32:esp32s2"
|
||||||
|
compile_example "esp32:esp32:esp32s3"
|
||||||
|
compile_example "esp32:esp32:esp32h2"
|
||||||
|
compile_example "esp32:esp32:esp32p4"
|
||||||
|
compile_example "esp8266:esp8266:generic"
|
||||||
|
compile_example "rp2040:rp2040:generic"
|
||||||
|
compile_example "arduino:avr:nano"
|
||||||
|
compile_example "arduino:samd:arduino_zero_native"
|
||||||
|
compile_example "arduino:renesas_uno:unor4wifi"
|
||||||
|
compile_example "arduino:mbed_nano:nano33ble"
|
||||||
|
compile_example "arduino:mbed_rp2040:pico"
|
||||||
|
compile_example "arduino:mbed_giga:giga"
|
||||||
|
compile_example "arduino:zephyr:nano33ble"
|
||||||
|
compile_example "STMicroelectronics:stm32:GenF4"
|
||||||
|
|
||||||
|
./cleanup.sh
|
||||||
|
|
||||||
353
libraries/audio-tools/examples/build-examples-log.txt
Normal file
353
libraries/audio-tools/examples/build-examples-log.txt
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
../examples/examples-basic-api/base-adc-average-mono-serial -> rc=0
|
||||||
|
../examples/examples-basic-api/base-adc-measure -> rc=0
|
||||||
|
../examples/examples-basic-api/base-adc-serial -> rc=0
|
||||||
|
../examples/examples-basic-api/base-file_raw-serial -> rc=0
|
||||||
|
../examples/examples-basic-api/base-SynchronizedBufferRTOS -> rc=0
|
||||||
|
../examples/examples-player/player-callback-i2s -> rc=0
|
||||||
|
../examples/examples-player/player-ftp-audiokit -> rc=0
|
||||||
|
../examples/examples-player/player-littlefs-i2s -> rc=0
|
||||||
|
../examples/examples-player/player-sd-audiokit -> rc=0
|
||||||
|
../examples/examples-player/player-sdfat-analog -> rc=0
|
||||||
|
../examples/examples-player/player-sdfat-audiokit -> rc=0
|
||||||
|
../examples/examples-player/player-sdfat-ffti2s -> rc=0
|
||||||
|
../examples/examples-player/player-sdfat-i2s -> rc=0
|
||||||
|
../examples/examples-player/player-sd-i2s -> rc=0
|
||||||
|
../examples/examples-player/player-sd_m4a-audiokit -> rc=0
|
||||||
|
../examples/examples-player/player-sdmmc-audiokit -> rc=0
|
||||||
|
../examples/examples-player/player-spiffs-i2s -> rc=0
|
||||||
|
../examples/examples-player/player-vector_sdfat-audiokit -> rc=0
|
||||||
|
../examples/examples-stream/streams-adc-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-adc-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-adsr-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-analog -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-bin-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-formatconverter-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator_fromarray-analog -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-merge-pwm -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-pwm -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-r2r -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-spdif -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-timedstream-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-volume -> rc=0
|
||||||
|
../examples/examples-stream/streams-generator-wm8960 -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-filter-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-i2s-2 -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s_pdm-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-serial_16bit -> rc=0
|
||||||
|
../examples/examples-stream/streams-i2s-tf -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_mp3-analog -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_mp3-metadata -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_mp3-pwm -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_mp3_short-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_mp3_short-i2s-2 -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_raw-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_wav-pwm -> rc=0
|
||||||
|
../examples/examples-stream/streams-memory_wav-serial -> rc=0
|
||||||
|
../examples/examples-stream/streams-mp34dt05-serial -> rc=1
|
||||||
|
../examples/examples-stream/streams-sdfat_mp3-metadata -> rc=0
|
||||||
|
../examples/examples-stream/streams-sd_mp3-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-sd_wav4-i2s -> rc=0
|
||||||
|
../examples/examples-stream/streams-tf-i2s -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-effects-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-fft -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-fft-led -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-filter-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-goertzel -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-multioutput -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-multioutput-server -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-ram-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-ram-ptichshift-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-sd-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-sd_wav -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-serial -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-audiokit-tf -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-file_loop-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-generator-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-generator_fromarray-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-generator_inputmixer-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-generator_outputmixer-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-generator_sinfromtable-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-memory_mp3-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-memory_pcm-mixer-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-pins-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-rtttl-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-sd_flac-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-sd_m4a-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-sdmmc_wav-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-sd_mp3-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-synth-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-synthbasic1-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-synthbasic2-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-synthbasic3-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-synthstk-audiokit -> rc=0
|
||||||
|
../examples/examples-audiokit/streams-tf-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-azure_tts-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-espeak-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-espeak-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-flite-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-flite-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-google-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-sam-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-sam-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-simple_tts-a2dp -> rc=0
|
||||||
|
../examples/examples-tts/streams-simple_tts-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-talkie-a2dp -> rc=0
|
||||||
|
../examples/examples-tts/streams-talkie-audiokit -> rc=0
|
||||||
|
../examples/examples-tts/streams-tts-i2s -> rc=0
|
||||||
|
../examples/examples-tts/streams-url_wav-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/01-TestTone -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/02-TwoTones -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/03-AM1 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/04-AM2 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/05-FM1 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/06-FM2 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/07-Counting1 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/08-Counting2 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/08-Counting3 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/08-Counting4 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/09-Envelopes -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/10-Filters -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/11-Mixing -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/12-SamplePlayer -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/13-AdvancedFilters -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/14-MonoSynth -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/15-PolySynth -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/16-Replicant -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/17-Compressor -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/18-DrumMachine -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/19-Enveloping2 -> rc=0
|
||||||
|
../examples/examples-dsp/examples-maximilian/20-FFT -> rc=0
|
||||||
|
../examples/examples-dsp/examples-mozzi/audio_input -> rc=0
|
||||||
|
../examples/examples-dsp/examples-mozzi/control_gain -> rc=0
|
||||||
|
../examples/examples-dsp/examples-mozzi/control_gain-a2dp -> rc=0
|
||||||
|
../examples/examples-dsp/examples-pd/streams-generator-pd-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-pd/streams-pd-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_allinstruments-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk-desktop -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_files-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_generator-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_loop-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_myinstrument-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_sine-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-stk/streams-stk_synth-audiokit -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-faust_flute-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-faust_noise-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-generator-faust-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-i2s-faust_copy-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-i2s-faust_guitarix-i2s -> rc=0
|
||||||
|
../examples/examples-dsp/examples-faust/streams-i2s-faust_pitchshift-i2s -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-eq-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-fft -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-fft-led -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-i2s -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-a2dp-mixer-i2s -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-adc-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-audiokit-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-file_mp3-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-generator-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-i2s-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/basic-player-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/player-sd_a2dp-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/player-sdfat-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-a2dp-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-a2dp-serial -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-a2dp-spdif -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-generator-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-i2s-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/a2dp/streams-synth-a2dp -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/codec/communication-codec-espnow-receive -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/codec/communication-codec-espnow-receive_measure -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/codec/communication-codec-espnow-send -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/pcm/communication-espnow-receive -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/pcm/communication-espnow-receive_csv -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/pcm/communication-espnow-receive_measure -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/pcm/communication-espnow-send -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/speed-test/communication-espnow-receive_measure -> rc=0
|
||||||
|
../examples/examples-communication/esp-now/speed-test/communication-espnow-send -> rc=0
|
||||||
|
../examples/examples-communication/ip/communication-ip-receive -> rc=0
|
||||||
|
../examples/examples-communication/ip/communication-ip-receive_measure -> rc=0
|
||||||
|
../examples/examples-communication/ip/communication-ip-send -> rc=0
|
||||||
|
../examples/examples-communication/udp/communication-udp-receive -> rc=0
|
||||||
|
../examples/examples-communication/udp/communication-udp-send -> rc=0
|
||||||
|
../examples/examples-communication/vban/player-sdmmc-vban -> rc=0
|
||||||
|
../examples/examples-communication/vban/streams-audiokit-vban -> rc=0
|
||||||
|
../examples/examples-communication/vban/streams-generator-vban -> rc=0
|
||||||
|
../examples/examples-communication/vban/streams-vban-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-audiokit-rtsp -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-codec-rtsp -> rc=1
|
||||||
|
../examples/examples-communication/rtsp/communication-generator-rtsp -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-player_mp3-rtsp -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-player_mp3-rtsp_adcpm -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-rtsp555-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-rtsp555-i2s -> rc=0
|
||||||
|
../examples/examples-communication/rtsp/communication-rtsp-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/serial/mp3 -> rc=1
|
||||||
|
../examples/examples-communication/serial/mp3-custom -> rc=1
|
||||||
|
../examples/examples-communication/serial/mp3-xon-xoff -> rc=1
|
||||||
|
../examples/examples-communication/serial/send-8bit-receive -> rc=0
|
||||||
|
../examples/examples-communication/serial/send-adpcm_framed-receive -> rc=0
|
||||||
|
../examples/examples-communication/serial/send-adpcm-receive -> rc=0
|
||||||
|
../examples/examples-communication/serial/send-receive -> rc=0
|
||||||
|
../examples/examples-communication/snapcast/snapclient-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/player-url-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/player-url_icy-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/http-client/player-url_icy-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/player-url_subclass-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-eth_url_mp3_helix-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-http_post -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_aac-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_aac-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url-file -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_flac_foxen-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_flac-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url-measuring -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3-analog -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3-audiokit -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3_helix-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3_helix-i2s_32bit -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3_mad-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3-metadata -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3-metadata2 -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mp3-pwm -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_mts-hex -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_post -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_raw-i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_raw-serial -> rc=0
|
||||||
|
../examples/examples-communication/http-client/streams-url_vorbis_i2s -> rc=0
|
||||||
|
../examples/examples-communication/http-server/player-sd-webserverex_mp3 -> rc=0
|
||||||
|
../examples/examples-communication/http-server/python-post-server -> rc=1
|
||||||
|
../examples/examples-communication/http-server/streams-audiokit-webserver_aac -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-audiokit-webserver_mp3 -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-audiokit-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-effect-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-flite-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserver_aac -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserverex_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserverex_wav1 -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserver_mp3 -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserver_ogg -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-generator-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-i2s-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-sam-webserver_wav -> rc=0
|
||||||
|
../examples/examples-communication/http-server/streams-tts-webserver_wav -> rc=0
|
||||||
|
../examples/tests/adc/read-csv -> rc=0
|
||||||
|
../examples/tests/adc/read-csv_unsigned -> rc=0
|
||||||
|
../examples/tests/adc/read-esp32-multi-channel-csv -> rc=0
|
||||||
|
../examples/tests/adc/read-speed -> rc=0
|
||||||
|
../examples/tests/basic/24bits-write -> rc=0
|
||||||
|
../examples/tests/basic/test-allocator -> rc=0
|
||||||
|
../examples/tests/basic/test-buffer -> rc=0
|
||||||
|
../examples/tests/basic/test-buffered-stream -> rc=0
|
||||||
|
../examples/tests/basic/test-queue -> rc=0
|
||||||
|
../examples/tests/basic/test-vector -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-aac-fdk -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-aac-fdk-dec -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-adpcm -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-adpcm-xq -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-alac -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-aptx -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-base64 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-codec2 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-flac -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g711_alaw -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g711_ulaw -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g721 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g722 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g723_24 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-g723_40 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-gsm -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-iLBC -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-l8 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-lc3 -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-opus -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-opusogg -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-sbc -> rc=0
|
||||||
|
../examples/tests/codecs/test-codec-wav-adpcm -> rc=0
|
||||||
|
../examples/tests/codecs/test-compile-all -> rc=0
|
||||||
|
../examples/tests/codecs/test-container-binary -> rc=0
|
||||||
|
../examples/tests/codecs/test-container-binary-meta -> rc=0
|
||||||
|
../examples/tests/codecs/test-container-ogg -> rc=0
|
||||||
|
../examples/tests/codecs/test-memory-helix -> rc=0
|
||||||
|
../examples/tests/codecs/test-mp3-helix -> rc=0
|
||||||
|
../examples/tests/codecs/test-mp3-helix-reading -> rc=0
|
||||||
|
../examples/tests/codecs/test-mp3-mad -> rc=0
|
||||||
|
../examples/tests/codecs/test-mp3_parser -> rc=0
|
||||||
|
../examples/tests/codecs/test-streaming-adapter -> rc=0
|
||||||
|
../examples/tests/concurrency/audio-test -> rc=0
|
||||||
|
../examples/tests/concurrency/BufferRTOS -> rc=0
|
||||||
|
../examples/tests/concurrency/NBuffer -> rc=0
|
||||||
|
../examples/tests/concurrency/synchNBuffer -> rc=0
|
||||||
|
../examples/tests/concurrency/synchRingBuffer -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-avg -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-bin -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-bindiff -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-decimate -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-diff -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-increase-in -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-increase-out -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-reduce-in -> rc=0
|
||||||
|
../examples/tests/conversion/channel-converter-reduce-out -> rc=0
|
||||||
|
../examples/tests/conversion/format-converter-in -> rc=0
|
||||||
|
../examples/tests/conversion/numberformat-converter -> rc=0
|
||||||
|
../examples/tests/conversion/numberformat-converter-typed -> rc=0
|
||||||
|
../examples/tests/conversion/pipeline-in -> rc=0
|
||||||
|
../examples/tests/conversion/pipeline-out -> rc=0
|
||||||
|
../examples/tests/conversion/resample-mixer-in -> rc=0
|
||||||
|
../examples/tests/conversion/test-panning -> rc=0
|
||||||
|
../examples/tests/conversion/test-resample-in -> rc=0
|
||||||
|
../examples/tests/conversion/test-resample-out -> rc=0
|
||||||
|
../examples/tests/conversion/test-volumestream -> rc=0
|
||||||
|
../examples/tests/effects/delay-in -> rc=0
|
||||||
|
../examples/tests/effects/delay-out -> rc=0
|
||||||
|
../examples/tests/effects/pitch-shift -> rc=0
|
||||||
|
../examples/tests/effects/pitch-shift-180 -> rc=0
|
||||||
|
../examples/tests/effects/pitch-shift-simple -> rc=0
|
||||||
|
../examples/tests/etc/callback-write -> rc=0
|
||||||
|
../examples/tests/etc/test-mulit-compilation-units -> rc=0
|
||||||
|
../examples/tests/etc/test-pins -> rc=0
|
||||||
|
../examples/tests/etc/test-ringbufferfile -> rc=0
|
||||||
|
../examples/tests/etc/test-tdm -> rc=0
|
||||||
|
../examples/tests/etc/test-write-memory -> rc=0
|
||||||
|
../examples/tests/fft/fft-cmsis -> rc=1
|
||||||
|
../examples/tests/fft/fft-esp32 -> rc=0
|
||||||
|
../examples/tests/fft/fft-espressif -> rc=0
|
||||||
|
../examples/tests/fft/fft-ifft -> rc=0
|
||||||
|
../examples/tests/fft/fft-kiss -> rc=0
|
||||||
|
../examples/tests/fft/fft-real -> rc=0
|
||||||
|
../examples/tests/fft/fft-topn -> rc=0
|
||||||
|
../examples/tests/fft/fft-window -> rc=0
|
||||||
|
../examples/tests/filters/test-90deg -> rc=0
|
||||||
|
../examples/tests/filters/test-filter -> rc=0
|
||||||
|
../examples/tests/filters/test-lowpass -> rc=0
|
||||||
|
../examples/tests/filters/test-median-filter -> rc=0
|
||||||
|
../examples/tests/performance/file-speeds-sd -> rc=0
|
||||||
|
../examples/tests/performance/file-speeds-sdfat -> rc=0
|
||||||
|
../examples/tests/performance/file-speeds-sdmmc -> rc=0
|
||||||
|
../examples/tests/performance/file-speeds-vfssd -> rc=0
|
||||||
|
../examples/tests/performance/file-speeds-vfssdmmc -> rc=0
|
||||||
|
../examples/tests/performance/mp3-Speed -> rc=0
|
||||||
|
../examples/tests/performance/mp3-SynchronizedBufferRTOS -> rc=0
|
||||||
|
../examples/tests/performance/mp3-SynchronizedNBuffer -> rc=0
|
||||||
|
../examples/tests/performance/mp3-SynchronizedRingBuffer -> rc=0
|
||||||
|
../examples/tests/performance/sine -> rc=0
|
||||||
|
../examples/tests/performance/throttle -> rc=0
|
||||||
|
../examples/tests/performance/wifi -> rc=0
|
||||||
|
../examples/tests/player/test-array-source -> rc=0
|
||||||
|
../examples/tests/player/test-index-sd -> rc=0
|
||||||
|
../examples/tests/player/test-index-sdfat -> rc=0
|
||||||
|
../examples/tests/player/test-index-sdmmc -> rc=0
|
||||||
|
../examples/tests/player/test-player -> rc=0
|
||||||
|
../examples/tests/player/test-vector-source -> rc=0
|
||||||
|
../examples/tests/player/test-vfs -> rc=0
|
||||||
|
../examples/tests/timer/test-timer -> rc=0
|
||||||
|
../examples/tests/timer/test-timercb_rx -> rc=0
|
||||||
|
../examples/tests/timer/test-timercb_tx -> rc=0
|
||||||
|
../examples/tests/timer/test-timercbx_rx -> rc=0
|
||||||
|
../examples/tests/timer/test-timercbx_tx -> rc=0
|
||||||
76
libraries/audio-tools/examples/build-examples.sh
Executable file
76
libraries/audio-tools/examples/build-examples.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
##
|
||||||
|
# We compile all examples using arduino-cli in order to identify compile errors
|
||||||
|
# The return codes are made available in the build-examples-log.txt file.
|
||||||
|
# -> rc=0: success
|
||||||
|
# -> rc=1: error
|
||||||
|
##
|
||||||
|
#arduino-cli lib upgrade
|
||||||
|
#arduino-cli lib linstall
|
||||||
|
git -C .. pull
|
||||||
|
git -C ../../ESP32-A2DP pull
|
||||||
|
git -C ../../arduino-audio-driver pull
|
||||||
|
git -C ../../arduino-libhelix pull
|
||||||
|
|
||||||
|
function compile_example {
|
||||||
|
ARCH=$1
|
||||||
|
FILES=$2
|
||||||
|
for f in $FILES
|
||||||
|
do
|
||||||
|
# Skip README.md files
|
||||||
|
if [[ $(basename "$f") == "README.md" ]]; then
|
||||||
|
echo "Skipping README.md file: $f"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Processing $f ..."
|
||||||
|
# take action on each file. $f store current file name
|
||||||
|
#arduino-cli compile -b "$ARCH" "$f"
|
||||||
|
arduino-cli compile -b "$ARCH" --build-property "build.partitions=rainmaker" --build-property "upload.maximum_size=3145728" "$f"
|
||||||
|
EC=$?
|
||||||
|
#if [ $EC -ne 0 ]; then
|
||||||
|
#break
|
||||||
|
echo -e "$f -> rc=$EC" >> "build-examples-log.txt"
|
||||||
|
#fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
rm build-examples-log.txt
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-basic-api/base*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-player/player*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-stream/streams*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-audiokit/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-tts/streams*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-dsp/examples-maximilian/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-dsp/examples-mozzi/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-dsp/examples-pd/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-dsp/examples-stk/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-dsp/examples-faust/streams*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/a2dp/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/codec/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/pcm/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/speed-test/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/ip/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/udp/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/vban/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/rtsp/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/serial/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/snapcast/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/http-client/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/examples-communication/http-server/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/adc/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/basic/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/codecs/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/concurrency/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/conversion/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/effects/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/etc/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/fft/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/filters/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/performance/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/player/*"
|
||||||
|
compile_example "esp32:esp32:esp32" "../examples/tests/timer/*"
|
||||||
|
rm -rf /tmp/arduino
|
||||||
|
|
||||||
|
./cleanup.sh
|
||||||
4
libraries/audio-tools/examples/cleanup.sh
Executable file
4
libraries/audio-tools/examples/cleanup.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
find . -name debug_custom.json -delete
|
||||||
|
find . -name debug.cfg -delete
|
||||||
|
find . -name esp32.svd -delete
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# AudioKit
|
||||||
|
Please read the [Audio Boards Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Audio-Boards) first.
|
||||||
|
|
||||||
|
These sketches work on the AI Thinker AudioKit, the LyraT or any other board that is supported by the [arduino-audio-driver](https://github.com/pschatzmann/arduino-audio-driver) library.
|
||||||
|
|
||||||
|
If you want to use them on any other board, you just pass the corresponding board variable in the constructor or you compose your own board. Further information can be found in [this Wiki](https://github.com/pschatzmann/arduino-audio-driver/wiki).
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# Stream Input from an AudioKit to AudioKit Output
|
||||||
|
|
||||||
|
## General Description:
|
||||||
|
|
||||||
|
We implement a AudioKit source and sink: We stream the sound input which we read in from the I2S interface and write it back via I2S to the Speaker
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-audiokit/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||||
|
StreamCopy copier(kit, kit); // copy kit to kit
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
/**
|
||||||
|
* @file audiokit-effects-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Some Guitar Effects that can be controlled via a Web Gui.
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-10-14
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <ArduinoJson.h> // https://arduinojson.org/
|
||||||
|
#include "HttpServer.h" // https://github.com/pschatzmann/TinyHttp
|
||||||
|
#include "AudioTools.h" // https://github.com/pschatzmann/arduino-audio-tools.git
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h" // https://github.com/pschatzmann/arduino-audio-driver.git
|
||||||
|
|
||||||
|
// Server
|
||||||
|
WiFiServer wifi;
|
||||||
|
HttpServer server(wifi);
|
||||||
|
const char *ssid = "SSID";
|
||||||
|
const char *password = "PASSWORD";
|
||||||
|
|
||||||
|
// Audio Format
|
||||||
|
const int sample_rate = 44100;
|
||||||
|
const int channels = 1;
|
||||||
|
const int bits_per_sample = 16;
|
||||||
|
|
||||||
|
// Effects control input
|
||||||
|
float volumeControl = 0.1;
|
||||||
|
int16_t clipThreashold = 0;
|
||||||
|
float fuzzEffectValue = 0;
|
||||||
|
int16_t fuzzMaxValue = 0;
|
||||||
|
int16_t tremoloDuration = 0;
|
||||||
|
float tremoloDepth = 0;
|
||||||
|
|
||||||
|
// Effects
|
||||||
|
Boost boost(volumeControl);
|
||||||
|
Distortion distortion(clipThreashold);
|
||||||
|
Fuzz fuzz(fuzzEffectValue);
|
||||||
|
Tremolo tremolo(tremoloDuration, tremoloDepth, sample_rate);
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||||
|
AudioEffectStream effects(kit); // input from kit
|
||||||
|
StreamCopy copier(kit, effects); // copy effects to kit
|
||||||
|
|
||||||
|
// Update values in effects
|
||||||
|
void updateValues(){
|
||||||
|
// update values in controls
|
||||||
|
boost.setVolume(volumeControl);
|
||||||
|
boost.setActive(volumeControl>0);
|
||||||
|
distortion.setClipThreashold(clipThreashold);
|
||||||
|
distortion.setActive(clipThreashold>0);
|
||||||
|
fuzz.setFuzzEffectValue(fuzzEffectValue);
|
||||||
|
fuzz.setMaxOut(fuzzMaxValue);
|
||||||
|
fuzz.setActive(fuzzEffectValue>0);
|
||||||
|
tremolo.setDepth(tremoloDepth);
|
||||||
|
tremolo.setDuration(tremoloDuration);
|
||||||
|
tremolo.setActive(tremoloDuration>0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// provide JSON as webservice
|
||||||
|
void getJson(HttpServer * server, const char*requestPath, HttpRequestHandlerLine * hl) {
|
||||||
|
auto parameters2Json = [](Stream & out) {
|
||||||
|
DynamicJsonDocument doc(1024);
|
||||||
|
doc["volumeControl"]["value"] = volumeControl;
|
||||||
|
doc["volumeControl"]["min"] = 0;
|
||||||
|
doc["volumeControl"]["max"] = 1;
|
||||||
|
doc["volumeControl"]["step"] = 0.1;
|
||||||
|
doc["clipThreashold"]["value"] = clipThreashold;
|
||||||
|
doc["clipThreashold"]["min"] = 0;
|
||||||
|
doc["clipThreashold"]["max"] = 6000;
|
||||||
|
doc["clipThreashold"]["step"] = 100;
|
||||||
|
doc["fuzzEffectValue"]["value"] = fuzzEffectValue;
|
||||||
|
doc["fuzzEffectValue"]["min"] = 0;
|
||||||
|
doc["fuzzEffectValue"]["max"] = 10;
|
||||||
|
doc["fuzzEffectValue"]["step"] = 0.1;
|
||||||
|
doc["fuzzMaxValue"]["value"] = fuzzMaxValue;
|
||||||
|
doc["fuzzMaxValue"]["min"] = 0;
|
||||||
|
doc["fuzzMaxValue"]["max"] = 32200;
|
||||||
|
doc["fuzzMaxValue"]["step"] = 1;
|
||||||
|
doc["tremoloDuration"]["value"] = tremoloDuration;
|
||||||
|
doc["tremoloDuration"]["min"] = 0;
|
||||||
|
doc["tremoloDuration"]["max"] = 2000;
|
||||||
|
doc["tremoloDuration"]["step"] = 1;
|
||||||
|
doc["tremoloDepth"]["value"] = tremoloDepth;
|
||||||
|
doc["tremoloDepth"]["min"] = 0;
|
||||||
|
doc["tremoloDepth"]["max"] = 100;
|
||||||
|
doc["tremoloDepth"]["step"] = 1;
|
||||||
|
serializeJson(doc, out);
|
||||||
|
};
|
||||||
|
|
||||||
|
// provide data as json using callback
|
||||||
|
server->reply("text/json", parameters2Json, 200);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Poroces Posted Json
|
||||||
|
void postJson(HttpServer *server, const char*requestPath, HttpRequestHandlerLine *hl) {
|
||||||
|
// post json to server
|
||||||
|
DynamicJsonDocument doc(1024);
|
||||||
|
deserializeJson(doc, server->client());
|
||||||
|
volumeControl = doc["volumeControl"];
|
||||||
|
clipThreashold = doc["clipThreashold"];
|
||||||
|
fuzzEffectValue = doc["fuzzEffectValue"];
|
||||||
|
fuzzMaxValue = doc["fuzzMaxValue"];
|
||||||
|
tremoloDuration = doc["tremoloDuration"];
|
||||||
|
tremoloDepth = doc["tremoloDepth"];
|
||||||
|
|
||||||
|
// update values in controls
|
||||||
|
updateValues();
|
||||||
|
|
||||||
|
server->reply("text/json", "{}", 200);
|
||||||
|
char msg[120];
|
||||||
|
snprintf(msg, 120, "====> updated values %f %d %f %d %d %f", volumeControl, clipThreashold, fuzzEffectValue, tremoloDuration, tremoloDepth);
|
||||||
|
Serial.println(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// Setup Server
|
||||||
|
static HttpTunnel tunnel_url("https://pschatzmann.github.io/TinyHttp/app/guitar-effects.html");
|
||||||
|
server.on("/", T_GET, tunnel_url);
|
||||||
|
server.on("/service", T_GET, getJson);
|
||||||
|
server.on("/service", T_POST, postJson);
|
||||||
|
server.begin(80, ssid, password);
|
||||||
|
server.setNoConnectDelay(0);
|
||||||
|
|
||||||
|
// Setup Kit
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
cfg.sample_rate = sample_rate;
|
||||||
|
cfg.channels = channels;
|
||||||
|
// minimize lag
|
||||||
|
cfg.buffer_count = 2;
|
||||||
|
cfg.buffer_size = 256;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
// setup effects
|
||||||
|
effects.addEffect(boost);
|
||||||
|
effects.addEffect(distortion);
|
||||||
|
effects.addEffect(fuzz);
|
||||||
|
effects.addEffect(tremolo);
|
||||||
|
effects.begin(cfg);
|
||||||
|
|
||||||
|
updateValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
server.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-fft-led.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We peform FFT on the microphone input of the AudioKit and display the
|
||||||
|
* result on a 32*8 LED matrix
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-10-14
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <FastLED.h> // to prevent conflicts introduced with 3.9
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or AudioKissFFT
|
||||||
|
#include "AudioTools/AudioLibs/LEDOutput.h"
|
||||||
|
|
||||||
|
#define PIN_LEDS 22
|
||||||
|
#define LED_X 32
|
||||||
|
#define LED_Y 8
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||||
|
AudioRealFFT fft; // or AudioKissFFT
|
||||||
|
FFTDisplay fft_dis(fft);
|
||||||
|
LEDOutput led(fft_dis); // output to LED matrix
|
||||||
|
StreamCopy copier(fft, kit); // copy mic to fft
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup Audiokit as input device
|
||||||
|
auto cfg = kit.defaultConfig(RX_MODE);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// Setup FFT output
|
||||||
|
auto tcfg = fft.defaultConfig();
|
||||||
|
tcfg.length = 1024;
|
||||||
|
tcfg.copyFrom(cfg);
|
||||||
|
fft.begin(tcfg);
|
||||||
|
|
||||||
|
// Setup FFT Display
|
||||||
|
fft_dis.fft_group_bin = 3;
|
||||||
|
fft_dis.fft_start_bin = 0;
|
||||||
|
fft_dis.fft_max_magnitude = 40000;
|
||||||
|
fft_dis.begin();
|
||||||
|
|
||||||
|
// Setup LED matrix output
|
||||||
|
auto lcfg = led.defaultConfig();
|
||||||
|
lcfg.x = LED_X;
|
||||||
|
lcfg.y = LED_Y;
|
||||||
|
led.begin(lcfg);
|
||||||
|
|
||||||
|
// add LEDs
|
||||||
|
FastLED.addLeds<WS2812B, PIN_LEDS, GRB>(led.ledData(), led.ledCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// update FFT
|
||||||
|
copier.copy();
|
||||||
|
// update LEDs
|
||||||
|
led.update();
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
## FFT
|
||||||
|
|
||||||
|
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies
|
||||||
|
|
||||||
|
The fast Fourier transform (FFT) can be used to determine the frequencies of a singal. More [details can be found in the Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/FFT)
|
||||||
|
|
||||||
|
### Note
|
||||||
|
|
||||||
|
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or AudioKissFFT
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||||
|
AudioRealFFT fft; // or AudioKissFFT
|
||||||
|
StreamCopy copier(fft, kit); // copy mic to tfl
|
||||||
|
int channels = 2;
|
||||||
|
int samples_per_second = 44100;
|
||||||
|
int bits_per_sample = 16;
|
||||||
|
float value=0;
|
||||||
|
|
||||||
|
// display fft result
|
||||||
|
void fftResult(AudioFFTBase &fft){
|
||||||
|
float diff;
|
||||||
|
auto result = fft.result();
|
||||||
|
if (result.magnitude>100){
|
||||||
|
Serial.print(result.frequency);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(result.magnitude);
|
||||||
|
Serial.print(" => ");
|
||||||
|
Serial.print(result.frequencyAsNote(diff));
|
||||||
|
Serial.print( " diff: ");
|
||||||
|
Serial.println(diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup Audiokit
|
||||||
|
auto cfg = kit.defaultConfig(RX_MODE);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
cfg.channels = channels;
|
||||||
|
cfg.sample_rate = samples_per_second;
|
||||||
|
cfg.bits_per_sample = bits_per_sample;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// Setup FFT
|
||||||
|
auto tcfg = fft.defaultConfig();
|
||||||
|
tcfg.length = 8192;
|
||||||
|
tcfg.channels = channels;
|
||||||
|
tcfg.sample_rate = samples_per_second;
|
||||||
|
tcfg.bits_per_sample = bits_per_sample;
|
||||||
|
tcfg.callback = &fftResult;
|
||||||
|
fft.begin(tcfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-kit-filter-kit.ino
|
||||||
|
* @brief Copy audio from I2S to I2S using an FIR filter
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
|
||||||
|
// copy filtered values
|
||||||
|
FilteredStream<int16_t, float> filtered(kit, info.channels); // Defiles the filter as BaseConverter
|
||||||
|
StreamCopy copier(filtered, kit); // copies sound into i2s (both from kit to filtered or filered to kit are supported)
|
||||||
|
|
||||||
|
// define FIR filter
|
||||||
|
float coef[] = { 0.021, 0.096, 0.146, 0.096, 0.021};
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
// change to Warning to improve the quality
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup filters for all available channels
|
||||||
|
filtered.setFilter(0, new FIR<float>(coef));
|
||||||
|
filtered.setFilter(1, new FIR<float>(coef));
|
||||||
|
|
||||||
|
// start I2S in
|
||||||
|
Serial.println("starting KIT...");
|
||||||
|
auto config = kit.defaultConfig(RXTX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
config.sd_active = false;
|
||||||
|
config.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(config);
|
||||||
|
|
||||||
|
Serial.println("KIT started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// Example for DTMF detection using Goertzel algorithm
|
||||||
|
// Uses AudioKit and I2S microphones as input
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16); // 8kHz, mono, 16 bits
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||||
|
//CsvOutput<int16_t> out(Serial, 1);
|
||||||
|
GoertzelStream goertzel; //(out);
|
||||||
|
StreamCopy copier(goertzel, kit); // copy kit to georzel
|
||||||
|
|
||||||
|
// represent DTMF keys
|
||||||
|
class DTMF {
|
||||||
|
public:
|
||||||
|
enum Dimension { Row, Col };
|
||||||
|
DTMF() = default;
|
||||||
|
DTMF(Dimension d, int i) {
|
||||||
|
if (d == Row)
|
||||||
|
row = i;
|
||||||
|
else
|
||||||
|
col = i;
|
||||||
|
}
|
||||||
|
void clear() {
|
||||||
|
row = -1;
|
||||||
|
col = -1;
|
||||||
|
}
|
||||||
|
char getChar() {
|
||||||
|
if (row == -1 || col == -1) return '?';
|
||||||
|
return keys[row][col];
|
||||||
|
}
|
||||||
|
int row = -1;
|
||||||
|
int col = -1;
|
||||||
|
const char* keys[4] = {"123A", "456B", "789C", "*0#D"};
|
||||||
|
} actual_dtmf;
|
||||||
|
|
||||||
|
// combine row and col information
|
||||||
|
void GoetzelCallback(float frequency, float magnitude, void* ref) {
|
||||||
|
DTMF* dtmf = (DTMF*)ref;
|
||||||
|
LOGW("Time: %lu - Hz: %f Mag: %f", millis(), frequency, magnitude);
|
||||||
|
// we get either row or col information
|
||||||
|
if (dtmf->row != -1) {
|
||||||
|
actual_dtmf.row = dtmf->row;
|
||||||
|
} else {
|
||||||
|
actual_dtmf.col = dtmf->col;
|
||||||
|
|
||||||
|
// print detected key
|
||||||
|
Serial.println(actual_dtmf.getChar());
|
||||||
|
actual_dtmf.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// start audio input from microphones
|
||||||
|
auto cfg = kit.defaultConfig(RX_MODE);
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
cfg.use_apll = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// lower frequencies - with keys
|
||||||
|
goertzel.addFrequency(697, new DTMF(DTMF::Row, 0));
|
||||||
|
goertzel.addFrequency(770, new DTMF(DTMF::Row, 1));
|
||||||
|
goertzel.addFrequency(852, new DTMF(DTMF::Row, 2));
|
||||||
|
goertzel.addFrequency(941, new DTMF(DTMF::Row, 3));
|
||||||
|
// higher frequencies with idx
|
||||||
|
goertzel.addFrequency(1209, new DTMF(DTMF::Col, 0));
|
||||||
|
goertzel.addFrequency(1336, new DTMF(DTMF::Col, 1));
|
||||||
|
goertzel.addFrequency(1477, new DTMF(DTMF::Col, 2));
|
||||||
|
goertzel.addFrequency(1633, new DTMF(DTMF::Col, 3));
|
||||||
|
// define callback
|
||||||
|
goertzel.setFrequencyDetectionCallback(GoetzelCallback);
|
||||||
|
|
||||||
|
// start goertzel
|
||||||
|
auto gcfg = goertzel.defaultConfig();
|
||||||
|
gcfg.copyFrom(info);
|
||||||
|
gcfg.threshold = 5.0;
|
||||||
|
gcfg.block_size = 1024;
|
||||||
|
goertzel.begin(gcfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { copier.copy(); }
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-multioutput-server.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief MultiOutput Example using output to speaker and webserver
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-07-26
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/Communication/AudioHttp.h"
|
||||||
|
|
||||||
|
const int buffer_count = 10;
|
||||||
|
const int buffer_size = 1024;
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // input & output
|
||||||
|
QueueStream<uint8_t> queue(buffer_size, buffer_count, true);
|
||||||
|
AudioEncoderServer server(new WAVEncoder(),"WIFI","password");
|
||||||
|
MultiOutput out(queue, kit);
|
||||||
|
StreamCopy copier(out, kit); // copy kit to kit
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup audiokit
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2; // input from microphone
|
||||||
|
cfg.sample_rate = 16000;
|
||||||
|
kit.setVolume(0.5);
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// start queue
|
||||||
|
queue.begin();
|
||||||
|
|
||||||
|
// start server
|
||||||
|
server.begin(queue, cfg);
|
||||||
|
Serial.println("started...");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
server.copy();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-multioutput.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief MultiOutput Example using add
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-07-26
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(8000, 2, 16);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||||
|
CsvOutput<int16_t> csv(Serial);
|
||||||
|
MultiOutput out;
|
||||||
|
StreamCopy copier(out, kit); // copy kit to kit
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(230400);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
out.add(csv);
|
||||||
|
out.add(kit);
|
||||||
|
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2; // input from microphone
|
||||||
|
kit.setVolume(0.5);
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
csv.begin(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-sd-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We record the input from the microphone to SPI RAM and constantly repeat to play the file
|
||||||
|
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-09-01
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/MemoryManager.h"
|
||||||
|
|
||||||
|
AudioInfo info(16000, 1, 16);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
DynamicMemoryStream recording(true); // Audio stored on heap
|
||||||
|
StreamCopy copier; // copies data
|
||||||
|
|
||||||
|
|
||||||
|
void record_start(bool pinStatus, int pin, void* ref){
|
||||||
|
Serial.println("Recording...");
|
||||||
|
recording.begin();
|
||||||
|
copier.begin(recording, kit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void record_end(bool pinStatus, int pin, void* ref){
|
||||||
|
Serial.println("Playing...");
|
||||||
|
|
||||||
|
// Remove popping noise, from button: we delete 6 segments at the beginning and end
|
||||||
|
// and on the resulting audio we slowly raise the volume on the first segment
|
||||||
|
// end decrease it on the last segment
|
||||||
|
recording.postProcessSmoothTransition<int16_t>(info.channels, 0.01, 6);
|
||||||
|
|
||||||
|
// Restart from beginning
|
||||||
|
recording.rewind();
|
||||||
|
|
||||||
|
// output to kit
|
||||||
|
copier.begin(kit, recording); // start playback
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
while(!Serial); // wait for serial to be ready
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup input and output
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = true;
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
// record when key 1 is pressed
|
||||||
|
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||||
|
Serial.println("Press Key 1 to record");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
|
||||||
|
// record or play recording
|
||||||
|
copier.copy();
|
||||||
|
|
||||||
|
// Process keys
|
||||||
|
kit.processActions();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-sd-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We record the input from the microphone to SPI RAM and constantly repeat to play the file
|
||||||
|
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||||
|
* The output pitch is shifted by 1 octave!
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-11-21
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/MemoryManager.h"
|
||||||
|
|
||||||
|
AudioInfo info(16000, 1, 16);
|
||||||
|
MemoryManager memory(500); // Activate SPI RAM for objects > 500 bytes
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
//use one of VariableSpeedRingBufferSimple, VariableSpeedRingBuffer, VariableSpeedRingBuffer180
|
||||||
|
PitchShiftOutput<int16_t, VariableSpeedRingBuffer<int16_t>> pitch_shift(kit);
|
||||||
|
DynamicMemoryStream recording(false); // Audio stored on heap, non repeating
|
||||||
|
StreamCopy copier; // copies data
|
||||||
|
|
||||||
|
|
||||||
|
void record_start(bool pinStatus, int pin, void* ref){
|
||||||
|
Serial.println("Recording...");
|
||||||
|
recording.begin();
|
||||||
|
copier.begin(recording, kit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void record_end(bool pinStatus, int pin, void* ref){
|
||||||
|
Serial.println("Playing...");
|
||||||
|
|
||||||
|
// Remove popping noise, from button: we delete 6 segments at the beginning and end
|
||||||
|
// and on the resulting audio we slowly raise the volume on the first segment
|
||||||
|
// end decrease it on the last segment
|
||||||
|
recording.postProcessSmoothTransition<int16_t>(info.channels, 0.01, 6);
|
||||||
|
|
||||||
|
// output with pitch shifting
|
||||||
|
copier.begin(pitch_shift, recording); // start playback
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
while(!Serial); // wait for serial to be ready
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup input and output
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = true;
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
// setup pitch shift
|
||||||
|
auto cfg_pc = pitch_shift.defaultConfig();
|
||||||
|
cfg_pc.pitch_shift = 2; // one octave up
|
||||||
|
cfg_pc.buffer_size = 1000;
|
||||||
|
cfg_pc.copyFrom(info);
|
||||||
|
pitch_shift.begin(cfg_pc);
|
||||||
|
|
||||||
|
// record when key 1 is pressed
|
||||||
|
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||||
|
Serial.println("Press Key 1 to record");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
// record or play recording
|
||||||
|
copier.copy();
|
||||||
|
|
||||||
|
// Process keys
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-sd-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We record the input from the microphone to a file and constantly repeat to play the file
|
||||||
|
* The input is triggered by pressing key 1. Recording stops when key 1 is released!
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-09-01
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <SD.h>
|
||||||
|
|
||||||
|
const char *file_name = "/rec.raw";
|
||||||
|
AudioInfo info(16000, 1, 16);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
File file; // final output stream
|
||||||
|
StreamCopy copier; // copies data
|
||||||
|
bool recording = false; // flag to make sure that close is only executed one
|
||||||
|
uint64_t end_time; // trigger to call endRecord
|
||||||
|
|
||||||
|
|
||||||
|
void record_start(bool pinStatus, int pin, void* ref){
|
||||||
|
Serial.println("Recording...");
|
||||||
|
// open the output file
|
||||||
|
file = SD.open(file_name, FILE_WRITE);
|
||||||
|
copier.begin(file, kit);
|
||||||
|
recording = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void record_end(bool pinStatus, int pin, void* ref){
|
||||||
|
if (recording == true){
|
||||||
|
Serial.println("Playing...");
|
||||||
|
file.close();
|
||||||
|
recording = false;
|
||||||
|
file = SD.open(file_name); // reopen in read mode
|
||||||
|
copier.begin(kit, file); // start playback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
while(!Serial); // wait for serial to be ready
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup input and output: setup audiokit before SD!
|
||||||
|
auto cfg = kit.defaultConfig(RXTX_MODE);
|
||||||
|
cfg.sd_active = true;
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
// Open SD drive
|
||||||
|
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)) {
|
||||||
|
Serial.println("Initialization failed!");
|
||||||
|
while (1); // stop
|
||||||
|
}
|
||||||
|
Serial.println("Initialization done.");
|
||||||
|
|
||||||
|
|
||||||
|
// record when key 1 is pressed
|
||||||
|
kit.audioActions().add(kit.getKey(1), record_start, record_end);
|
||||||
|
Serial.println("Press Key 1 to record");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
|
||||||
|
// record or play file
|
||||||
|
copier.copy();
|
||||||
|
|
||||||
|
// while playing: at end of file -> reposition to beginning
|
||||||
|
if (!recording && file.size()>0 && file.available()==0){
|
||||||
|
file.seek(0);
|
||||||
|
Serial.println("Replay...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process keys
|
||||||
|
kit.processActions();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-sd_wav.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Demonstrates how to use an encoder to write to a file
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2023-05-04
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2023
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SD.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
const char* file_name = "/rec.wav";
|
||||||
|
AudioInfo info(16000, 1, 16);
|
||||||
|
AudioBoardStream in(AudioKitEs8388V1);
|
||||||
|
File file; // final output stream
|
||||||
|
EncodedAudioStream out(&file, new WAVEncoder());
|
||||||
|
StreamCopy copier(out, in); // copies data
|
||||||
|
uint64_t timeout;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup input
|
||||||
|
auto cfg = in.defaultConfig(RX_MODE);
|
||||||
|
cfg.sd_active = true;
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2; // microphone
|
||||||
|
in.begin(cfg);
|
||||||
|
|
||||||
|
// Open SD drive
|
||||||
|
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)) {
|
||||||
|
Serial.println("Initialization failed!");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup if necessary
|
||||||
|
if (SD.exists(file_name))
|
||||||
|
SD.remove(file_name);
|
||||||
|
|
||||||
|
// open file
|
||||||
|
file = SD.open(file_name, FILE_WRITE);
|
||||||
|
if (!file){
|
||||||
|
Serial.println("file failed!");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
out.begin(info);
|
||||||
|
|
||||||
|
// set timeout - recoring for 5 seconds
|
||||||
|
timeout = millis() + 5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (millis() < timeout) {
|
||||||
|
// record to wav file
|
||||||
|
copier.copy();
|
||||||
|
} else {
|
||||||
|
// close file when done
|
||||||
|
if (file) {
|
||||||
|
file.flush();
|
||||||
|
Serial.print("File has ");
|
||||||
|
Serial.print(file.size());
|
||||||
|
Serial.println(" bytes");
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# Stream Input from an AudioKit to CSV Output
|
||||||
|
|
||||||
|
## General Description:
|
||||||
|
|
||||||
|
We implement a AudioKit source: We stream the sound input which we read in from the I2S interface and display it on the Arduino Serial Plotter.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-audiokit-csv.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-audiokit-serial/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Access I2S as stream
|
||||||
|
CsvOutput<int16_t> csvOutput(Serial);
|
||||||
|
StreamCopy copier(csvOutput, kit); // copy kit to csvOutput
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
auto cfg = kit.defaultConfig(RX_MODE);
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// make sure that we have the correct channels set up
|
||||||
|
csvOutput.begin(info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
## Using the AI Thinker ESP32 Audio Kit Micro Speech
|
||||||
|
|
||||||
|
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies
|
||||||
|
|
||||||
|
The staring point for doing speech recognition on an Arduino based board is TensorFlow Light For Microcontrollers with the example sketch called micro_speech!
|
||||||
|
|
||||||
|
I have adapted the MicroSpeech example from TensorFlow Lite to follow the philosophy of this framework. The example uses a Tensorflow model which can recognise the words 'yes' and 'no'. The output stream class is TfLiteAudioOutput. In the example I am using an ESP32 AudioKit board, but you can replace this with any type of processor with a microphone.
|
||||||
|
Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/TensorFlow-Lite---MicroSpeech)
|
||||||
|
|
||||||
|
|
||||||
|
### Note
|
||||||
|
|
||||||
|
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
- https://github.com/pschatzmann/tflite-micro-arduino-examples
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
|||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/TfLiteAudioStream.h"
|
||||||
|
#include "model.h" // tensorflow model
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1); // Audio source
|
||||||
|
TfLiteAudioStream tfl; // Audio sink
|
||||||
|
const char* kCategoryLabels[4] = {
|
||||||
|
"silence",
|
||||||
|
"unknown",
|
||||||
|
"yes",
|
||||||
|
"no",
|
||||||
|
};
|
||||||
|
StreamCopy copier(tfl, kit); // copy mic to tfl
|
||||||
|
int channels = 1;
|
||||||
|
int samples_per_second = 16000;
|
||||||
|
|
||||||
|
void respondToCommand(const char* found_command, uint8_t score,
|
||||||
|
bool is_new_command) {
|
||||||
|
if (is_new_command) {
|
||||||
|
char buffer[80];
|
||||||
|
sprintf(buffer, "Result: %s, score: %d, is_new: %s", found_command, score,
|
||||||
|
is_new_command ? "true" : "false");
|
||||||
|
Serial.println(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup Audiokit
|
||||||
|
auto cfg = kit.defaultConfig(RX_MODE);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2;
|
||||||
|
cfg.channels = channels;
|
||||||
|
cfg.sample_rate = samples_per_second;
|
||||||
|
cfg.use_apll = false;
|
||||||
|
//cfg.auto_clear = true;
|
||||||
|
cfg.buffer_size = 512;
|
||||||
|
cfg.buffer_count = 16;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// Setup tensorflow
|
||||||
|
auto tcfg = tfl.defaultConfig();
|
||||||
|
tcfg.setCategories(kCategoryLabels);
|
||||||
|
tcfg.channels = channels;
|
||||||
|
tcfg.sample_rate = samples_per_second;
|
||||||
|
tcfg.kTensorArenaSize = 10 * 1024;
|
||||||
|
tcfg.respondToCommand = respondToCommand;
|
||||||
|
tcfg.model = g_model;
|
||||||
|
tfl.begin(tcfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { copier.copy(); }
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-file_loop-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Just a small demo, how to use looping (=repeating) files with the SD library
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-10-09
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <SD.h>
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/Disk/FileLoop.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
|
||||||
|
|
||||||
|
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||||
|
EncodedAudioStream decoder(&i2s, new MP3DecoderHelix()); // Decoding stream
|
||||||
|
FileLoop loopingFile;
|
||||||
|
StreamCopy copier(decoder, loopingFile);
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup audiokit before SD!
|
||||||
|
auto config = i2s.defaultConfig(TX_MODE);
|
||||||
|
config.sd_active = true;
|
||||||
|
i2s.begin(config);
|
||||||
|
|
||||||
|
// setup file
|
||||||
|
SD.begin(chipSelect);
|
||||||
|
loopingFile.setFile(SD.open("/ZZ Top/Unknown Album/Lowrider.mp3"));
|
||||||
|
//loopingFile.setLoopCount(-1); // define loop count
|
||||||
|
//audioFile.setStartPos(44); // restart from pos 44
|
||||||
|
//if ((audioFile.size()-44) % 1024!=0) audioFile.setSize((((audioFile.size()-44)/1024)+1)*1024+44);
|
||||||
|
loopingFile.begin();
|
||||||
|
|
||||||
|
// setup I2S based on sampling rate provided by decoder
|
||||||
|
decoder.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-generator-audiokit.ino
|
||||||
|
* @brief Tesing I2S output on audiokit
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(32000, 2, 16);
|
||||||
|
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||||
|
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
StreamCopy copier(out, sound); // copies sound into i2s
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(TX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// Setup sine wave
|
||||||
|
sineWave.begin(info, N_B4);
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-generator_fromarray-audiokit.ino
|
||||||
|
* @brief Tesing GeneratorFromArray with output on audiokit
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
int16_t sine_array[] = {0, 2285, 4560, 6812, 9031, 11206, 13327, 15383, 17363, 19259, 21062, 22761, 24350, 25820, 27165, 28377, 29450, 30381, 31163, 31793, 32269, 32587, 32747, 32747, 32587, 32269, 31793, 31163, 30381, 29450, 28377, 27165, 25820, 24350, 22761, 21062, 19259, 17363, 15383, 13327, 11206, 9031, 6812, 4560, 2285, 0, -2285, -4560, -6812, -9031, -11206, -13327, -15383, -17363, -19259, -21062, -22761, -24350, -25820, -27165, -28377, -29450, -30381, -31163, -31793, -32269, -32587, -32747, -32747, -32587, -32269, -31793, -31163, -30381, -29450, -28377, -27165, -25820, -24350, -22761, -21062, -19259, -17363, -15383, -13327, -11206, -9031, -6812, -4560, -2285 };
|
||||||
|
GeneratorFromArray<int16_t> sineWave(sine_array,0,false);
|
||||||
|
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
|
||||||
|
StreamCopy copier(out, sound); // copies sound into i2s
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(TX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// Setup sine wave
|
||||||
|
sineWave.begin(info);
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-generator_inputmixer-audiokit.ino
|
||||||
|
* @brief Tesing input mixer
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(32000, 2, 16);
|
||||||
|
SineWaveGenerator<int16_t> sineWave1(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||||
|
SineWaveGenerator<int16_t> sineWave2(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||||
|
GeneratedSoundStream<int16_t> sound1(sineWave1); // Stream generated from sine wave
|
||||||
|
GeneratedSoundStream<int16_t> sound2(sineWave2); // Stream generated from sine wave
|
||||||
|
InputMixer<int16_t> mixer;
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
StreamCopy copier(out, mixer); // copies sound into i2s
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(TX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// Setup sine wave
|
||||||
|
sineWave1.begin(info, N_B4);
|
||||||
|
sineWave2.begin(info, N_E4);
|
||||||
|
|
||||||
|
mixer.add(sound1);
|
||||||
|
mixer.add(sound2);
|
||||||
|
mixer.begin(info);
|
||||||
|
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-generator_outputmixer-audiokit.ino
|
||||||
|
* @brief Tesing output mixer
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
const int N = 5;
|
||||||
|
SineWaveGenerator<int16_t> sineWave[N](32000);
|
||||||
|
GeneratedSoundStream<int16_t> sound[N];
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
OutputMixer<int16_t> mixer(out, N, DefaultAllocatorRAM);
|
||||||
|
StreamCopy copier[N](DefaultAllocatorRAM);
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
for (int j = 0; j < N; j++) {
|
||||||
|
sineWave[j].begin(info, 440 * (j + 1));
|
||||||
|
sound[j].setInput(sineWave[j]);
|
||||||
|
sound[j].begin(info);
|
||||||
|
copier[j].begin(mixer, sound[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(TX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// setup Output mixer with default buffer size
|
||||||
|
mixer.begin();
|
||||||
|
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
// write each output
|
||||||
|
for (int j = 0; j < N; j++) {
|
||||||
|
copier[j].copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// We could flush to force the output but this is not necessary because we
|
||||||
|
// were already writing all streams
|
||||||
|
// mixer.flushMixer();
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-generator_sinfromtable-audiokit.ino
|
||||||
|
* @brief Tesing SineFromTable with output on audiokit
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(32000, 2, 16);
|
||||||
|
SineFromTable<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||||
|
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
//CsvOutput<int16_t> out(Serial);
|
||||||
|
int sound_len=1024;
|
||||||
|
StreamCopy copier(out, sound, sound_len); // copies sound into i2s
|
||||||
|
int freq = 122;
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(); //TX_MODE
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// Setup sine wave
|
||||||
|
sineWave.begin(info, freq);
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
// the length is defined by sound_len
|
||||||
|
copier.copy();
|
||||||
|
// increase frequency
|
||||||
|
freq += 10;
|
||||||
|
if (freq>=10000){
|
||||||
|
freq = 20;
|
||||||
|
}
|
||||||
|
sineWave.setFrequency(freq);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-memory_mp3_short-i2s.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief decode MP3 stream and output as i2s signal
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2021-01-24
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "zero.h"
|
||||||
|
|
||||||
|
MemoryStream mp3(zero_mp3, zero_mp3_len);
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1);
|
||||||
|
MP3DecoderHelix helix;
|
||||||
|
EncodedAudioStream out(&i2s, &helix); // output to decoder
|
||||||
|
StreamCopy copier(out, mp3); // copy in to i2s
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// begin processing
|
||||||
|
auto cfg = i2s.defaultConfig();
|
||||||
|
cfg.sample_rate = 24000;
|
||||||
|
cfg.channels = 1;
|
||||||
|
i2s.begin(cfg);
|
||||||
|
out.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
if (mp3.available()) {
|
||||||
|
copier.copy();
|
||||||
|
} else {
|
||||||
|
helix.end(); // flush output
|
||||||
|
auto info = out.decoder().audioInfo();
|
||||||
|
LOGI("The audio rate from the mp3 file is %d", info.sample_rate);
|
||||||
|
LOGI("The channels from the mp3 file is %d", info.channels);
|
||||||
|
i2s.end();
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
const unsigned char zero_mp3[] = {
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x00, 0x11, 0x20, 0x6a, 0x1c, 0x00, 0x7b, 0x0c,
|
||||||
|
0x28, 0x52, 0x24, 0x4c, 0x22, 0xb4, 0xe2, 0x18, 0x80, 0x0e, 0x52, 0x2f,
|
||||||
|
0xa0, 0x17, 0x07, 0xc5, 0x62, 0x21, 0xd8, 0x83, 0x56, 0x4c, 0xc3, 0x52,
|
||||||
|
0x51, 0x38, 0x3c, 0xdb, 0x82, 0x33, 0xf8, 0x9c, 0xb9, 0x47, 0x1c, 0x20,
|
||||||
|
0x8b, 0x2b, 0x79, 0xcf, 0x97, 0x1e, 0xf0, 0x83, 0xb2, 0x8a, 0xa5, 0x1f,
|
||||||
|
0xff, 0xfe, 0xc4, 0x27, 0xc4, 0x00, 0x83, 0xb9, 0x75, 0xa8, 0x10, 0x0c,
|
||||||
|
0x10, 0x28, 0x5c, 0x78, 0x5c, 0x2e, 0x0e, 0x02, 0x01, 0x85, 0x83, 0x18,
|
||||||
|
0x82, 0xec, 0x5c, 0x86, 0x25, 0x21, 0x6a, 0x00, 0xe4, 0x4b, 0xcd, 0x35,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x0e, 0x11, 0x98, 0xca, 0x80, 0x00, 0xc3, 0xc6,
|
||||||
|
0x70, 0x11, 0x90, 0xd0, 0x41, 0xfa, 0x58, 0xd8, 0x1e, 0x45, 0x57, 0xc4,
|
||||||
|
0xd4, 0x3d, 0xe1, 0xe5, 0x35, 0x7a, 0x6b, 0xfc, 0x6a, 0x9f, 0xbe, 0x95,
|
||||||
|
0xdd, 0xe3, 0xee, 0xe0, 0x60, 0x41, 0x38, 0x20, 0x27, 0xa9, 0xc4, 0xd4,
|
||||||
|
0x08, 0x09, 0xc4, 0xeb, 0x3f, 0xff, 0xd4, 0x18, 0x13, 0xc9, 0xed, 0xff,
|
||||||
|
0xff, 0xff, 0x59, 0xfa, 0xa5, 0xfe, 0x73, 0x07, 0xc3, 0xea, 0x86, 0x70,
|
||||||
|
0xa7, 0x72, 0xa0, 0xc0, 0x2c, 0x54, 0x47, 0x5f, 0xd2, 0x3a, 0x52, 0xea,
|
||||||
|
0x18, 0x93, 0xb1, 0x97, 0xee, 0xcd, 0xba, 0x78, 0x00, 0x1c, 0x7a, 0xb1,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x1a, 0x17, 0x62, 0xea, 0x94, 0x00, 0xd1, 0x44,
|
||||||
|
0xb9, 0x45, 0x9e, 0x5f, 0xda, 0xd2, 0x92, 0xb6, 0xa4, 0x58, 0x81, 0xa2,
|
||||||
|
0x82, 0x42, 0x8c, 0x2c, 0xca, 0xea, 0xf2, 0x2d, 0x5e, 0xe9, 0x73, 0x91,
|
||||||
|
0xb3, 0xff, 0xd2, 0xb6, 0xe8, 0xaf, 0xe8, 0x22, 0x88, 0x9e, 0x8d, 0x92,
|
||||||
|
0xfd, 0xe8, 0xcb, 0xfd, 0xbb, 0x1d, 0xda, 0xf3, 0xab, 0x93, 0x6e, 0xcf,
|
||||||
|
0xa9, 0xc8, 0xd5, 0x33, 0x9d, 0xd1, 0x9d, 0x64, 0x20, 0x37, 0x41, 0x0d,
|
||||||
|
0x75, 0x0e, 0x06, 0xe0, 0x9d, 0xc2, 0x23, 0xf7, 0xda, 0xa6, 0xbd, 0xf6,
|
||||||
|
0x23, 0x80, 0x45, 0x8d, 0x19, 0xf4, 0x9c, 0xe3, 0xb4, 0x84, 0x98, 0x6a,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x0f, 0x16, 0x3b, 0x1a, 0xa4, 0x00, 0xc1, 0x4a,
|
||||||
|
0xbd, 0x59, 0x63, 0x3a, 0xd4, 0xe0, 0xcc, 0x9a, 0xb7, 0x6f, 0xd6, 0xdf,
|
||||||
|
0xce, 0x86, 0x2d, 0x8d, 0xf6, 0xfd, 0x29, 0xea, 0x95, 0x7f, 0xff, 0x4a,
|
||||||
|
0x67, 0xfa, 0x7f, 0xdd, 0x7d, 0x74, 0xcd, 0xdf, 0x7c, 0x8e, 0xcf, 0xb1,
|
||||||
|
0x1d, 0x6d, 0x98, 0x85, 0x54, 0x7a, 0x3b, 0x9f, 0x41, 0x8c, 0xe4, 0x55,
|
||||||
|
0x33, 0x0d, 0x1c, 0xe4, 0x14, 0x17, 0x45, 0x40, 0xfb, 0x9c, 0x38, 0x38,
|
||||||
|
0x44, 0x79, 0x1c, 0x39, 0x28, 0x38, 0x9b, 0x04, 0xce, 0x01, 0x98, 0x3e,
|
||||||
|
0x20, 0x1c, 0x11, 0x9f, 0x71, 0x54, 0x82, 0x0a, 0xc2, 0x5d, 0x96, 0x26,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x09, 0x14, 0x63, 0x22, 0xa8, 0x00, 0x78, 0x4e,
|
||||||
|
0xbc, 0x99, 0xeb, 0x85, 0x6b, 0xf1, 0x6e, 0x4b, 0xff, 0xaf, 0xff, 0xcd,
|
||||||
|
0x13, 0xf6, 0xbf, 0x2b, 0xfa, 0xfc, 0xba, 0xbf, 0x7f, 0xb6, 0xbf, 0x45,
|
||||||
|
0xa7, 0xbe, 0xfa, 0xe7, 0x53, 0xeb, 0x31, 0xb5, 0xa1, 0x8a, 0xb9, 0x95,
|
||||||
|
0x44, 0x9f, 0x53, 0x19, 0xdc, 0xd9, 0xa5, 0x56, 0x61, 0xf4, 0x66, 0xa9,
|
||||||
|
0x76, 0x1c, 0xa9, 0xa6, 0x98, 0x92, 0x6c, 0x5c, 0x78, 0xf2, 0x43, 0xe3,
|
||||||
|
0xae, 0xa7, 0x16, 0x1c, 0x2e, 0x4c, 0xb8, 0x8c, 0x38, 0x70, 0x46, 0x54,
|
||||||
|
0xb9, 0x75, 0xa6, 0x9b, 0xe6, 0x1c, 0x46, 0x91, 0x30, 0x6b, 0x89, 0xef,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x0a, 0x14, 0xfb, 0x22, 0xa4, 0x00, 0x78, 0x4a,
|
||||||
|
0xbc, 0x4b, 0x7f, 0xbf, 0x9f, 0xf9, 0xaf, 0xff, 0xff, 0xc8, 0x8c, 0xf0,
|
||||||
|
0x65, 0xd5, 0xf6, 0xc8, 0xbf, 0x57, 0xbd, 0x5e, 0xb6, 0xcf, 0xfa, 0xf3,
|
||||||
|
0x76, 0x6f, 0xc8, 0xee, 0x8f, 0xad, 0x59, 0xfe, 0x87, 0x91, 0x5c, 0xee,
|
||||||
|
0xa8, 0xa6, 0x32, 0x14, 0x91, 0x85, 0xa0, 0xa2, 0x65, 0x67, 0x22, 0x5d,
|
||||||
|
0x48, 0x64, 0x62, 0x89, 0x87, 0xca, 0x34, 0x83, 0x06, 0x07, 0x43, 0x82,
|
||||||
|
0x63, 0xc7, 0x09, 0x8b, 0x1d, 0x86, 0x80, 0xe3, 0x82, 0xd4, 0xa8, 0x42,
|
||||||
|
0x00, 0xe2, 0xec, 0x2d, 0x44, 0x22, 0x10, 0x89, 0x03, 0x0a, 0x38, 0xab,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x09, 0x14, 0xcb, 0x1e, 0xa8, 0x00, 0x38, 0x50,
|
||||||
|
0xbc, 0x6f, 0xff, 0xff, 0xff, 0xfe, 0xdc, 0xa2, 0x07, 0x4e, 0x82, 0x6e,
|
||||||
|
0x68, 0x98, 0xcf, 0x4f, 0xee, 0xbf, 0xf8, 0xfe, 0xa7, 0xfa, 0xbd, 0x3b,
|
||||||
|
0x4b, 0xef, 0xfe, 0x3f, 0xff, 0xa9, 0x5e, 0x9b, 0xee, 0x5e, 0x23, 0xae,
|
||||||
|
0xe6, 0xdd, 0xe2, 0x21, 0x9a, 0x51, 0xd2, 0x5e, 0xee, 0x10, 0xb2, 0xee,
|
||||||
|
0xfb, 0x52, 0x39, 0x20, 0x93, 0x11, 0xec, 0x54, 0x98, 0x10, 0x58, 0xed,
|
||||||
|
0x49, 0xab, 0xa6, 0x30, 0xac, 0xf2, 0x06, 0x0b, 0x1c, 0x27, 0x41, 0x10,
|
||||||
|
0x21, 0xa3, 0xc6, 0xd5, 0x5d, 0x10, 0x1c, 0x14, 0x3c, 0xcb, 0xd3, 0xe6,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x08, 0x13, 0x8b, 0x22, 0xb0, 0x00, 0x40, 0x4a,
|
||||||
|
0xbc, 0xff, 0xff, 0xe5, 0xf2, 0xff, 0xff, 0x54, 0x66, 0x4e, 0xdf, 0x59,
|
||||||
|
0xd6, 0x02, 0xcb, 0x32, 0x22, 0xff, 0xef, 0xbf, 0xb6, 0x8c, 0x9b, 0xd2,
|
||||||
|
0x8d, 0x44, 0x6c, 0x8c, 0xcd, 0xbc, 0x94, 0xb2, 0xa7, 0x64, 0x89, 0x4a,
|
||||||
|
0xe3, 0x19, 0x95, 0xa6, 0x79, 0xca, 0x2e, 0x47, 0x55, 0x2d, 0xd4, 0xf1,
|
||||||
|
0xe2, 0x51, 0x67, 0x17, 0xb2, 0x91, 0x8a, 0x2e, 0x16, 0x0c, 0x71, 0x61,
|
||||||
|
0x53, 0x9c, 0x38, 0xcc, 0x2e, 0xa2, 0x01, 0xc1, 0x10, 0xe0, 0xa3, 0xaa,
|
||||||
|
0xd7, 0xf6, 0xee, 0xa9, 0x8c, 0x8c, 0x51, 0x08, 0x7e, 0x57, 0x62, 0x26,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x0c, 0x13, 0xc3, 0x0e, 0xb8, 0x00, 0xc0, 0x84,
|
||||||
|
0xb9, 0xdc, 0xd7, 0x5d, 0x1f, 0xff, 0x14, 0x39, 0xfd, 0x4f, 0xff, 0xc8,
|
||||||
|
0x4f, 0xaa, 0xec, 0xc6, 0x2a, 0xb0, 0x4d, 0x92, 0xba, 0x12, 0x8e, 0x62,
|
||||||
|
0x33, 0xb3, 0x5d, 0xdd, 0x57, 0xd1, 0x2b, 0xff, 0xf4, 0x4d, 0xea, 0xa9,
|
||||||
|
0xff, 0xba, 0x74, 0xfc, 0xed, 0xd9, 0xa9, 0x4d, 0x26, 0x7d, 0x51, 0x76,
|
||||||
|
0xb1, 0xca, 0xe9, 0x4b, 0x83, 0x50, 0x45, 0x80, 0xb3, 0x21, 0x90, 0xea,
|
||||||
|
0xcf, 0xa1, 0x5b, 0x31, 0x8a, 0x15, 0x32, 0x09, 0xb1, 0xfc, 0xe6, 0x53,
|
||||||
|
0x27, 0x48, 0x65, 0x60, 0x4f, 0xda, 0x97, 0x4e, 0x15, 0x53, 0x1f, 0xaa,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x10, 0x15, 0x39, 0xba, 0xac, 0x00, 0xc9, 0xda,
|
||||||
|
0x94, 0x14, 0xcb, 0x80, 0xc1, 0x9f, 0x34, 0x69, 0xe8, 0x51, 0xfc, 0xe1,
|
||||||
|
0x3b, 0xf4, 0x10, 0x9c, 0x6b, 0x52, 0x71, 0x0e, 0xb4, 0x8d, 0x93, 0x40,
|
||||||
|
0x97, 0x06, 0xd9, 0x71, 0x05, 0x58, 0x4f, 0xcb, 0x88, 0x3a, 0x2e, 0x49,
|
||||||
|
0x09, 0x73, 0x1f, 0x42, 0x99, 0x82, 0xfd, 0x34, 0xfd, 0x54, 0x3d, 0x33,
|
||||||
|
0x7f, 0x44, 0xc5, 0x4b, 0xa4, 0x6c, 0x07, 0x67, 0xff, 0xff, 0x53, 0xc6,
|
||||||
|
0x9d, 0x59, 0xaa, 0xd7, 0xcf, 0x48, 0x05, 0x65, 0xec, 0x1b, 0xe7, 0x72,
|
||||||
|
0xff, 0x8e, 0x02, 0xc9, 0xa5, 0xd7, 0x2d, 0x4a, 0x41, 0x3a, 0xa0, 0x77,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x0e, 0x12, 0x99, 0xc2, 0xb4, 0x00, 0xc9, 0xd6,
|
||||||
|
0x94, 0xf5, 0x09, 0x9f, 0xcf, 0x23, 0xf7, 0xf4, 0x1a, 0x12, 0xf5, 0x16,
|
||||||
|
0xff, 0x0d, 0x36, 0xbf, 0x61, 0x40, 0x30, 0x3f, 0x27, 0x30, 0x7c, 0x12,
|
||||||
|
0xce, 0xcf, 0x29, 0x8d, 0xe1, 0xf8, 0xeb, 0x6d, 0x83, 0x61, 0x08, 0x3f,
|
||||||
|
0x44, 0xd4, 0xdd, 0x7f, 0xb2, 0xdb, 0xfb, 0xf3, 0xbf, 0x37, 0x27, 0xcd,
|
||||||
|
0x5b, 0xbf, 0x41, 0x1a, 0xa9, 0x7f, 0xff, 0xfe, 0xaa, 0x3b, 0x17, 0x77,
|
||||||
|
0xfd, 0x4a, 0xe6, 0xbf, 0x55, 0x60, 0x21, 0xb5, 0xcb, 0xbf, 0x2b, 0x30,
|
||||||
|
0x31, 0xb3, 0xe5, 0x63, 0x9d, 0x76, 0x8d, 0x1f, 0xf1, 0x5f, 0x93, 0xc8,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x16, 0x10, 0x51, 0xba, 0xb8, 0x00, 0xc1, 0x50,
|
||||||
|
0x94, 0x10, 0x7e, 0xa2, 0x62, 0x4d, 0xe5, 0x94, 0xdf, 0x96, 0x2c, 0x0b,
|
||||||
|
0x47, 0x59, 0x82, 0x80, 0x08, 0x02, 0x42, 0xd7, 0x14, 0x30, 0x45, 0x7d,
|
||||||
|
0x11, 0xc0, 0x60, 0x9e, 0xfb, 0x22, 0xcd, 0xfe, 0x3b, 0x5f, 0xe9, 0xcd,
|
||||||
|
0xae, 0x52, 0x59, 0xb7, 0x17, 0xb3, 0x09, 0xaa, 0xaa, 0xe7, 0xff, 0xf1,
|
||||||
|
0x1d, 0xc4, 0x8e, 0xaf, 0x96, 0x56, 0x42, 0xe5, 0x9f, 0x2f, 0x2c, 0xeb,
|
||||||
|
0x2f, 0x21, 0x9f, 0xce, 0xdc, 0xe7, 0x6e, 0x41, 0x45, 0xf0, 0x7e, 0x75,
|
||||||
|
0xf3, 0xfe, 0xa3, 0x62, 0x98, 0xed, 0x06, 0x01, 0x01, 0x59, 0xed, 0xa4,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x27, 0x10, 0x49, 0xaa, 0xb8, 0x00, 0xc8, 0x92,
|
||||||
|
0x95, 0x04, 0x05, 0xcc, 0xd6, 0xa3, 0x24, 0x2e, 0x25, 0xcd, 0x5e, 0x69,
|
||||||
|
0x6d, 0xfb, 0xda, 0x97, 0xf5, 0xf2, 0x5b, 0xfd, 0xea, 0xbf, 0x7d, 0xeb,
|
||||||
|
0x3a, 0x6e, 0xc4, 0xd5, 0xe7, 0xf7, 0x94, 0xe3, 0x81, 0xd1, 0x8e, 0x93,
|
||||||
|
0x74, 0xaf, 0xd9, 0x04, 0x56, 0xca, 0xf2, 0xcf, 0x30, 0x8e, 0x01, 0xef,
|
||||||
|
0xca, 0x88, 0xde, 0x3e, 0x51, 0xfb, 0x0b, 0x8d, 0xb9, 0x84, 0x09, 0x3e,
|
||||||
|
0x60, 0xe9, 0x2b, 0x4d, 0xc2, 0x4b, 0x5a, 0x17, 0x01, 0xe0, 0x06, 0x0e,
|
||||||
|
0x4c, 0x48, 0x2c, 0x2c, 0x69, 0x8a, 0x58, 0x8c, 0x10, 0xc5, 0x6e, 0x79,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x38, 0x12, 0x91, 0x9a, 0xb4, 0x00, 0xd1, 0xd0,
|
||||||
|
0x95, 0x97, 0xd2, 0x5d, 0x7e, 0x93, 0x1d, 0x42, 0x4c, 0x5d, 0xc9, 0x6a,
|
||||||
|
0xc7, 0x04, 0x46, 0x05, 0x28, 0xaf, 0xfe, 0xd5, 0xc3, 0x9f, 0xb8, 0xe0,
|
||||||
|
0x31, 0xcd, 0xf4, 0xb2, 0xcc, 0x64, 0x47, 0x13, 0x9e, 0x0c, 0x77, 0x0b,
|
||||||
|
0xa4, 0xc7, 0x3b, 0x96, 0x6f, 0x86, 0x03, 0xa6, 0xba, 0xf8, 0x7e, 0xe3,
|
||||||
|
0x5f, 0xf2, 0xa3, 0x5e, 0xe6, 0x99, 0x34, 0xbc, 0xd7, 0x15, 0x9a, 0x95,
|
||||||
|
0x20, 0x10, 0x10, 0xb2, 0xe7, 0x2e, 0x03, 0x90, 0x34, 0x9f, 0x99, 0xa1,
|
||||||
|
0x4a, 0xd5, 0x63, 0x02, 0x12, 0x54, 0x31, 0xdb, 0x73, 0xe7, 0xb7, 0xa9,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x40, 0x11, 0xd9, 0x2a, 0xb4, 0x00, 0xc3, 0xd2,
|
||||||
|
0x70, 0x74, 0x95, 0x36, 0x48, 0x58, 0xb1, 0xe2, 0x4a, 0xb3, 0xac, 0x2e,
|
||||||
|
0xc9, 0xc0, 0x22, 0xdc, 0x93, 0x4b, 0x21, 0xf0, 0x45, 0x2b, 0x16, 0x4d,
|
||||||
|
0x1e, 0x58, 0x00, 0xe4, 0x24, 0x75, 0x8b, 0xf4, 0x8e, 0xc4, 0x35, 0x2c,
|
||||||
|
0xdf, 0xd7, 0x8d, 0x52, 0x59, 0xef, 0xd3, 0xd2, 0xf8, 0x45, 0x51, 0xa3,
|
||||||
|
0xf2, 0xc9, 0xb2, 0x8b, 0x20, 0xa9, 0x12, 0x68, 0x15, 0x2e, 0x90, 0x0e,
|
||||||
|
0x26, 0x6b, 0xa3, 0xb1, 0x52, 0xda, 0xa1, 0xf1, 0x0a, 0x12, 0x59, 0x24,
|
||||||
|
0x42, 0xe3, 0xa3, 0x02, 0x8f, 0xfa, 0xfa, 0x95, 0x45, 0xef, 0x32, 0xf4,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x4b, 0x11, 0xe9, 0x1e, 0xb0, 0x00, 0xce, 0x12,
|
||||||
|
0x70, 0x97, 0x43, 0x6a, 0x7b, 0xd9, 0x32, 0x80, 0xf2, 0xcd, 0xce, 0xc4,
|
||||||
|
0x50, 0x16, 0x03, 0x7a, 0x5c, 0xce, 0xed, 0xdb, 0x6d, 0xa5, 0xb6, 0x72,
|
||||||
|
0xa9, 0x1f, 0xb1, 0x8e, 0xe5, 0x72, 0xf9, 0xde, 0xd2, 0x04, 0xc5, 0x2c,
|
||||||
|
0xed, 0x93, 0xa4, 0x69, 0x40, 0x40, 0x26, 0x48, 0x2a, 0x80, 0xa0, 0x48,
|
||||||
|
0x46, 0x66, 0x64, 0x88, 0x5e, 0x4a, 0x99, 0xb5, 0x99, 0x22, 0xd6, 0xd6,
|
||||||
|
0x65, 0xf1, 0x01, 0x9e, 0x1f, 0xfd, 0x8e, 0x39, 0x4a, 0xfe, 0xe1, 0x4e,
|
||||||
|
0x31, 0x55, 0x27, 0x45, 0x2a, 0x80, 0x8d, 0x63, 0x28, 0x4b, 0xfd, 0x13,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x56, 0x11, 0xa9, 0x16, 0xb4, 0x00, 0xc6, 0x12,
|
||||||
|
0x70, 0x43, 0x81, 0xe9, 0x50, 0xf2, 0xce, 0x4e, 0xa1, 0x84, 0x60, 0x95,
|
||||||
|
0xde, 0xdb, 0xee, 0xa5, 0xd2, 0xec, 0x6e, 0xbc, 0x6e, 0xd5, 0xfc, 0x72,
|
||||||
|
0x56, 0x1c, 0x51, 0xa5, 0x90, 0xb0, 0x12, 0x68, 0xd0, 0x49, 0x18, 0x4f,
|
||||||
|
0x0f, 0xd8, 0x6f, 0x1c, 0x89, 0xf9, 0x61, 0xd5, 0x98, 0x10, 0x38, 0xb5,
|
||||||
|
0xf2, 0x70, 0xbd, 0x7b, 0xaa, 0x32, 0xbd, 0x8b, 0xaf, 0x18, 0x3a, 0xb2,
|
||||||
|
0x36, 0x7b, 0xe5, 0xbf, 0xff, 0xff, 0xff, 0xeb, 0x4f, 0xff, 0xa1, 0x15,
|
||||||
|
0xc3, 0xb5, 0x60, 0x23, 0x19, 0x04, 0x4a, 0xa5, 0xac, 0xe9, 0x80, 0xe5,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x62, 0x15, 0x59, 0x16, 0xa4, 0x00, 0xc6, 0x5e,
|
||||||
|
0x70, 0x87, 0x6c, 0xcf, 0x81, 0x38, 0x34, 0xc1, 0x70, 0xad, 0xf1, 0x47,
|
||||||
|
0xaf, 0x5a, 0xce, 0x20, 0xc1, 0x67, 0xec, 0xfc, 0x61, 0x8a, 0xd5, 0xab,
|
||||||
|
0x40, 0xd6, 0x0c, 0x68, 0xd9, 0x5d, 0x83, 0xd1, 0x5c, 0xfb, 0xa2, 0xc6,
|
||||||
|
0x6a, 0xfb, 0x43, 0xf4, 0x5a, 0xf4, 0x7d, 0x4a, 0x9e, 0x7b, 0x25, 0x9f,
|
||||||
|
0x2e, 0xd9, 0x46, 0x8b, 0x1e, 0x59, 0x1f, 0xf6, 0xae, 0xcf, 0xff, 0xff,
|
||||||
|
0xff, 0xfa, 0xbf, 0xfd, 0x6a, 0xca, 0xd6, 0x51, 0x10, 0x3b, 0x52, 0xcb,
|
||||||
|
0xf1, 0x40, 0xbd, 0xab, 0xfa, 0x35, 0x2b, 0x49, 0x53, 0x73, 0x40, 0x14,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x5f, 0x12, 0xd8, 0xea, 0xa0, 0x00, 0xce, 0x5e,
|
||||||
|
0x70, 0x59, 0xbf, 0x9c, 0xa7, 0x62, 0x31, 0x4c, 0xf1, 0x4e, 0xe8, 0x7b,
|
||||||
|
0x2b, 0x0e, 0x9b, 0x93, 0x45, 0x5f, 0xa4, 0x00, 0xa7, 0xa2, 0x52, 0x69,
|
||||||
|
0x48, 0x2a, 0x2b, 0x56, 0x04, 0xbb, 0x36, 0xe4, 0xd8, 0xe7, 0x67, 0x75,
|
||||||
|
0x7b, 0x39, 0x5b, 0xfb, 0x4b, 0xcd, 0x6a, 0x98, 0xf3, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x8d, 0xef, 0x6d, 0x10, 0xeb, 0x05,
|
||||||
|
0x7e, 0x74, 0xfb, 0x8e, 0xd7, 0x4c, 0x48, 0xb3, 0x67, 0x10, 0x0a, 0x1c,
|
||||||
|
0x90, 0xb8, 0xd0, 0x0c, 0xbe, 0xf3, 0x38, 0x96, 0xd3, 0x54, 0x5f, 0x08,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x66, 0x12, 0x00, 0xe2, 0x98, 0x00, 0xce, 0xb0,
|
||||||
|
0x70, 0xd3, 0x8f, 0xc1, 0x49, 0xab, 0x62, 0x9a, 0x61, 0x6d, 0x0d, 0x10,
|
||||||
|
0xc3, 0xaf, 0x23, 0xf0, 0x14, 0x15, 0x8b, 0x31, 0xb6, 0x97, 0xf8, 0xde,
|
||||||
|
0x8f, 0xca, 0xb3, 0xce, 0x9a, 0x19, 0xb7, 0xf7, 0x71, 0xbf, 0xc2, 0x8e,
|
||||||
|
0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0xbf, 0xfe, 0x9a, 0xc3, 0x7d,
|
||||||
|
0x80, 0x87, 0xef, 0xca, 0xc2, 0xf3, 0x1c, 0x44, 0x6a, 0x0d, 0x2d, 0x30,
|
||||||
|
0x4b, 0x47, 0xa9, 0xee, 0x73, 0xec, 0xa9, 0x16, 0x93, 0x6f, 0x2a, 0x96,
|
||||||
|
0xad, 0x79, 0x9c, 0xaf, 0xac, 0x03, 0xb5, 0x95, 0x78, 0xe2, 0xf9, 0x6c,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x71, 0x12, 0xa0, 0xde, 0x90, 0x00, 0xd6, 0xf0,
|
||||||
|
0x70, 0xd1, 0xaa, 0x91, 0xe1, 0x62, 0xe6, 0xec, 0x3d, 0x90, 0x65, 0x14,
|
||||||
|
0xcc, 0x6e, 0x0d, 0x9f, 0x95, 0xca, 0xef, 0xbc, 0xf7, 0x2f, 0x61, 0x1c,
|
||||||
|
0xbc, 0xe0, 0x62, 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x3e,
|
||||||
|
0x8a, 0xb3, 0xdd, 0x37, 0x13, 0x88, 0x08, 0x77, 0x74, 0x06, 0x30, 0x4b,
|
||||||
|
0x56, 0x1e, 0x70, 0x45, 0x69, 0x4e, 0x1b, 0xb1, 0x48, 0x6c, 0x1d, 0x5b,
|
||||||
|
0xf7, 0x4d, 0x01, 0xb0, 0x29, 0x16, 0xa4, 0xad, 0x3a, 0x1d, 0xca, 0x48,
|
||||||
|
0xca, 0x1b, 0x6b, 0x3c, 0x2f, 0x87, 0x69, 0xe2, 0xca, 0x55, 0x89, 0x98,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x79, 0x12, 0x60, 0xda, 0x9c, 0x00, 0xce, 0x70,
|
||||||
|
0x70, 0x6a, 0x55, 0x94, 0x27, 0xe5, 0xea, 0x3b, 0x79, 0xcf, 0x11, 0xf4,
|
||||||
|
0xaa, 0x74, 0xf4, 0x77, 0xaa, 0x43, 0xa2, 0x7a, 0xe2, 0x04, 0x5c, 0xde,
|
||||||
|
0x98, 0xfe, 0x01, 0x85, 0x3e, 0xfb, 0xec, 0xff, 0xff, 0xff, 0xff, 0xef,
|
||||||
|
0x5a, 0x7f, 0xf6, 0xb3, 0xa5, 0x15, 0xee, 0xab, 0x90, 0x00, 0x06, 0x19,
|
||||||
|
0x05, 0xd9, 0x81, 0x29, 0xd2, 0x56, 0x8b, 0x11, 0x62, 0x45, 0x72, 0x5c,
|
||||||
|
0x8a, 0x82, 0x5a, 0x8f, 0xfa, 0x47, 0x94, 0x56, 0xae, 0x56, 0xd3, 0xc6,
|
||||||
|
0x73, 0xe5, 0x29, 0xc5, 0x47, 0xba, 0x56, 0x9d, 0x96, 0xe5, 0x4d, 0x26,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x82, 0x15, 0xd9, 0x12, 0xa0, 0x00, 0xce, 0x5e,
|
||||||
|
0x70, 0x4f, 0x94, 0xba, 0x22, 0x92, 0x52, 0x2d, 0x3b, 0x6d, 0xa6, 0xf3,
|
||||||
|
0xc2, 0x4a, 0x84, 0x87, 0x2d, 0x74, 0x93, 0x81, 0x15, 0x16, 0x9e, 0x19,
|
||||||
|
0x72, 0xb1, 0x0f, 0xed, 0x2f, 0xf7, 0x1c, 0xf7, 0x55, 0xf3, 0x0d, 0xf8,
|
||||||
|
0x6b, 0x76, 0xae, 0x7d, 0x2d, 0xff, 0x57, 0xff, 0xff, 0xd8, 0x5b, 0xce,
|
||||||
|
0xce, 0xda, 0x65, 0x8d, 0x4d, 0x03, 0x90, 0xde, 0xaa, 0xa6, 0xf0, 0xb2,
|
||||||
|
0xe7, 0xb9, 0x42, 0xa1, 0x96, 0xf9, 0x50, 0xb7, 0xd6, 0x3f, 0x02, 0xab,
|
||||||
|
0xa2, 0x5a, 0xd0, 0xe8, 0x48, 0x8b, 0x86, 0x33, 0x4c, 0x72, 0xf6, 0xa6,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x7d, 0x17, 0xf9, 0x76, 0xa0, 0x00, 0xc6, 0x16,
|
||||||
|
0x94, 0xda, 0xe5, 0xef, 0xf3, 0x47, 0x7f, 0x23, 0x41, 0xf5, 0x67, 0x44,
|
||||||
|
0x11, 0xed, 0x73, 0xae, 0x46, 0xa3, 0x85, 0xf0, 0xdb, 0x9f, 0x46, 0x5f,
|
||||||
|
0xbe, 0xb9, 0x83, 0x8d, 0x37, 0xb4, 0xcf, 0x48, 0xa8, 0x38, 0xf8, 0xcc,
|
||||||
|
0x2c, 0xfc, 0x47, 0xbc, 0x29, 0x24, 0xb6, 0x44, 0x90, 0x2c, 0x4c, 0xc5,
|
||||||
|
0x7e, 0xef, 0xff, 0xff, 0xff, 0x7f, 0x7b, 0x19, 0xb1, 0x35, 0xb7, 0xbd,
|
||||||
|
0x40, 0x62, 0xee, 0x8b, 0xf2, 0x00, 0x2f, 0xec, 0xc5, 0x5a, 0xe1, 0x65,
|
||||||
|
0xd3, 0xcc, 0x49, 0x44, 0x22, 0x1e, 0x04, 0x7a, 0xb8, 0xe8, 0xc9, 0xa9,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x70, 0x15, 0x59, 0x36, 0xa8, 0x00, 0xc6, 0x1e,
|
||||||
|
0x70, 0x14, 0xd4, 0x18, 0xed, 0xff, 0x28, 0x1a, 0x3d, 0xde, 0xf4, 0xce,
|
||||||
|
0x77, 0x7a, 0x1b, 0x0e, 0x36, 0xdc, 0xe1, 0xa5, 0x37, 0xc1, 0x9f, 0xad,
|
||||||
|
0xf5, 0xd6, 0xf3, 0xb5, 0xd4, 0x7f, 0xb6, 0xb9, 0x31, 0xad, 0x28, 0xbc,
|
||||||
|
0xd7, 0x56, 0x4f, 0x7e, 0xdb, 0x6f, 0xe0, 0xed, 0x9d, 0x9e, 0x61, 0x28,
|
||||||
|
0x35, 0x15, 0x72, 0x7d, 0xff, 0xff, 0xff, 0xeb, 0xe8, 0xc3, 0x7b, 0x68,
|
||||||
|
0x82, 0xd8, 0xb5, 0x83, 0x72, 0x4c, 0x76, 0xd6, 0xd5, 0x00, 0xa3, 0xa7,
|
||||||
|
0xf8, 0xec, 0x85, 0x0c, 0x24, 0x59, 0x87, 0xdc, 0x44, 0x16, 0x9f, 0x02,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x6d, 0x14, 0x81, 0x32, 0xa4, 0x00, 0xc6, 0x1e,
|
||||||
|
0x70, 0x5b, 0xaf, 0x0f, 0x5e, 0xb1, 0x2a, 0x9b, 0xa3, 0xb3, 0xd4, 0x32,
|
||||||
|
0xd4, 0x2c, 0x97, 0x0e, 0x1e, 0xa2, 0x41, 0x14, 0xe6, 0x27, 0xc3, 0xff,
|
||||||
|
0xdb, 0xdf, 0x2f, 0x6d, 0x7e, 0x97, 0x85, 0xf6, 0x33, 0x54, 0x6e, 0x79,
|
||||||
|
0x82, 0x4a, 0x1a, 0xec, 0xfd, 0x11, 0x1a, 0x48, 0xaa, 0xd5, 0x25, 0x0a,
|
||||||
|
0x40, 0x21, 0xc9, 0xa4, 0xc8, 0x5a, 0x9a, 0x34, 0x89, 0x0e, 0xbc, 0x57,
|
||||||
|
0x6e, 0x88, 0x72, 0x9e, 0x49, 0x44, 0x49, 0x44, 0xe4, 0x7c, 0xb9, 0x13,
|
||||||
|
0x73, 0x70, 0xf9, 0xb7, 0x6a, 0xd7, 0xf8, 0x92, 0x5b, 0x10, 0x7a, 0xbe,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x6e, 0x11, 0x89, 0x12, 0xa8, 0x00, 0xc6, 0x18,
|
||||||
|
0x70, 0x82, 0x80, 0x51, 0x3a, 0x10, 0x0e, 0x40, 0xb7, 0x48, 0x4b, 0x7b,
|
||||||
|
0x04, 0x9a, 0xe9, 0x31, 0xdf, 0x02, 0x38, 0xa1, 0xa1, 0x41, 0x2c, 0x4a,
|
||||||
|
0x3d, 0x41, 0xaf, 0xb5, 0x62, 0x68, 0xb0, 0xe4, 0xb9, 0x3f, 0xff, 0xff,
|
||||||
|
0xff, 0x65, 0x35, 0x9d, 0xee, 0x0e, 0xf1, 0x39, 0x52, 0x3e, 0x44, 0x03,
|
||||||
|
0x9d, 0x97, 0xe3, 0x50, 0x3c, 0x09, 0xaa, 0xf7, 0x4c, 0x84, 0xe2, 0xd8,
|
||||||
|
0xcf, 0xd1, 0x34, 0x2c, 0x7e, 0x0d, 0x6f, 0x75, 0xa9, 0x2b, 0xe5, 0xf9,
|
||||||
|
0xdc, 0x63, 0xf8, 0xd9, 0xbb, 0x4b, 0x69, 0x0e, 0xad, 0x30, 0x27, 0x7a,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x7a, 0x13, 0x19, 0x16, 0xa4, 0x00, 0x7e, 0x12,
|
||||||
|
0x70, 0x7d, 0x37, 0x65, 0xf7, 0xb2, 0xa7, 0x77, 0xc3, 0x95, 0x29, 0x85,
|
||||||
|
0xd3, 0x83, 0x76, 0x59, 0xfd, 0xb7, 0x25, 0x5b, 0xef, 0xe4, 0x61, 0x25,
|
||||||
|
0x8a, 0x18, 0xbf, 0xef, 0xff, 0xff, 0xff, 0xfe, 0xdf, 0xa1, 0xc7, 0x95,
|
||||||
|
0x07, 0x52, 0x1b, 0x2b, 0x77, 0x9d, 0x20, 0x76, 0xe8, 0xad, 0x57, 0x03,
|
||||||
|
0x62, 0x24, 0x7a, 0x97, 0x00, 0xc0, 0x90, 0x1d, 0xc8, 0x97, 0x04, 0x48,
|
||||||
|
0x7a, 0xc7, 0xc8, 0xde, 0xd8, 0x6c, 0xf2, 0x77, 0xc0, 0xdc, 0xde, 0x45,
|
||||||
|
0x17, 0x1e, 0x50, 0x00, 0x46, 0x6e, 0x65, 0x91, 0xbe, 0x4e, 0xfa, 0xa6,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x80, 0x13, 0x71, 0x1e, 0x9c, 0x00, 0xce, 0x5e,
|
||||||
|
0x70, 0xd5, 0x70, 0x3c, 0x9d, 0xb6, 0x91, 0x8c, 0xff, 0x5b, 0xbb, 0xed,
|
||||||
|
0x48, 0x78, 0xa0, 0x8d, 0x22, 0xb5, 0x7d, 0x5f, 0xff, 0xff, 0xaf, 0xfe,
|
||||||
|
0x9f, 0xa9, 0xbd, 0x8c, 0x78, 0x72, 0xe7, 0x81, 0x43, 0x35, 0x98, 0x58,
|
||||||
|
0x85, 0xd4, 0x92, 0xc8, 0xa1, 0xcc, 0x49, 0x0d, 0xda, 0x94, 0xa1, 0xc6,
|
||||||
|
0x11, 0x85, 0x32, 0x8f, 0x6b, 0xf7, 0x42, 0xf6, 0xff, 0xdc, 0x9b, 0xc3,
|
||||||
|
0x78, 0x96, 0xf5, 0x21, 0xf6, 0xad, 0x80, 0x80, 0x5f, 0x27, 0x40, 0xb0,
|
||||||
|
0xca, 0xaf, 0x3b, 0x1c, 0xdf, 0xc9, 0xad, 0xf0, 0x3d, 0x46, 0x70, 0x7a,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x85, 0x12, 0xb1, 0x26, 0x98, 0x00, 0xc5, 0x16,
|
||||||
|
0x70, 0x3d, 0x0d, 0x7f, 0xd7, 0x50, 0x75, 0x4f, 0xbb, 0xff, 0xff, 0xff,
|
||||||
|
0xf2, 0x32, 0xcc, 0x4f, 0xfa, 0x95, 0x7b, 0x2c, 0xd7, 0x56, 0x02, 0x7f,
|
||||||
|
0x8b, 0x32, 0x15, 0x0e, 0x9a, 0x43, 0x71, 0xe8, 0x64, 0x70, 0x31, 0xc5,
|
||||||
|
0x73, 0xc8, 0x7a, 0x7a, 0x9a, 0x7b, 0x76, 0x5b, 0xb4, 0xb7, 0x77, 0x6e,
|
||||||
|
0xc3, 0xbf, 0xf9, 0x45, 0xb9, 0xcf, 0x7c, 0x68, 0xd9, 0x10, 0xfa, 0x0a,
|
||||||
|
0x0d, 0x22, 0x4e, 0x88, 0x8f, 0xfb, 0xdd, 0xff, 0xd6, 0xfb, 0xad, 0xc8,
|
||||||
|
0xd7, 0xd7, 0xf6, 0xf4, 0xff, 0xcb, 0xb8, 0xd7, 0xff, 0xff, 0xff, 0xe2,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x8d, 0x12, 0x91, 0x12, 0x90, 0x00, 0xc6, 0x96,
|
||||||
|
0x70, 0xb0, 0xef, 0xfa, 0x49, 0xa5, 0xca, 0xa8, 0x88, 0xf5, 0x96, 0xc7,
|
||||||
|
0x1f, 0xc0, 0xa3, 0xc0, 0xa4, 0x34, 0x2f, 0x65, 0xee, 0x51, 0x8b, 0x41,
|
||||||
|
0x0d, 0x39, 0x6e, 0xb9, 0x90, 0xc1, 0x07, 0x8a, 0xcb, 0xe1, 0x8a, 0xd5,
|
||||||
|
0xf5, 0x2a, 0x8b, 0x34, 0x91, 0xd1, 0x52, 0xc8, 0xec, 0xed, 0xa9, 0xd5,
|
||||||
|
0x46, 0x61, 0x60, 0xd0, 0x52, 0x4a, 0x41, 0x6d, 0x23, 0x74, 0x56, 0xf7,
|
||||||
|
0x4b, 0x80, 0xc0, 0x3f, 0xfe, 0xa7, 0xae, 0xdb, 0x7f, 0xff, 0xff, 0xff,
|
||||||
|
0xfa, 0x7a, 0xfa, 0x55, 0x46, 0x63, 0x12, 0x28, 0xc1, 0x86, 0x35, 0x34,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x95, 0x12, 0xa1, 0x12, 0x84, 0x00, 0xd6, 0x92,
|
||||||
|
0x70, 0x0f, 0x2d, 0x43, 0x56, 0x10, 0xbb, 0xcb, 0x7a, 0x04, 0x43, 0x12,
|
||||||
|
0xca, 0x82, 0x82, 0x4a, 0x23, 0x58, 0x18, 0x33, 0x5a, 0x72, 0x98, 0x73,
|
||||||
|
0x93, 0x0e, 0xe1, 0x4c, 0xb0, 0x58, 0x0a, 0x5d, 0x98, 0xc6, 0x28, 0x5c,
|
||||||
|
0x58, 0x35, 0x35, 0x08, 0x40, 0x08, 0x97, 0xc6, 0x9a, 0xd6, 0xc1, 0x51,
|
||||||
|
0xa0, 0xa8, 0x35, 0x12, 0xd4, 0x0d, 0x05, 0x4e, 0xea, 0x3d, 0xd4, 0x7b,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0x2a, 0x10, 0xa4, 0x12, 0x54, 0x7c, 0x38,
|
||||||
|
0xa8, 0x43, 0x2e, 0x16, 0x5e, 0x60, 0x17, 0x0d, 0xad, 0x9d, 0xa6, 0x2d,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0x9d, 0x10, 0x50, 0xaa, 0x7c, 0x00, 0xd6, 0x12,
|
||||||
|
0x4c, 0x55, 0x7e, 0x1c, 0x55, 0x55, 0xb6, 0x06, 0x70, 0x54, 0x32, 0xd6,
|
||||||
|
0x00, 0xa3, 0x5a, 0x59, 0x01, 0x38, 0x44, 0x79, 0x24, 0xce, 0xd2, 0xd6,
|
||||||
|
0x15, 0x0c, 0x99, 0x85, 0x5d, 0x88, 0x81, 0xa5, 0x07, 0x5a, 0x74, 0x4b,
|
||||||
|
0xb4, 0x96, 0xf4, 0xce, 0x86, 0xb5, 0x3e, 0xe5, 0x3d, 0x6b, 0xf7, 0xfc,
|
||||||
|
0x97, 0xd7, 0xfe, 0xaa, 0x02, 0x74, 0x4e, 0x08, 0x59, 0x78, 0x47, 0xa5,
|
||||||
|
0x11, 0xc5, 0xc4, 0x95, 0x13, 0x23, 0x0c, 0xe4, 0x51, 0xb2, 0x39, 0xa0,
|
||||||
|
0x9c, 0x47, 0xf9, 0xb2, 0x71, 0xa2, 0x80, 0x8f, 0x8b, 0x87, 0x8d, 0x93,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xae, 0x12, 0x18, 0xb2, 0x5c, 0x00, 0xd6, 0x12,
|
||||||
|
0x4c, 0x4e, 0x2e, 0x37, 0x3b, 0x3b, 0xb3, 0xfc, 0xb2, 0xd4, 0x3f, 0xd6,
|
||||||
|
0x5b, 0x3f, 0x96, 0x19, 0xac, 0xbd, 0x60, 0xa0, 0x81, 0x03, 0x8f, 0x8b,
|
||||||
|
0x33, 0xff, 0x82, 0xc2, 0xe2, 0x37, 0x7d, 0x4d, 0xfe, 0x2a, 0x28, 0xdf,
|
||||||
|
0xff, 0x16, 0xd4, 0x2f, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e, 0x31, 0x30,
|
||||||
|
0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xb8, 0x11, 0x20, 0xda, 0x00, 0x00, 0x62, 0x06,
|
||||||
|
0x70, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xc6, 0x11, 0xb9, 0x49, 0x90, 0x00, 0x79, 0x86,
|
||||||
|
0x94, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x4c, 0x41, 0x4d, 0x45, 0x33, 0x2e,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x31, 0x30, 0x30, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||||
|
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x1c, 0xe0, 0x43, 0x42, 0x88, 0x20,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x9a, 0x09, 0xa0, 0x5e, 0x03, 0x90, 0x30, 0x02, 0x46, 0x3f, 0xd7,
|
||||||
|
0x8b, 0x61, 0x38, 0x2e, 0x04, 0x81, 0x40, 0x30, 0x05, 0x93, 0xec, 0x2c,
|
||||||
|
0x8c, 0x13, 0x3f, 0x0c, 0x23, 0x36, 0x81, 0xc8, 0xd1, 0xa3, 0xa6, 0xc4,
|
||||||
|
0x00, 0x80, 0x20, 0x18, 0x8a, 0xe2, 0xb2, 0x7b, 0xeb, 0x8b, 0x34, 0x00,
|
||||||
|
0x00, 0x00, 0x03, 0x17, 0xf1, 0x02, 0x00, 0x23, 0xff, 0x10, 0x00, 0x00,
|
||||||
|
0xbf, 0x40, 0x80, 0x00, 0x02, 0x3d, 0x11, 0x11, 0x13, 0x74, 0xc3, 0x81,
|
||||||
|
0x99, 0x71, 0xc0, 0xf8, 0x3e, 0xc0, 0xf9, 0x70, 0x7c, 0x40, 0x08, 0x41,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x01, 0x87, 0x1f, 0xc9, 0x88, 0x1f, 0x39, 0xf0, 0xc1, 0x0d, 0x43,
|
||||||
|
0x1d, 0xfc, 0x49, 0x59, 0xf5, 0x9c, 0x89, 0xc3, 0xea, 0x2d, 0xc9, 0x54,
|
||||||
|
0x40, 0xa7, 0x2a, 0x65, 0xd5, 0x2a, 0x58, 0x67, 0xdd, 0xc5, 0x7a, 0x8b,
|
||||||
|
0x54, 0x86, 0xcd, 0x79, 0xc6, 0x92, 0xce, 0x39, 0x51, 0x30, 0x49, 0x10,
|
||||||
|
0xa9, 0xb6, 0x4a, 0xa0, 0x00, 0x48, 0xcb, 0x81, 0x22, 0x23, 0x60, 0x8b,
|
||||||
|
0xad, 0x23, 0x40, 0x30, 0x15, 0x19, 0x00, 0xa0, 0x4a, 0x12, 0x51, 0xa3,
|
||||||
|
0x3a, 0xca, 0xc4, 0xc8, 0x91, 0x6c, 0x56, 0x44, 0xd4, 0x91, 0x6c, 0xa6,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xac, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xcd, 0x22, 0x9a, 0x4d, 0x7a, 0x35, 0x16, 0xaa, 0x25, 0xa7, 0x58,
|
||||||
|
0x05, 0x4c, 0x95, 0x6f, 0xef, 0x39, 0x26, 0xa2, 0x52, 0x4e, 0xd5, 0x53,
|
||||||
|
0xe5, 0x92, 0x98, 0xaa, 0xce, 0xc4, 0xb6, 0x5e, 0x73, 0xef, 0x67, 0x96,
|
||||||
|
0xdf, 0xfc, 0xb6, 0xcd, 0x56, 0x9d, 0xb2, 0x75, 0x82, 0xcd, 0x23, 0x9e,
|
||||||
|
0x13, 0x12, 0x7c, 0x54, 0x19, 0x11, 0x80, 0xb9, 0x29, 0x22, 0x4b, 0x3b,
|
||||||
|
0x59, 0xd1, 0x2b, 0x83, 0xb5, 0x08, 0x70, 0xc9, 0x27, 0x87, 0x5a, 0x81,
|
||||||
|
0x8d, 0x74, 0x7a, 0x9b, 0x07, 0xb2, 0x2d, 0x38, 0x27, 0x30, 0x7c, 0x95,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xff, 0x1b, 0x19, 0x7d, 0xf0, 0x00, 0x7a, 0x46,
|
||||||
|
0x94, 0x12, 0xa9, 0xa9, 0x3a, 0xb9, 0x2a, 0x58, 0xe9, 0xd4, 0x97, 0x84,
|
||||||
|
0xe0, 0xed, 0xfd, 0xca, 0x88, 0xa8, 0xa9, 0xfe, 0xe5, 0x30, 0x50, 0x40,
|
||||||
|
0x8e, 0x47, 0xcc, 0x50, 0x40, 0x84, 0x86, 0x9f, 0xfe, 0x02, 0x09, 0x0a,
|
||||||
|
0x86, 0x6b, 0x14, 0x6f, 0xeb, 0x14, 0xe2, 0xc2, 0xba, 0xc5, 0x1a, 0x81,
|
||||||
|
0xe2, 0xa2, 0xd8, 0x48, 0x5c, 0x46, 0xe8, 0xa8, 0xb2, 0x4c, 0x41, 0x4d,
|
||||||
|
0x45, 0x33, 0x2e, 0x31, 0x30, 0x30, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xe5, 0x1f, 0x9a, 0x31, 0xf8, 0x00, 0xc2, 0x4c,
|
||||||
|
0xb8, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xff, 0xf3, 0x44, 0xc4, 0xb9, 0x12, 0xa9, 0x25, 0x88, 0x00, 0x7a, 0x44,
|
||||||
|
0x70, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
|
||||||
|
};
|
||||||
|
unsigned int zero_mp3_len = 4320;
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-mixer-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Simple Demo for mixing 2 input streams
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-11-15
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "drums.h"
|
||||||
|
#include "guitar.h"
|
||||||
|
|
||||||
|
InputMixer<int16_t> mixer;
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
MemoryStream drums(drums_raw, drums_raw_len);
|
||||||
|
MemoryStream guitar(guitar_raw, guitar_raw_len);
|
||||||
|
StreamCopy copier(kit, mixer);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// auto restart when MemoryStream has ended
|
||||||
|
drums.setLoop(true);
|
||||||
|
guitar.setLoop(true);
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.channels = 1;
|
||||||
|
cfg.sample_rate = 8000;
|
||||||
|
kit.begin(cfg);
|
||||||
|
// max volume
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
mixer.add(drums);
|
||||||
|
mixer.add(guitar);
|
||||||
|
mixer.begin(cfg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { copier.copy(); }
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# AudioActions
|
||||||
|
|
||||||
|
Originally I was of the opinion that the program logic for __reading of the GPIO pins__ and the processing of the related actions should belong into a specific __Arduino sketch__ and should not be part of an Audio Framework.
|
||||||
|
|
||||||
|
The [Audio Kit](https://docs.ai-thinker.com/en/esp32-audio-kit) made me revise this because I think that an Arduino Sketch should be __as concise as possible__. For this I have created the AudioActions class which has been integrated into the AudioKit.
|
||||||
|
|
||||||
|
Since the Audio Kit does not have any display, I think to use TTS is a good choice.
|
||||||
|
You just need to define you __handler methods__ (button1, button2...) and assign them to the __GPIO pins__.
|
||||||
|
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||||
|
- [Audio Driver](https://github.com/pschatzmann/arduino-audio-driver)
|
||||||
|
- [FLITE](https://github.com/pschatzmann/arduino-flite)
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* @file stream-pins-audiokit.ino
|
||||||
|
* @brief see
|
||||||
|
* https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/streams-pins-audiokit/README.md
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "flite_arduino.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
Flite flite(kit);
|
||||||
|
|
||||||
|
void button1(bool, int, void*) { flite.say("Button One"); }
|
||||||
|
void button2(bool, int, void*) { flite.say("Button Two"); }
|
||||||
|
void button3(bool, int, void*) { flite.say("Button Three"); }
|
||||||
|
void button4(bool, int, void*) { flite.say("Button Four"); }
|
||||||
|
|
||||||
|
// Arduino setup
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
//AUDIOKIT_LOG_LEVEL = AudioKitDebug;
|
||||||
|
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.bits_per_sample = 16;
|
||||||
|
cfg.channels = 1;
|
||||||
|
cfg.sample_rate = 8000;
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// Assign pins to methods
|
||||||
|
kit.addAction(kit.getKey(1), button1);
|
||||||
|
kit.addAction(kit.getKey(2), button2);
|
||||||
|
kit.addAction(kit.getKey(3), button3);
|
||||||
|
kit.addAction(kit.getKey(4), button4);
|
||||||
|
|
||||||
|
// example with actions using lambda expression
|
||||||
|
auto down = [](bool,int,void*) { AudioBoardStream::actionVolumeDown(true, -1, nullptr); flite.say("Volume down"); };
|
||||||
|
kit.addAction(kit.getKey(5), down);
|
||||||
|
auto up = [](bool,int,void*) { AudioBoardStream::actionVolumeUp(true, -1, nullptr ); flite.say("Volume up"); };
|
||||||
|
kit.addAction(kit.getKey(6), up);
|
||||||
|
|
||||||
|
flite.say("Please push a button");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Loop
|
||||||
|
void loop() { kit.processActions(); }
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
RTTTLOutput<int16_t> rtttl(sineWave, out);
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
// Open Serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
delay(5000);
|
||||||
|
|
||||||
|
// start I2S
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto config = out.defaultConfig(TX_MODE);
|
||||||
|
config.copyFrom(info);
|
||||||
|
out.begin(config);
|
||||||
|
|
||||||
|
// Setup sine wave (optional)
|
||||||
|
sineWave.begin(info);
|
||||||
|
Serial.println("started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - copy sound to out
|
||||||
|
void loop() {
|
||||||
|
rtttl.begin(info);
|
||||||
|
rtttl.print("ComplexDemo: d=8, o=5, b=140: c4 e g c6 a5 g4 e g a g4 e c4 e2 g4 c6 a5 g4 e g a g4 e c2 p c4 e g c6 a5 g4 e g a g4 e c4 e2 g4 c6 a5 g4 e g a g4 e c2");
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-sd-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Just a small demo, how to use files with the SD library with a streaming decoder
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-10-09
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <SD.h>
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecFLAC.h"
|
||||||
|
|
||||||
|
|
||||||
|
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||||
|
FLACDecoder dec;
|
||||||
|
File audioFile;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup audiokit before SD!
|
||||||
|
auto config = i2s.defaultConfig(TX_MODE);
|
||||||
|
config.sd_active = true;
|
||||||
|
i2s.begin(config);
|
||||||
|
|
||||||
|
// setup file
|
||||||
|
SD.begin(chipSelect);
|
||||||
|
audioFile = SD.open("/flac/test2.flac");
|
||||||
|
|
||||||
|
// setup decoder
|
||||||
|
dec.setInput(audioFile);
|
||||||
|
dec.setOutput(i2s);
|
||||||
|
dec.begin();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
dec.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-sd_m4a-audiokit.ino
|
||||||
|
* @author Peter Schatzmann
|
||||||
|
* @brief Example for decoding M4A files on the AudioKit using the AudioBoardStream
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2023-10-01
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecALAC.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecAACHelix.h"
|
||||||
|
#include "AudioTools/AudioCodecs/ContainerM4A.h"
|
||||||
|
#include "AudioTools/AudioCodecs/MultiDecoder.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
#include "SD.h"
|
||||||
|
|
||||||
|
MultiDecoder multi_decoder;
|
||||||
|
ContainerM4A dec_m4a(multi_decoder);
|
||||||
|
AACDecoderHelix dec_aac;
|
||||||
|
DecoderALAC dec_alac;
|
||||||
|
AudioBoardStream out(AudioKitEs8388V1);
|
||||||
|
EncodedAudioOutput decoder_output(&out, &dec_m4a);
|
||||||
|
File file;
|
||||||
|
StreamCopy copier(decoder_output, file);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// start AudioBoard with setup of CD pins
|
||||||
|
auto cfg = out.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = true;
|
||||||
|
if (!out.begin(cfg)){
|
||||||
|
Serial.println("Failed to start CSV output!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SD.begin(PIN_AUDIO_KIT_SD_CARD_CS)){
|
||||||
|
Serial.println("SD Card initialization failed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = SD.open("/m4a/aac.m4a");
|
||||||
|
if (!file) {
|
||||||
|
Serial.println("Failed to open file!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mp4 supports alac and aac
|
||||||
|
multi_decoder.addDecoder(dec_alac,"audio/alac");
|
||||||
|
multi_decoder.addDecoder(dec_aac,"audio/aac");
|
||||||
|
|
||||||
|
// start decoder output
|
||||||
|
if(!decoder_output.begin()) {
|
||||||
|
Serial.println("Failed to start decoder output!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("M4A decoding started...");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-sd-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Just a small demo, how to use files with the SD library
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-10-09
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <SD.h>
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
|
||||||
|
|
||||||
|
const int chipSelect=PIN_AUDIO_KIT_SD_CARD_CS;
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1); // final output of decoded stream
|
||||||
|
EncodedAudioStream decoder(&i2s, new MP3DecoderHelix()); // Decoding stream
|
||||||
|
StreamCopy copier;
|
||||||
|
File audioFile;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup audiokit before SD!
|
||||||
|
auto config = i2s.defaultConfig(TX_MODE);
|
||||||
|
config.sd_active = true;
|
||||||
|
i2s.begin(config);
|
||||||
|
|
||||||
|
// setup file
|
||||||
|
SD.begin(chipSelect);
|
||||||
|
audioFile = SD.open("/ZZ Top/Unknown Album/Lowrider.mp3");
|
||||||
|
|
||||||
|
// setup I2S based on sampling rate provided by decoder
|
||||||
|
decoder.begin();
|
||||||
|
|
||||||
|
// begin copy
|
||||||
|
copier.begin(decoder, audioFile);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
if (!copier.copy()) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-sdmmc_wav-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief A simple example that shows how to play (eg. a 24bit) wav file
|
||||||
|
* @date 2021-11-07
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FS.h"
|
||||||
|
#include "SD_MMC.h"
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1);
|
||||||
|
WAVDecoder wav;
|
||||||
|
EncodedAudioStream encoded(&i2s, &wav); // Decoding stream
|
||||||
|
File audioFile;
|
||||||
|
StreamCopy copier(encoded, audioFile);
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup audiokit before SD!
|
||||||
|
auto config = i2s.defaultConfig(TX_MODE);
|
||||||
|
config.sd_active = false;
|
||||||
|
i2s.begin(config);
|
||||||
|
i2s.setVolume(1.0);
|
||||||
|
|
||||||
|
// open sdmmc
|
||||||
|
if (!SD_MMC.begin("/sdcard", false)){
|
||||||
|
Serial.println("SD_MMC Error");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
// open file
|
||||||
|
audioFile = SD_MMC.open("/wav24/test.wav");
|
||||||
|
if (!audioFile){
|
||||||
|
Serial.println("File does not exist");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// start decoder stream
|
||||||
|
encoded.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# A Simple Synthesizer for the AI Thinker AudioKit
|
||||||
|
|
||||||
|
I was taking the synthbasic example, extended it to handle multiple keys at the same time and wrapped it into a nice, easy to use class.
|
||||||
|
|
||||||
|
Here is a Synthesizer in just 30 lines of code..
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||||
|
- [Midi](https://github.com/pschatzmann/arduino-midi)
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-synth-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
Synthesizer synthesizer;
|
||||||
|
GeneratedSoundStream<int16_t> in(synthesizer);
|
||||||
|
StreamCopy copier(kit, in);
|
||||||
|
SynthesizerKey keys[] = {{kit.getKey(1), N_C3},{kit.getKey(2), N_D3},{kit.getKey(3), N_E3},{kit.getKey(4), N_F3},{kit.getKey(5), N_G3},{kit.getKey(6), N_A3},{0,0}};
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||||
|
|
||||||
|
// Setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(80);
|
||||||
|
|
||||||
|
// define synthesizer keys for AudioKit
|
||||||
|
synthesizer.setKeys(kit.audioActions(), keys, AudioActions::ActiveLow);
|
||||||
|
synthesizer.setMidiName("AudioKit Synthesizer");
|
||||||
|
// Setup sound generation & synthesizer based on AudioKit default settings
|
||||||
|
in.begin(cfg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||||
|
|
||||||
|
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-synthbasic-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||||
|
* @copyright GPLv3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
SineWaveGenerator<int16_t> sine;
|
||||||
|
GeneratedSoundStream<int16_t> in(sine);
|
||||||
|
StreamCopy copier(kit, in);
|
||||||
|
|
||||||
|
void actionKeyOn(bool active, int pin, void* ptr){
|
||||||
|
int freq = *((float*)ptr);
|
||||||
|
sine.setFrequency(freq);
|
||||||
|
in.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void actionKeyOff(bool active, int pin, void* ptr){
|
||||||
|
in.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
// We want to play some notes on the AudioKit keys
|
||||||
|
void setupActions(){
|
||||||
|
// assign buttons to notes
|
||||||
|
auto act_low = AudioActions::ActiveLow;
|
||||||
|
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||||
|
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||||
|
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||||
|
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||||
|
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||||
|
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||||
|
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioLogger::instance().begin(Serial,AudioLogger::Info);
|
||||||
|
|
||||||
|
// Setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(80);
|
||||||
|
|
||||||
|
// Setup sound generation based on AudioKit settins
|
||||||
|
in.begin(cfg);
|
||||||
|
|
||||||
|
// activate keys
|
||||||
|
setupActions();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||||
|
|
||||||
|
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||||
|
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-synthbasic-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||||
|
* ADSR
|
||||||
|
* @copyright GPLv3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
SineWaveGenerator<int16_t> sine;
|
||||||
|
GeneratedSoundStream<int16_t> sine_stream(sine);
|
||||||
|
AudioEffectStream effects(sine_stream);
|
||||||
|
ADSRGain adsr(0.0001,0.0001, 0.9 , 0.0002);
|
||||||
|
StreamCopy copier(kit, effects);
|
||||||
|
|
||||||
|
void actionKeyOn(bool active, int pin, void* ptr){
|
||||||
|
Serial.println("KeyOn");
|
||||||
|
float freq = *((float*)ptr);
|
||||||
|
sine.setFrequency(freq);
|
||||||
|
adsr.keyOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void actionKeyOff(bool active, int pin, void* ptr){
|
||||||
|
Serial.println("KeyOff");
|
||||||
|
adsr.keyOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
// We want to play some notes on the AudioKit keys
|
||||||
|
void setupActions(){
|
||||||
|
// assign buttons to notes
|
||||||
|
auto act_low = AudioActions::ActiveLow;
|
||||||
|
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||||
|
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||||
|
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||||
|
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||||
|
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||||
|
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||||
|
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||||
|
|
||||||
|
// setup effects
|
||||||
|
effects.addEffect(adsr);
|
||||||
|
|
||||||
|
// Setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(80);
|
||||||
|
|
||||||
|
// Setup sound generation based on AudioKit settins
|
||||||
|
sine.begin(cfg, 0);
|
||||||
|
sine_stream.begin(cfg);
|
||||||
|
effects.begin(cfg);
|
||||||
|
|
||||||
|
// activate keys
|
||||||
|
setupActions();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# A Simple Basic Synthesizer for the AI Thinker Audio Kit
|
||||||
|
|
||||||
|
A [detailed description can be found in my blog](https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/) ...
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
|
||||||
|
- [Arduino Audio Tools - Midi](https://github.com/pschatzmann/arduino-midi)
|
||||||
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-synthbasic-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audio-kit-building-a-simple-synthesizer-with-the-audiotools-library/)
|
||||||
|
* Midi Support
|
||||||
|
* @copyright GPLv3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include <Midi.h>
|
||||||
|
|
||||||
|
SineWaveGenerator<int16_t> sine;
|
||||||
|
GeneratedSoundStream<int16_t> sine_stream(sine);
|
||||||
|
ADSRGain adsr(0.0001,0.0001, 0.9 , 0.0002);
|
||||||
|
AudioEffectStream effects(sine_stream);
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
StreamCopy copier(kit, effects);
|
||||||
|
|
||||||
|
class SynthAction : public MidiAction {
|
||||||
|
public:
|
||||||
|
void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
|
||||||
|
int frq = MidiCommon::noteToFrequency(note);
|
||||||
|
sine.setFrequency(frq);
|
||||||
|
adsr.keyOn();
|
||||||
|
}
|
||||||
|
void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity) {
|
||||||
|
adsr.keyOff();
|
||||||
|
}
|
||||||
|
void onControlChange(uint8_t channel, uint8_t controller, uint8_t value) {}
|
||||||
|
void onPitchBend(uint8_t channel, uint8_t value) {}
|
||||||
|
} action;
|
||||||
|
|
||||||
|
MidiBleServer ble("MidiServer", &action);
|
||||||
|
|
||||||
|
|
||||||
|
void actionKeyOn(bool active, int pin, void* ptr){
|
||||||
|
Serial.println("KeyOn");
|
||||||
|
float freq = *((float*)ptr);
|
||||||
|
sine.setFrequency(freq);
|
||||||
|
adsr.keyOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void actionKeyOff(bool active, int pin, void* ptr){
|
||||||
|
Serial.println("KeyOff");
|
||||||
|
adsr.keyOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
// We want to play some notes on the AudioKit keys
|
||||||
|
void setupActions(){
|
||||||
|
// assign buttons to notes
|
||||||
|
auto act_low = AudioActions::ActiveLow;
|
||||||
|
static float note[] = {N_C3, N_D3, N_E3, N_F3, N_G3, N_A3}; // frequencies
|
||||||
|
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||||
|
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||||
|
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||||
|
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||||
|
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||||
|
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||||
|
|
||||||
|
// setup effects
|
||||||
|
effects.addEffect(adsr);
|
||||||
|
|
||||||
|
// Setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
kit.setVolume(80);
|
||||||
|
|
||||||
|
// Setup sound generation based on AudioKit settins
|
||||||
|
sine.begin(cfg, 0);
|
||||||
|
sine_stream.begin(cfg);
|
||||||
|
effects.begin(cfg);
|
||||||
|
|
||||||
|
// activate keys
|
||||||
|
setupActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the data
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Implementing a Synthesizer using the STK Framwork
|
||||||
|
|
||||||
|
We can use the STK framework to implement a Synthesizer which receives Midi Messages and translates them
|
||||||
|
into sound. Here we use a Clarinet...
|
||||||
|
|
||||||
|
For [further info see my blog](https://www.pschatzmann.ch/home/2021/12/21/ai-thinker-audiokit-a-simply-synthesizer-with-stk/)
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
- https://github.com/pschatzmann/arduino-midi
|
||||||
|
- https://github.com/pschatzmann/Arduino-STK
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-synthstk-audiokit.ino
|
||||||
|
* @brief see https://www.pschatzmann.ch/home/2021/12/17/ai-thinker-audiokit-a-simple-synthesizer-with-stk/
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright Copyright (c) 2021
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "StkAll.h"
|
||||||
|
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
Clarinet clarinet(440);
|
||||||
|
Voicer voicer;
|
||||||
|
ArdStreamOut output(&kit);
|
||||||
|
float noteAmplitude = 128;
|
||||||
|
int group = 0;
|
||||||
|
|
||||||
|
void actionKeyOn(bool active, int pin, void* ptr){
|
||||||
|
float note = *((float*)ptr);
|
||||||
|
voicer.noteOn(note, noteAmplitude, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
void actionKeyOff(bool active, int pin, void* ptr){
|
||||||
|
float note = *((float*)ptr);
|
||||||
|
voicer.noteOff(note, noteAmplitude, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We want to play some notes on the AudioKit keys
|
||||||
|
void setupActions(){
|
||||||
|
// assign buttons to notes
|
||||||
|
auto act_low = AudioActions::ActiveLow;
|
||||||
|
static int note[] = {48,50,52,53,55,57}; // midi keys
|
||||||
|
kit.audioActions().add(kit.getKey(1), actionKeyOn, actionKeyOff, act_low, &(note[0])); // C3
|
||||||
|
kit.audioActions().add(kit.getKey(2), actionKeyOn, actionKeyOff, act_low, &(note[1])); // D3
|
||||||
|
kit.audioActions().add(kit.getKey(3), actionKeyOn, actionKeyOff, act_low, &(note[2])); // E3
|
||||||
|
kit.audioActions().add(kit.getKey(4), actionKeyOn, actionKeyOff, act_low, &(note[3])); // F3
|
||||||
|
kit.audioActions().add(kit.getKey(5), actionKeyOn, actionKeyOff, act_low, &(note[4])); // G3
|
||||||
|
kit.audioActions().add(kit.getKey(6), actionKeyOn, actionKeyOff, act_low, &(note[5])); // A3
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
AudioLogger::instance().begin(Serial,AudioLogger::Warning);
|
||||||
|
|
||||||
|
voicer.addInstrument(&clarinet, group);
|
||||||
|
|
||||||
|
// define data format
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.channels = 1;
|
||||||
|
cfg.bits_per_sample = 16;
|
||||||
|
cfg.sample_rate = Stk::sampleRate();
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// play notes with keys
|
||||||
|
setupActions();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
for (int j=0;j<1024;j++) {
|
||||||
|
output.tick( voicer.tick() );
|
||||||
|
}
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
## Using the AI Thinker ESP32 with Tensoflow Lite to Generate Audio
|
||||||
|
|
||||||
|
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress and because I was tired of all the wires I had to connect to implement my different scenarios that are possible with my [Arduino Audio Tools Library](https://github.com/pschatzmann/arduino-audio-tools), I thought it to be a good idea to buy this board. You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
|
||||||
|
The starting point is the good overview provided by [the "Hallo World" example of Tensorflow Lite](https://www.tensorflow.org/lite/microcontrollers/get_started_low_level#train_a_model) which describes how to create, train and use a model which based on the __sine function__. Further information can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Tensorflow-Lite----Audio-Output/_edit)
|
||||||
|
|
||||||
|
|
||||||
|
### Note
|
||||||
|
|
||||||
|
The log level has been set to Info to help you to identify any problems. Please change it to AudioLogger::Warning to get the best sound quality!
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
- https://github.com/pschatzmann/tflite-micro-arduino-examples
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
const unsigned char g_model[] = {
|
||||||
|
0x20, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x14, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x14, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
|
||||||
|
0x28, 0x01, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
|
||||||
|
0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x09, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0xdc, 0x07, 0x00, 0x00,
|
||||||
|
0x30, 0x07, 0x00, 0x00, 0xbc, 0x05, 0x00, 0x00, 0x18, 0x05, 0x00, 0x00,
|
||||||
|
0x94, 0x04, 0x00, 0x00, 0x2c, 0x04, 0x00, 0x00, 0xf0, 0x08, 0x00, 0x00,
|
||||||
|
0xec, 0x08, 0x00, 0x00, 0xe8, 0x08, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
|
||||||
|
0x10, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||||
|
0x0f, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x5f,
|
||||||
|
0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||||
|
0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34, 0x00, 0xba, 0xf8, 0xff, 0xff,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||||
|
0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00,
|
||||||
|
0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x6d, 0x69, 0x6e, 0x5f,
|
||||||
|
0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73,
|
||||||
|
0x69, 0x6f, 0x6e, 0x00, 0x0a, 0xf9, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x31, 0x2e, 0x31, 0x34, 0x2e, 0x30, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||||
|
0x4d, 0x4c, 0x49, 0x52, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74,
|
||||||
|
0x65, 0x64, 0x2e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x04, 0x00,
|
||||||
|
0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||||
|
0x44, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
|
||||||
|
0x44, 0x07, 0x00, 0x00, 0xc8, 0x06, 0x00, 0x00, 0x3c, 0x06, 0x00, 0x00,
|
||||||
|
0x88, 0x05, 0x00, 0x00, 0x24, 0x04, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00,
|
||||||
|
0xfc, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, 0x1c, 0x01, 0x00, 0x00,
|
||||||
|
0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0xc0, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x5a, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x08, 0x18, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xa0, 0xf8, 0xff, 0xff,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
|
||||||
|
0x54, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00,
|
||||||
|
0x0a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||||
|
0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x53, 0x74, 0x61, 0x74,
|
||||||
|
0x65, 0x66, 0x75, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f,
|
||||||
|
0x6e, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x3a, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x3c, 0xf9, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x2c, 0xce, 0x0a, 0x3c, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00,
|
||||||
|
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x0c, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
|
||||||
|
0x78, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
|
||||||
|
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
|
||||||
|
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74,
|
||||||
|
0x4d, 0x75, 0x6c, 0x3b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||||
|
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33,
|
||||||
|
0x2f, 0x52, 0x65, 0x6c, 0x75, 0x3b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e,
|
||||||
|
0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65,
|
||||||
|
0x5f, 0x33, 0x2f, 0x42, 0x69, 0x61, 0x73, 0x41, 0x64, 0x64, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x2c, 0xfa, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0xe4, 0xd1, 0xc0, 0x3b, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00,
|
||||||
|
0x07, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||||
|
0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0b, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x24, 0xfb, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x18, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x52, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||||
|
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
|
||||||
|
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x3b, 0x73, 0x65, 0x71, 0x75,
|
||||||
|
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
|
||||||
|
0x73, 0x65, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x3b, 0x73, 0x65,
|
||||||
|
0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64,
|
||||||
|
0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x2f, 0x42, 0x69, 0x61, 0x73, 0x41,
|
||||||
|
0x64, 0x64, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x44, 0xfb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0xdf, 0x47, 0x3c,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x6a, 0xfc, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x8c, 0xef, 0xff, 0xff, 0x56, 0xfc, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||||
|
0x65, 0x5f, 0x34, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xac, 0xfb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x22, 0xd9, 0x51, 0x38, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xfc, 0xff, 0xff,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x21, 0xa5, 0x8b, 0xca,
|
||||||
|
0x5e, 0x1d, 0xce, 0x42, 0x9d, 0xce, 0x1f, 0xb0, 0xdf, 0x54, 0x2f, 0x81,
|
||||||
|
0xc6, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||||
|
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34,
|
||||||
|
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x2c, 0xfc, 0xff, 0xff,
|
||||||
|
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0xce, 0x4d, 0x0b, 0x3c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x4e, 0xfd, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x04, 0x00, 0x00,
|
||||||
|
0x78, 0x0a, 0x00, 0x00, 0x2d, 0x06, 0x00, 0x00, 0x71, 0xf8, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x99, 0x0a, 0x00, 0x00, 0xfe, 0xf7, 0xff, 0xff,
|
||||||
|
0x0f, 0x05, 0x00, 0x00, 0xd4, 0x09, 0x00, 0x00, 0x47, 0xfe, 0xff, 0xff,
|
||||||
|
0xb6, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xf7, 0xff, 0xff,
|
||||||
|
0x4b, 0xf9, 0xff, 0xff, 0x4a, 0x05, 0x00, 0x00, 0x76, 0xfd, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||||
|
0x65, 0x5f, 0x33, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xcc, 0xfc, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0xb2, 0x9e, 0x21, 0x39, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xfd, 0xff, 0xff,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xee, 0xfc, 0x00, 0xec,
|
||||||
|
0x05, 0x17, 0xef, 0xec, 0xe6, 0xf8, 0x03, 0x01, 0x00, 0xfa, 0xf8, 0xf5,
|
||||||
|
0xdc, 0xeb, 0x27, 0x14, 0xf1, 0xde, 0xe2, 0xdb, 0xf0, 0xde, 0x31, 0x06,
|
||||||
|
0x02, 0xe6, 0xee, 0xf9, 0x00, 0x16, 0x07, 0xe0, 0xfe, 0xff, 0xe9, 0x06,
|
||||||
|
0xe7, 0xef, 0x81, 0x1b, 0x18, 0xea, 0xc9, 0x01, 0x0f, 0x00, 0xda, 0xf7,
|
||||||
|
0x0e, 0xec, 0x13, 0x1f, 0x04, 0x13, 0xb4, 0xe6, 0xfd, 0x06, 0xb9, 0xe0,
|
||||||
|
0x0d, 0xec, 0xf0, 0xde, 0xeb, 0xf7, 0x05, 0x26, 0x1a, 0xe4, 0x6f, 0x1a,
|
||||||
|
0xea, 0x1e, 0x35, 0xdf, 0x1a, 0xf3, 0xf1, 0x19, 0x0f, 0x03, 0x1b, 0xe1,
|
||||||
|
0xde, 0x13, 0xf6, 0x19, 0xff, 0xf6, 0x1b, 0x18, 0xf0, 0x1c, 0xda, 0x1b,
|
||||||
|
0x1b, 0x20, 0xe5, 0x1a, 0xf5, 0xff, 0x96, 0x0b, 0x00, 0x01, 0xcd, 0xde,
|
||||||
|
0x0d, 0xf6, 0x16, 0xe3, 0xed, 0xfc, 0x0e, 0xe9, 0xfa, 0xeb, 0x5c, 0xfc,
|
||||||
|
0x1d, 0x02, 0x5b, 0xe2, 0xe1, 0xf5, 0x15, 0xec, 0xf4, 0x00, 0x13, 0x05,
|
||||||
|
0xec, 0x0c, 0x1d, 0x14, 0x0e, 0xe7, 0x0b, 0xf4, 0x19, 0x00, 0xd7, 0x05,
|
||||||
|
0x27, 0x02, 0x15, 0xea, 0xea, 0x02, 0x9b, 0x00, 0x0c, 0xfa, 0xe8, 0xea,
|
||||||
|
0xfd, 0x00, 0x14, 0xfd, 0x0b, 0x02, 0xef, 0xee, 0x06, 0xee, 0x01, 0x0d,
|
||||||
|
0x06, 0xe6, 0xf7, 0x11, 0xf7, 0x09, 0xf8, 0xf1, 0x21, 0xff, 0x0e, 0xf3,
|
||||||
|
0xec, 0x12, 0x26, 0x1d, 0xf2, 0xe9, 0x28, 0x18, 0xe0, 0xfb, 0xf3, 0xf4,
|
||||||
|
0x05, 0x1d, 0x1d, 0xfb, 0xfd, 0x1e, 0xfc, 0x11, 0xe8, 0x07, 0x09, 0x03,
|
||||||
|
0x12, 0xf2, 0x36, 0xfb, 0xdc, 0x1c, 0xf9, 0xef, 0xf3, 0xe7, 0x6f, 0x0c,
|
||||||
|
0x1d, 0x00, 0x45, 0xfd, 0x0e, 0xf0, 0x0b, 0x19, 0x1a, 0xfa, 0xe0, 0x19,
|
||||||
|
0x1f, 0x13, 0x36, 0x1c, 0x12, 0xeb, 0x3b, 0x0c, 0xb4, 0xcb, 0xe6, 0x13,
|
||||||
|
0xfa, 0xeb, 0xf1, 0x06, 0x1c, 0xfa, 0x18, 0xe5, 0xeb, 0xcb, 0x0c, 0xf4,
|
||||||
|
0xd6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||||
|
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33,
|
||||||
|
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x3c, 0xfe, 0xff, 0xff,
|
||||||
|
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x6b, 0x01, 0x4f, 0x3c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x77, 0x0b, 0x00, 0x00,
|
||||||
|
0x53, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x77, 0x0c, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x06, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x21, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x2f, 0x07, 0x00, 0x00, 0x67, 0xf5, 0xff, 0xff,
|
||||||
|
0x34, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x86, 0xff, 0xff, 0xff,
|
||||||
|
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
|
||||||
|
0x65, 0x5f, 0x32, 0x2f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xdc, 0xfe, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x28, 0xb3, 0xd9, 0x38, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
|
||||||
|
0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x10, 0x00, 0x00, 0x00, 0x75, 0x1c, 0x11, 0xe1, 0x0c, 0x81, 0xa5, 0x42,
|
||||||
|
0xfe, 0xd5, 0xd4, 0xb2, 0x61, 0x78, 0x19, 0xdf, 0x00, 0x00, 0x0e, 0x00,
|
||||||
|
0x18, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00,
|
||||||
|
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x1b, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
|
||||||
|
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
|
||||||
|
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x00, 0x74, 0xff, 0xff, 0xff,
|
||||||
|
0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0xd5, 0x6b, 0x8a, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x07, 0x00,
|
||||||
|
0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
|
||||||
|
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x14, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||||
|
0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x76,
|
||||||
|
0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f,
|
||||||
|
0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75,
|
||||||
|
0x74, 0x3a, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5d, 0x4f, 0xc9, 0x3c,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
unsigned int g_model_len = 2408;
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* @file streams-tf-i2s.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We use Tenorflow lite to generate some audio data and output it via I2S to the AudioKit
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-04-07
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/TfLiteAudioStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "model.h"
|
||||||
|
|
||||||
|
TfLiteSineReader tf_reader(20000,0.3); // Audio generation logic
|
||||||
|
TfLiteAudioStream tf_stream; // Audio source -> no classification so N is 0
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1); // Audio destination
|
||||||
|
StreamCopy copier(i2s, tf_stream); // copy tf_stream to i2s
|
||||||
|
int channels = 1;
|
||||||
|
int samples_per_second = 16000;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// Setup tensorflow input
|
||||||
|
auto tcfg = tf_stream.defaultConfig();
|
||||||
|
tcfg.channels = channels;
|
||||||
|
tcfg.sample_rate = samples_per_second;
|
||||||
|
tcfg.kTensorArenaSize = 2 * 1024;
|
||||||
|
tcfg.model = g_model;
|
||||||
|
tcfg.reader = &tf_reader;
|
||||||
|
tf_stream.begin(tcfg);
|
||||||
|
|
||||||
|
// setup Audioi2s output
|
||||||
|
auto cfg = i2s.defaultConfig(TX_MODE);
|
||||||
|
cfg.channels = channels;
|
||||||
|
cfg.sample_rate = samples_per_second;
|
||||||
|
i2s.begin(cfg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { copier.copy(); }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Basic API
|
||||||
|
|
||||||
|
Using the A2DP Callback directly is usually much more efficient then the A2DPStream which set up an additional buffer
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* @file base-BufferRTOS.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Data provider on core 0 with data consumer on core 1
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-11-25
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/Concurrency.h" // https://github.com/pschatzmann/arduino-freertos-addons
|
||||||
|
|
||||||
|
BufferRTOS<int16_t> buffer(1024);
|
||||||
|
void doWrite(); // forward declaration
|
||||||
|
Task writeTask("write",5000,10, 0); // FreeRTOS task from addons
|
||||||
|
|
||||||
|
// create data and write it to buffer
|
||||||
|
void doWrite() {
|
||||||
|
int16_t data[512];
|
||||||
|
for (int j=0;j<512;j++){
|
||||||
|
data[j]=j;
|
||||||
|
}
|
||||||
|
buffer.writeArray(data, 512);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
// Setup logging
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// start on core 0
|
||||||
|
writeTask.begin(doWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The loop runs on core 1: We read back the data
|
||||||
|
void loop(){
|
||||||
|
int16_t data[512];
|
||||||
|
uint64_t start = micros();
|
||||||
|
buffer.readArray(data, 512);
|
||||||
|
|
||||||
|
// process (verify) data
|
||||||
|
int error=0;
|
||||||
|
for (int j=0;j<512;j++){
|
||||||
|
if(data[j]!=j){
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write result
|
||||||
|
Serial.print("error: ");
|
||||||
|
Serial.print(error);
|
||||||
|
Serial.print(" runtime: ");
|
||||||
|
Serial.println(micros()-start);
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* @file base-adc-average-mono-serial.ino
|
||||||
|
* @brief Attempts down sampling with binning of a mono audio signal by AVG_LEN
|
||||||
|
* @author Urs Utzinger
|
||||||
|
* @copyright GPLv3
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "AudioTools.h"
|
||||||
|
|
||||||
|
// On board analog to digital converter
|
||||||
|
AnalogAudioStream analog_in;
|
||||||
|
|
||||||
|
// Serial terminal output
|
||||||
|
CsvOutput<int16_t> serial_out(Serial);
|
||||||
|
|
||||||
|
#define BAUD_RATE 500000
|
||||||
|
#define SAMPLE_RATE 44100
|
||||||
|
#define BUFFER_SIZE 256
|
||||||
|
#define AVG_LEN 64
|
||||||
|
#define BYTES_PER_SAMPLE sizeof(int16_t)
|
||||||
|
|
||||||
|
// buffer to read samples and store the average samples
|
||||||
|
int16_t buffer[BUFFER_SIZE];
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
delay(3000); // wait for serial to become available
|
||||||
|
|
||||||
|
// Serial Interface
|
||||||
|
Serial.begin(BAUD_RATE);
|
||||||
|
|
||||||
|
// Include logging to serial
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Error); // Debug, Warning, Info, Error
|
||||||
|
|
||||||
|
// Start ADC input
|
||||||
|
Serial.println("Starting ADC...");
|
||||||
|
auto adcConfig = analog_in.defaultConfig(RX_MODE);
|
||||||
|
adcConfig.sample_rate = SAMPLE_RATE;
|
||||||
|
adcConfig.channels = 1;
|
||||||
|
|
||||||
|
// For ESP32 by Espressif Systems version 3.0.0 and later:
|
||||||
|
// see examples/README_ESP32.md
|
||||||
|
// adcConfig.sample_rate = 44100;
|
||||||
|
// adcConfig.adc_bit_width = 12;
|
||||||
|
// adcConfig.adc_calibration_active = true;
|
||||||
|
// adcConfig.is_auto_center_read = false;
|
||||||
|
// adcConfig.adc_attenuation = ADC_ATTEN_DB_12;
|
||||||
|
// adcConfig.channels = 1;
|
||||||
|
// adcConfig.adc_channels[0] = ADC_CHANNEL_4;
|
||||||
|
|
||||||
|
analog_in.begin(adcConfig);
|
||||||
|
|
||||||
|
// Start Serial Output CSV
|
||||||
|
Serial.println("Starting Serial Out...");
|
||||||
|
auto csvConfig = serial_out.defaultConfig();
|
||||||
|
csvConfig.sample_rate = SAMPLE_RATE/AVG_LEN;
|
||||||
|
csvConfig.channels = 1;
|
||||||
|
csvConfig.bits_per_sample = 16;
|
||||||
|
serial_out.begin(csvConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
// Read the values from the ADC buffer to local buffer
|
||||||
|
size_t bytes_read = analog_in.readBytes((uint8_t*) buffer, BUFFER_SIZE * BYTES_PER_SAMPLE); // read byte stream and cast to destination type
|
||||||
|
size_t samples_read = bytes_read/BYTES_PER_SAMPLE;
|
||||||
|
size_t avg_samples = samples_read/AVG_LEN;
|
||||||
|
|
||||||
|
// Average the samples over AVG_LEN
|
||||||
|
int32_t sum; // register to hold summed values
|
||||||
|
int16_t *sample = (int16_t*) buffer; // sample pointer (input)
|
||||||
|
int16_t *avg = (int16_t*) buffer; // result pointer (output)
|
||||||
|
// each time we access a sample we increment sample pointer
|
||||||
|
for(uint16_t j=0; j<avg_samples; j++){
|
||||||
|
sum = *sample++; // initialize sum
|
||||||
|
for (uint16_t i=1; i<AVG_LEN; i++){
|
||||||
|
sum += *sample++; // sum the samples
|
||||||
|
}
|
||||||
|
// compute average and store in output buffer
|
||||||
|
*avg++ = (int16_t) (sum/AVG_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
serial_out.write((uint8_t*)buffer, avg_samples*BYTES_PER_SAMPLE); // stream to output as byte type
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# ESP32 Analog to Digital Conversion Throughput using Continuous ADC API
|
||||||
|
|
||||||
|
Data is reported in bytes per second when using a single ADC unit and two A/D channels.
|
||||||
|
When each channel is measured with 4,000 samples per second the ADC is running at 8,000 samples per second as it multiplexes between the two channels.
|
||||||
|
|
||||||
|
The maximum sampling frequency depends on the ESP32 model.
|
||||||
|
|
||||||
|
The older ESP32 models can convert up to 2 Million samples per second, however there is discrepancy between the expected and effective throughput of about 20%.
|
||||||
|
|
||||||
|
The library creates int16_t datatype which is 2 bytes per sample.
|
||||||
|
|
||||||
|
## Adafruit Feather ESP32-S3 2MB PSRAM
|
||||||
|
```
|
||||||
|
|
||||||
|
SPS : expected, measured
|
||||||
|
150: error, sample rate eff: 300, range: 611 to 83,333
|
||||||
|
306: 1,224, 1,000
|
||||||
|
4,000: 16,000, 16,000
|
||||||
|
8,000: 32,000, 32,000
|
||||||
|
11,025: 44,100, 44,000
|
||||||
|
16,000: 64,000, 64,000
|
||||||
|
20,000: 80,000, 80,000
|
||||||
|
22,050: 88,200, 89,000
|
||||||
|
40,000: 160,000, 161,000
|
||||||
|
44,100: error, sample rate eff: 88,200, range: 611 to 83,333
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sparkfun ESP32 WROOM Plus C
|
||||||
|
```
|
||||||
|
Data: bytes per second, single unit, two channels
|
||||||
|
SPS/CH expected, measured % of expected
|
||||||
|
5000: error, sample rate eff: 10000, range: 20000 to 2000000
|
||||||
|
10000: 40,000, 32,000
|
||||||
|
22050: 88,200, 72,000
|
||||||
|
44100: 176,400, 144,000
|
||||||
|
88200: 352,800, 157,000
|
||||||
|
500000: 2,000,000, 1,635,000
|
||||||
|
1000000: 4,000,000, 3,271,000
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOIT ESP32 DEVKIT V1
|
||||||
|
```
|
||||||
|
Data: bytes per second, single unit, two channels
|
||||||
|
SPS : expected, measured 80% of expected
|
||||||
|
5000: error, sample rate: 5000, range: 10000 to 1000000
|
||||||
|
10000: 40,000, 32,000
|
||||||
|
20000: 80,000, 64,000
|
||||||
|
22050: 88,200, 72,000
|
||||||
|
44100: 176,400, 144,000
|
||||||
|
48000: 192,000, 156,000
|
||||||
|
88200: 352,800, 288,000
|
||||||
|
96000: 384,000, 313,000
|
||||||
|
176400: 705,600, 576,000
|
||||||
|
192200: 768,800, 628,000
|
||||||
|
352800: 1,411,200, 1,153,000
|
||||||
|
384000: 1,536,000, 1,256,000
|
||||||
|
500000: 2,000,000, 1,635,000
|
||||||
|
1000000: 4,000,000, 3,271,000
|
||||||
|
1500000: error, sample rate: 1500000, range: 10000 to 1000000
|
||||||
|
```
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Internal ADC: It depdens pretty much on our processor & arduino version if and how
|
||||||
|
* this is supported.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "AudioTools.h"
|
||||||
|
|
||||||
|
// On board analog to digital converter
|
||||||
|
AnalogAudioStream analog_in;
|
||||||
|
|
||||||
|
// Measure throughput
|
||||||
|
MeasuringStream measure(1000, &Serial);
|
||||||
|
|
||||||
|
// Copy input to output
|
||||||
|
StreamCopy copier(measure, analog_in);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
delay(3000); // wait for serial to become available
|
||||||
|
|
||||||
|
// Serial Interface
|
||||||
|
Serial.begin(115200);
|
||||||
|
// Include logging to serial
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info); //Warning, Info, Error, Debug
|
||||||
|
|
||||||
|
// Configure ADC input
|
||||||
|
auto adcConfig = analog_in.defaultConfig(RX_MODE);
|
||||||
|
|
||||||
|
// For ESP32 by Espressif Systems version 3.0.0 and later
|
||||||
|
// see examples/README_ESP32.md
|
||||||
|
// adcConfig.sample_rate = 22050;
|
||||||
|
// adcConfig.adc_bit_width = 12;
|
||||||
|
// adcConfig.adc_calibration_active = true;
|
||||||
|
// adcConfig.is_auto_center_read = false;
|
||||||
|
// adcConfig.adc_attenuation = ADC_ATTEN_DB_12;
|
||||||
|
// adcConfig.channels = 2;
|
||||||
|
// adcConfig.adc_channels[0] = ADC_CHANNEL_4;
|
||||||
|
// adcConfig.adc_channels[1] = ADC_CHANNEL_5;
|
||||||
|
|
||||||
|
adcConfig.sample_rate = 44100; // per channel
|
||||||
|
|
||||||
|
Serial.println("Starting ADC...");
|
||||||
|
analog_in.begin(adcConfig);
|
||||||
|
|
||||||
|
// Start Measurements
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning); //Warning, Debug, Info, Error
|
||||||
|
Serial.println("Starting through put measurement...");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
copier.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Stream Analog input to Serial
|
||||||
|
|
||||||
|
We can read an analog signal from a microphone and and write it out to Serial so that we can check the result in the __Arduino Serial Plotter__. To test the functionality I am using a MCP6022 microphone module.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
The MCP6022 is a anlog microphone which operates at 3.3 V
|
||||||
|
We sample the sound signal with the help of the ESP32 I2S ADC input functionality.
|
||||||
|
|
||||||
|
### Pins:
|
||||||
|
|
||||||
|
| MCP6022 | ESP32
|
||||||
|
|---------|---------------
|
||||||
|
| VCC | 3.3
|
||||||
|
| GND | GND
|
||||||
|
| OUT | GPIO34
|
||||||
|
|
||||||
|
|
||||||
|
## Serial Plotter
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* @file adc-serial.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/adc-serial/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
* #TODO retest is outstanding
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "AudioTools.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief We use a mcp6022 analog microphone on GPIO34 and write it to Serial
|
||||||
|
*/
|
||||||
|
|
||||||
|
AnalogAudioStream adc;
|
||||||
|
const int32_t max_buffer_len = 1024;
|
||||||
|
uint8_t buffer[max_buffer_len];
|
||||||
|
// The data has a center of around 26427, so we we need to shift it down to bring the center to 0
|
||||||
|
ConverterScaler<int16_t> scaler(1.0, -26427, 32700 );
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
|
||||||
|
delay(3000); // wait for serial to become available
|
||||||
|
|
||||||
|
Serial.begin(115200);
|
||||||
|
// Include logging to serial
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info); //Warning, Info, Error, Debug
|
||||||
|
Serial.println("starting ADC...");
|
||||||
|
auto adcConfig = adc.defaultConfig(RX_MODE);
|
||||||
|
|
||||||
|
// For ESP32 by Espressif Systems version 3.0.0 and later:
|
||||||
|
// see examples/README_ESP32.md
|
||||||
|
// adcConfig.sample_rate = 44100;
|
||||||
|
// adcConfig.adc_bit_width = 12;
|
||||||
|
// adcConfig.adc_calibration_active = true;
|
||||||
|
// adcConfig.is_auto_center_read = false;
|
||||||
|
// adcConfig.adc_attenuation = ADC_ATTEN_DB_12;
|
||||||
|
// adcConfig.channels = 2;
|
||||||
|
// adcConfig.adc_channels[0] = ADC_CHANNEL_4;
|
||||||
|
// adcConfig.adc_channels[1] = ADC_CHANNEL_5;
|
||||||
|
|
||||||
|
adc.begin(adcConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
size_t len = adc.readBytes(buffer, max_buffer_len);
|
||||||
|
// move center to 0 and scale the values
|
||||||
|
scaler.convert(buffer, len);
|
||||||
|
|
||||||
|
int16_t *sample = (int16_t*) buffer;
|
||||||
|
int size = len / 4;
|
||||||
|
for (int j=0; j<size; j++){
|
||||||
|
Serial.print(*sample++);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.println(*sample++);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @file file_raw-serial.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/file_raw-serial/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <SD.h>
|
||||||
|
|
||||||
|
File sound_file;
|
||||||
|
const char* file_name = "/audio.raw";
|
||||||
|
const int sd_ss_pin = 5;
|
||||||
|
const int32_t max_buffer_len = 512;
|
||||||
|
int32_t buffer[max_buffer_len][2];
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
// Setup SD and open file
|
||||||
|
SD.begin(sd_ss_pin);
|
||||||
|
sound_file = SD.open(file_name, FILE_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
size_t len = sound_file.read((uint8_t*)buffer, max_buffer_len * sizeof(int16_t) * 2 );
|
||||||
|
for (size_t j=0;j<len;j++){
|
||||||
|
Serial.print(buffer[j][0]);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.println(buffer[j][1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Communication Examples
|
||||||
|
|
||||||
|
You can transmit audio information over a wire or (e.g. if you have an ESP32) wirelessly. It is important that you make sure that the transmitted amount of audio data is below the transmission capacity of the medium (e.g. by limiting the channels, the sample rate or the bits per sample).
|
||||||
|
|
||||||
|
You can also use [one of the many supported CODECs](https://github.com/pschatzmann/arduino-audio-tools/wiki/Encoding-and-Decoding-of-Audio) to decrease the transmitted amount of data!
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
## Using the AI Thinker ESP32 Audio Kit as A2DP Receiver
|
||||||
|
|
||||||
|
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
I am using the data callback of the A2DP library to feed the AudioBoardStream
|
||||||
|
|
||||||
|
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies:
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/ESP32-A2DP
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-audiokit.ino
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/basic-a2dp-audiokit/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h" // install https://github.com/pschatzmann/ESP32-A2DP
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
|
||||||
|
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
|
||||||
|
// Write data to AudioKit in callback
|
||||||
|
void read_data_stream(const uint8_t *data, uint32_t length) {
|
||||||
|
kit.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// register callback
|
||||||
|
a2dp_sink.set_stream_reader(read_data_stream, false);
|
||||||
|
a2dp_sink.start("AudioKit");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
## Using the AI Thinker ESP32 Audio Kit as A2DP Receiver with Equalizer
|
||||||
|
|
||||||
|
I found some cheap [AI Thinker ESP32 Audio Kit V2.2](https://docs.ai-thinker.com/en/esp32-audio-kit) on AliExpress.
|
||||||
|
|
||||||
|
<img src="https://pschatzmann.github.io/Resources/img/audio-toolkit.png" alt="Audio Kit" />
|
||||||
|
|
||||||
|
I am using the data callback of the A2DP library to feed the AudioBoardStream that will be controlled by an Equalizer
|
||||||
|
|
||||||
|
You dont need to bother about any wires because everything is on one nice board. Just just need to install the dependencies:
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
You need to install the following libraries:
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/ESP32-A2DP
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-driver
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-audiokit.ino
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/basic-a2dp-audiokit/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h" // install https://github.com/pschatzmann/ESP32-A2DP
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
|
||||||
|
|
||||||
|
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
Equalizer3Bands eq(kit);
|
||||||
|
ConfigEqualizer3Bands cfg_eq;
|
||||||
|
|
||||||
|
|
||||||
|
// Write data to AudioKit in callback
|
||||||
|
void read_data_stream(const uint8_t *data, uint32_t length) {
|
||||||
|
eq.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
cfg.sd_active = false;
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// max volume
|
||||||
|
kit.setVolume(1.0);
|
||||||
|
|
||||||
|
// setup equilizer
|
||||||
|
cfg_eq = eq.defaultConfig();
|
||||||
|
cfg_eq.setAudioInfo(cfg); // use channels, bits_per_sample and sample_rate from kit
|
||||||
|
cfg_eq.gain_low = 0.5;
|
||||||
|
cfg_eq.gain_medium = 0.5;
|
||||||
|
cfg_eq.gain_high = 1.0;
|
||||||
|
eq.begin(cfg_eq);
|
||||||
|
|
||||||
|
// register callback
|
||||||
|
a2dp_sink.set_stream_reader(read_data_stream, false);
|
||||||
|
a2dp_sink.start("AudioKit");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-fft-led.ino
|
||||||
|
* @brief A2DP Sink with output of the FFT result to the LED matrix
|
||||||
|
* For details see the FFT Wiki: https://github.com/pschatzmann/arduino-audio-tools/wiki/FFT
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <FastLED.h> // to prevent conflicts introduced with 3.9
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or any other supported inplementation
|
||||||
|
#include "AudioTools/AudioLibs/LEDOutput.h"
|
||||||
|
#include "BluetoothA2DPSink.h"
|
||||||
|
|
||||||
|
#define PIN_LEDS 22
|
||||||
|
#define LED_X 32
|
||||||
|
#define LED_Y 8
|
||||||
|
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
AudioRealFFT fft; // or any other supported inplementation
|
||||||
|
FFTDisplay fft_dis(fft);
|
||||||
|
LEDOutput led(fft_dis); // output to LED matrix
|
||||||
|
|
||||||
|
// Provide data to FFT
|
||||||
|
void writeDataStream(const uint8_t *data, uint32_t length) {
|
||||||
|
fft.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// Setup FFT
|
||||||
|
auto tcfg = fft.defaultConfig();
|
||||||
|
tcfg.length = 1024;
|
||||||
|
tcfg.channels = 2;
|
||||||
|
tcfg.sample_rate = a2dp_sink.sample_rate();;
|
||||||
|
tcfg.bits_per_sample = 16;
|
||||||
|
fft.begin(tcfg);
|
||||||
|
|
||||||
|
// Setup LED matrix output
|
||||||
|
auto lcfg = led.defaultConfig();
|
||||||
|
lcfg.x = LED_X;
|
||||||
|
lcfg.y = LED_Y;
|
||||||
|
led.begin(lcfg);
|
||||||
|
|
||||||
|
fft_dis.fft_group_bin = 3;
|
||||||
|
fft_dis.fft_start_bin = 0;
|
||||||
|
fft_dis.fft_max_magnitude = 40000;
|
||||||
|
fft_dis.begin();
|
||||||
|
|
||||||
|
// add LEDs
|
||||||
|
FastLED.addLeds<WS2812B, PIN_LEDS, GRB>(led.ledData(), led.ledCount());
|
||||||
|
|
||||||
|
// register A2DP callback
|
||||||
|
a2dp_sink.set_stream_reader(writeDataStream, false);
|
||||||
|
|
||||||
|
// Start Bluetooth Audio Receiver
|
||||||
|
Serial.print("starting a2dp-fft...");
|
||||||
|
a2dp_sink.set_auto_reconnect(false);
|
||||||
|
a2dp_sink.start("a2dp-fft");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
led.update();
|
||||||
|
delay(50);
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-fft.ino
|
||||||
|
* @brief A2DP Sink with output to FFT.
|
||||||
|
* For details see the FFT Wiki: https://github.com/pschatzmann/arduino-audio-tools/wiki/FFT
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioRealFFT.h" // or any other supported inplementation
|
||||||
|
#include "BluetoothA2DPSink.h"
|
||||||
|
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
AudioRealFFT fft; // or any other supported inplementation
|
||||||
|
|
||||||
|
// Provide data to FFT
|
||||||
|
void writeDataStream(const uint8_t *data, uint32_t length) {
|
||||||
|
fft.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
// display fft result
|
||||||
|
void fftResult(AudioFFTBase &fft){
|
||||||
|
float diff;
|
||||||
|
auto result = fft.result();
|
||||||
|
if (result.magnitude>100){
|
||||||
|
Serial.print(result.frequency);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.print(result.magnitude);
|
||||||
|
Serial.print(" => ");
|
||||||
|
Serial.print(result.frequencyAsNote(diff));
|
||||||
|
Serial.print( " diff: ");
|
||||||
|
Serial.println(diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// Setup FFT
|
||||||
|
auto tcfg = fft.defaultConfig();
|
||||||
|
tcfg.length = 4096;
|
||||||
|
tcfg.channels = 2;
|
||||||
|
tcfg.sample_rate = a2dp_sink.sample_rate();;
|
||||||
|
tcfg.bits_per_sample = 16;
|
||||||
|
tcfg.callback = &fftResult;
|
||||||
|
fft.begin(tcfg);
|
||||||
|
|
||||||
|
// register callback
|
||||||
|
a2dp_sink.set_stream_reader(writeDataStream, false);
|
||||||
|
|
||||||
|
// Start Bluetooth Audio Receiver
|
||||||
|
Serial.print("starting a2dp-fft...");
|
||||||
|
a2dp_sink.set_auto_reconnect(false);
|
||||||
|
a2dp_sink.start("a2dp-fft");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { delay(100); }
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-audioi2s.ino
|
||||||
|
* @brief A2DP Sink with output to I2SStream. This example is of small value
|
||||||
|
* since my Bluetooth Library already provides I2S output out of the box.
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "BluetoothA2DPSink.h"
|
||||||
|
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
I2SStream i2s;
|
||||||
|
|
||||||
|
// Write data to I2S
|
||||||
|
void read_data_stream(const uint8_t *data, uint32_t length) {
|
||||||
|
i2s.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// register callback
|
||||||
|
a2dp_sink.set_stream_reader(read_data_stream, false);
|
||||||
|
|
||||||
|
// Start Bluetooth Audio Receiver
|
||||||
|
a2dp_sink.set_auto_reconnect(false);
|
||||||
|
a2dp_sink.start("a2dp-i2s");
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = i2s.defaultConfig();
|
||||||
|
cfg.pin_data = 23;
|
||||||
|
cfg.sample_rate = a2dp_sink.sample_rate();
|
||||||
|
cfg.channels = 2;
|
||||||
|
cfg.bits_per_sample = 16;
|
||||||
|
cfg.buffer_count = 8;
|
||||||
|
cfg.buffer_size = 256;
|
||||||
|
i2s.begin(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { delay(100); }
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-a2dp-mixer-i2s.ino
|
||||||
|
* @brief A2DP Sink with output to mixer: I think this is the most efficient way
|
||||||
|
* of mixing a signal that is coming from A2DP which requires only 160 byte of additional RAM.
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "BluetoothA2DPSink.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
I2SStream i2s;
|
||||||
|
SineWaveGenerator<int16_t> sineWave(10000); // subclass of SoundGenerator with max amplitude of 10000
|
||||||
|
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
|
||||||
|
OutputMixer<int16_t> mixer(i2s, 2); // output mixer with 2 outputs
|
||||||
|
const int buffer_size = 80; // split up the output into small chunks
|
||||||
|
uint8_t sound_buffer[buffer_size];
|
||||||
|
|
||||||
|
// Write data to mixer
|
||||||
|
void read_data_stream(const uint8_t *data, uint32_t length) {
|
||||||
|
// To keep the mixing buffer small we split up the output into small chunks
|
||||||
|
int count = length / buffer_size + 1;
|
||||||
|
for (int j = 0; j < count; j++) {
|
||||||
|
const uint8_t *start = data + (j * buffer_size);
|
||||||
|
const uint8_t *end = min(data + length, start + buffer_size);
|
||||||
|
int len = end - start;
|
||||||
|
if (len > 0) {
|
||||||
|
// write a2dp
|
||||||
|
mixer.write(start, len);
|
||||||
|
|
||||||
|
// write sine tone with identical length
|
||||||
|
sound.readBytes(sound_buffer, len);
|
||||||
|
mixer.write(sound_buffer, len);
|
||||||
|
|
||||||
|
// We could flush to force the output but this is not necessary because we
|
||||||
|
// were already writing all 2 streams mixer.flushMixer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup Output mixer with min necessary memory
|
||||||
|
mixer.begin(buffer_size);
|
||||||
|
|
||||||
|
// Register data callback
|
||||||
|
a2dp_sink.set_stream_reader(read_data_stream, false);
|
||||||
|
|
||||||
|
// Start Bluetooth Audio Receiver
|
||||||
|
a2dp_sink.set_auto_reconnect(false);
|
||||||
|
a2dp_sink.start("a2dp-i2s");
|
||||||
|
|
||||||
|
// Update sample rate
|
||||||
|
info.sample_rate = a2dp_sink.sample_rate();
|
||||||
|
|
||||||
|
// start sine wave
|
||||||
|
sineWave.begin(info, N_B4);
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = i2s.defaultConfig();
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
// cfg.pin_data = 23;
|
||||||
|
cfg.buffer_count = 8;
|
||||||
|
cfg.buffer_size = 256;
|
||||||
|
i2s.begin(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() { delay(100); }
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Stream Analog input to A2DP Bluetooth
|
||||||
|
|
||||||
|
We can read an analog signal from a microphone and and send it to a Bluetooth A2DP device. To test the functionality I am using a MCP6022 microphone module.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
The MCP6022 is a anlog microphone which operates at 3.3 V
|
||||||
|
We sample the sound signal with the help of the ESP32 I2S ADC input functionality.
|
||||||
|
|
||||||
|
### Pins:
|
||||||
|
|
||||||
|
| MCP6022 | ESP32
|
||||||
|
|---------|---------------
|
||||||
|
| VCC | 3.3
|
||||||
|
| GND | GND
|
||||||
|
| OUT | GPIO34
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/ESP32-A2DP.git
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-adc-a2dp.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-communication/a2dp/basic-adc-a2dp/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "BluetoothA2DPSource.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief We use a mcp6022 analog microphone as input and send the data to A2DP
|
||||||
|
*/
|
||||||
|
|
||||||
|
AnalogAudioStream adc;
|
||||||
|
BluetoothA2DPSource a2dp_source;
|
||||||
|
|
||||||
|
// callback used by A2DP to provide the sound data
|
||||||
|
int32_t get_sound_data(Frame* frames, int32_t frameCount) {
|
||||||
|
uint8_t *data = (uint8_t*)frames;
|
||||||
|
int frameSize = 4;
|
||||||
|
size_t resultBytes = adc.readBytes(data, frameCount*frameSize);
|
||||||
|
return resultBytes/frameSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
// start i2s input with default configuration
|
||||||
|
Serial.println("starting I2S-ADC...");
|
||||||
|
adc.begin(adc.defaultConfig(RX_MODE));
|
||||||
|
|
||||||
|
// start the bluetooth
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
a2dp_source.set_auto_reconnect(false);
|
||||||
|
a2dp_source.set_data_callback_in_frames(get_sound_data);
|
||||||
|
a2dp_source.start("MyMusic");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* @file base-audiokit-a2dp.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We play the input from the ADC to an A2DP speaker
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
|
||||||
|
AudioInfo info(44100, 2, 16);
|
||||||
|
BluetoothA2DPSource a2dp_source;
|
||||||
|
AudioBoardStream i2s(AudioKitEs8388V1);
|
||||||
|
const int16_t BYTES_PER_FRAME = 4;
|
||||||
|
|
||||||
|
// callback used by A2DP to provide the sound data - usually len is 128 2 channel int16 frames
|
||||||
|
int32_t get_sound_data(Frame* data, int32_t frameCount) {
|
||||||
|
return i2s.readBytes((uint8_t*)data, frameCount*BYTES_PER_FRAME)/BYTES_PER_FRAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// start i2s input with default configuration
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto cfg = i2s.defaultConfig(RX_MODE);
|
||||||
|
cfg.i2s_format = I2S_STD_FORMAT; // or try with I2S_LSB_FORMAT
|
||||||
|
cfg.copyFrom(info);
|
||||||
|
cfg.input_device = ADC_INPUT_LINE2; // microphone
|
||||||
|
i2s.begin(cfg);
|
||||||
|
|
||||||
|
// start the bluetooth
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
a2dp_source.set_data_callback_in_frames(get_sound_data);
|
||||||
|
a2dp_source.start("LEXON MINO L");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
// We use the decoding on the input side to provid pcm data
|
||||||
|
|
||||||
|
#include "SPI.h"
|
||||||
|
#include "SD.h"
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
//#include "AudioTools/AudioLibs/AudioBoardStream.h" // for SPI pins
|
||||||
|
|
||||||
|
File file;
|
||||||
|
MP3DecoderHelix mp3; // or change to MP3DecoderMAD
|
||||||
|
EncodedAudioStream decoder(&file, &mp3);
|
||||||
|
BluetoothA2DPSource a2dp_source;
|
||||||
|
const int chipSelect = SS; //PIN_AUDIO_KIT_SD_CARD_CS;
|
||||||
|
|
||||||
|
// callback used by A2DP to provide the sound data - usually len is 128 2 channel int16 frames
|
||||||
|
int32_t get_sound_data(uint8_t* data, int32_t size) {
|
||||||
|
int32_t result = decoder.readBytes((uint8_t*)data, size);
|
||||||
|
delay(1); // feed the dog
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// open file
|
||||||
|
//SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS);
|
||||||
|
SD.begin(chipSelect);
|
||||||
|
file = SD.open("/test.mp3", FILE_READ);
|
||||||
|
if (!file) {
|
||||||
|
Serial.println("file failed");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure we have enough space for the pcm data
|
||||||
|
decoder.transformationReader().resizeResultQueue(1024 * 8);
|
||||||
|
if (!decoder.begin()) {
|
||||||
|
Serial.println("decoder failed");
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// start the bluetooth
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
a2dp_source.set_data_callback(get_sound_data);
|
||||||
|
a2dp_source.start("LEXON MINO L");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-generator-a2dp.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We send a test sine signal to a bluetooth speaker
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
|
||||||
|
const char* name = "LEXON MINO L"; // Replace with your bluetooth speaker name
|
||||||
|
SineWaveGenerator<int16_t> sineWave(15000); // subclass of SoundGenerator, set max amplitude (=volume)
|
||||||
|
GeneratedSoundStream<int16_t> in_stream(sineWave); // Stream generated from sine wave
|
||||||
|
BluetoothA2DPSource a2dp_source; // A2DP Sender
|
||||||
|
|
||||||
|
// callback used by A2DP to provide the sound data - usually len is 128 * 2 channel int16 frames
|
||||||
|
int32_t get_sound_data(uint8_t * data, int32_t len) {
|
||||||
|
return in_stream.readBytes((uint8_t*)data, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// start input
|
||||||
|
auto cfg = in_stream.defaultConfig();
|
||||||
|
cfg.bits_per_sample = 16;
|
||||||
|
cfg.channels = 2;
|
||||||
|
cfg.sample_rate = 44100;
|
||||||
|
in_stream.begin(cfg);
|
||||||
|
sineWave.begin(cfg, N_B4);
|
||||||
|
|
||||||
|
|
||||||
|
// start the bluetooth
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
a2dp_source.set_auto_reconnect(false);
|
||||||
|
a2dp_source.set_data_callback(get_sound_data);
|
||||||
|
a2dp_source.start(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() {
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
# Stream I2S Input to A2DP Bluetooth
|
||||||
|
|
||||||
|
## General Description:
|
||||||
|
We implement a A2DP source: We stream the sound input which we read in from the I2S interface to a A2DP sink. We can use any device which provides the sound data via I2S. In order to test the functionality we use the INMP441 microphone.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The INMP441 is a high-performance, low power, digital-output, omnidirectional MEMS microphone with a bottom port. The complete INMP441 solution consists of a MEMS sensor, signal conditioning, an analog-to-digital converter, anti-aliasing filters, power management, and an industry-standard 24-bit I²S interface. The I²S interface allows the INMP441 to connect directly to digital processors, such as DSPs and microcontrollers, without the need for an audio codec in the system.
|
||||||
|
|
||||||
|
## Pins
|
||||||
|
|
||||||
|
| INMP441 | ESP32
|
||||||
|
| --------| ---------------
|
||||||
|
| VDD | 3.3
|
||||||
|
| GND | GND
|
||||||
|
| SD | IN (GPIO32)
|
||||||
|
| L/R | GND
|
||||||
|
| WS | WS (GPIO15)
|
||||||
|
| SCK | BCK (GPIO14)
|
||||||
|
|
||||||
|
|
||||||
|
SCK: Serial data clock for I²S interface
|
||||||
|
WS: Select serial data words for the I²S interface
|
||||||
|
L/R: Left / right channel selection
|
||||||
|
When set to low, the microphone emits signals on one channel of the I²S frame.
|
||||||
|
When the high level is set, the microphone will send signals on the other channel.
|
||||||
|
ExSD: Serial data output of the I²S interface
|
||||||
|
VCC: input power 1.8V to 3.3V
|
||||||
|
GND: Power groundHigh PSR: -75 dBFS.
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/ESP32-A2DP.git
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-i2s-a2dp.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief We use a INMP441 I2S microphone as input and send the data to A2DP
|
||||||
|
* Unfortunatly the data type from the microphone (int32_t) does not match with
|
||||||
|
* the required data type by A2DP (int16_t), so we need to convert.
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
|
||||||
|
AudioInfo info32(44100, 2, 32);
|
||||||
|
AudioInfo info16(44100, 2, 16);
|
||||||
|
BluetoothA2DPSource a2dp_source;
|
||||||
|
I2SStream i2s;
|
||||||
|
FormatConverterStream conv(i2s);
|
||||||
|
const int BYTES_PER_FRAME = 4;
|
||||||
|
|
||||||
|
|
||||||
|
int32_t get_sound_data(Frame* data, int32_t frameCount) {
|
||||||
|
return conv.readBytes((uint8_t*)data, frameCount*BYTES_PER_FRAME)/BYTES_PER_FRAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino Setup
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// setup conversion
|
||||||
|
conv.begin(info32, info16);
|
||||||
|
|
||||||
|
// start i2s input with default configuration
|
||||||
|
Serial.println("starting I2S...");
|
||||||
|
auto cfg = i2s.defaultConfig(RX_MODE);
|
||||||
|
cfg.i2s_format = I2S_STD_FORMAT; // or try with I2S_LSB_FORMAT
|
||||||
|
cfg.copyFrom(info32);
|
||||||
|
cfg.is_master = true;
|
||||||
|
i2s.begin(cfg);
|
||||||
|
|
||||||
|
// start the bluetooth
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
// a2dp_source.set_auto_reconnect(false);
|
||||||
|
a2dp_source.set_data_callback_in_frames(get_sound_data);
|
||||||
|
a2dp_source.start("LEXON MINO L");
|
||||||
|
|
||||||
|
Serial.println("A2DP started");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arduino loop - repeated processing
|
||||||
|
void loop() { delay(1000); }
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* @file basic-player-a2dp.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Sketch which uses the A2DP callback to provide data from the AudioPlayer via a Queue
|
||||||
|
* The queue is filled by the Arduino loop.
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-12-04
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
#include "AudioTools/Disk/AudioSourceSDFAT.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
//#include "AudioTools/AudioLibs/AudioBoardStream.h" // for SD Pins
|
||||||
|
|
||||||
|
const int cs = 33; //PIN_AUDIO_KIT_SD_CARD_CS;
|
||||||
|
const int buffer_size = 15*1024;
|
||||||
|
const char *startFilePath = "/";
|
||||||
|
const char *ext = "mp3";
|
||||||
|
AudioSourceSDFAT source(startFilePath, ext, cs);
|
||||||
|
MP3DecoderHelix decoder;
|
||||||
|
//Setup of synchronized buffer
|
||||||
|
BufferRTOS<uint8_t> buffer(0);
|
||||||
|
QueueStream<uint8_t> out(buffer); // convert Buffer to Stream
|
||||||
|
AudioPlayer player(source, out, decoder);
|
||||||
|
BluetoothA2DPSource a2dp;
|
||||||
|
|
||||||
|
// Provide data to A2DP
|
||||||
|
int32_t get_data(uint8_t *data, int32_t bytes) {
|
||||||
|
size_t result_bytes = buffer.readArray(data, bytes);
|
||||||
|
//LOGI("get_data_channels %d -> %d of (%d)", bytes, result_bytes , buffer.available());
|
||||||
|
return result_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// allocate in PSRAM only possible in setup or loop
|
||||||
|
buffer.resize(buffer_size);
|
||||||
|
|
||||||
|
// sd_active is setting up SPI with the right SD pins by calling
|
||||||
|
// SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS);
|
||||||
|
|
||||||
|
// start QueueStream when 95% full
|
||||||
|
out.begin(95);
|
||||||
|
|
||||||
|
// setup player
|
||||||
|
player.setDelayIfOutputFull(0);
|
||||||
|
player.setVolume(0.1);
|
||||||
|
player.begin();
|
||||||
|
|
||||||
|
// start a2dp source
|
||||||
|
Serial.println("starting A2DP...");
|
||||||
|
a2dp.set_data_callback(get_data);
|
||||||
|
a2dp.start("LEXON MINO L");
|
||||||
|
Serial.println("Started!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// decode data to buffer
|
||||||
|
player.copy();
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/**
|
||||||
|
* @file player-sdfat_a2dp-audiokit.ino
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @brief Swithcing between Player and A2DP
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-04-21
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// install https://github.com/greiman/SdFat.git
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
#include "AudioTools/AudioLibs/AudioBoardStream.h"
|
||||||
|
#include "AudioTools/Disk/AudioSourceSDFAT.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
|
||||||
|
const char *startFilePath="/";
|
||||||
|
const char* ext="mp3";
|
||||||
|
AudioBoardStream kit(AudioKitEs8388V1);
|
||||||
|
SdSpiConfig sdcfg(PIN_AUDIO_KIT_SD_CARD_CS, DEDICATED_SPI, SD_SCK_MHZ(10) , &SPI);
|
||||||
|
AudioSourceSDFAT source(startFilePath, ext, sdcfg);
|
||||||
|
MP3DecoderHelix decoder;
|
||||||
|
AudioPlayer player(source, kit, decoder);
|
||||||
|
BluetoothA2DPSink a2dp_sink;
|
||||||
|
bool player_active = true;
|
||||||
|
|
||||||
|
// Write data to AudioKit in callback
|
||||||
|
void read_data_stream(const uint8_t *data, uint32_t length) {
|
||||||
|
kit.write(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
// switch between a2dp and sd player
|
||||||
|
void mode(bool, int, void*) {
|
||||||
|
player_active = !player_active;
|
||||||
|
if (player_active){
|
||||||
|
Serial.println("Stopping A2DP");
|
||||||
|
a2dp_sink.end();
|
||||||
|
// setup player
|
||||||
|
player.setVolume(0.7);
|
||||||
|
player.begin();
|
||||||
|
Serial.println("Player started");
|
||||||
|
} else {
|
||||||
|
Serial.println("Stopping player..");
|
||||||
|
player.end();
|
||||||
|
// start sink
|
||||||
|
a2dp_sink.start("AudioKit");
|
||||||
|
// update sample rate
|
||||||
|
auto cfg = kit.defaultConfig();
|
||||||
|
cfg.sample_rate = a2dp_sink.sample_rate();
|
||||||
|
kit.setAudioInfo(cfg);
|
||||||
|
Serial.println("A2DP started");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||||
|
|
||||||
|
// provide a2dp data
|
||||||
|
a2dp_sink.set_stream_reader(read_data_stream, false);
|
||||||
|
|
||||||
|
// setup output
|
||||||
|
auto cfg = kit.defaultConfig(TX_MODE);
|
||||||
|
kit.setVolume(40);
|
||||||
|
kit.begin(cfg);
|
||||||
|
|
||||||
|
// setup additional buttons
|
||||||
|
kit.addDefaultActions();
|
||||||
|
kit.addAction(kit.getKey(4), mode);
|
||||||
|
|
||||||
|
// setup player
|
||||||
|
player.setVolume(0.7);
|
||||||
|
player.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (player) {
|
||||||
|
player.copy();
|
||||||
|
} else {
|
||||||
|
// feed watchdog
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
kit.processActions();
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# A Simple SdFat Audio Player
|
||||||
|
|
||||||
|
The example demonstrates how to implement an __MP3 Player__: which provides the data from a SD drive and provides the audio via A2DP (e.g. to a Bluetooth Speaker): The __AudioSourceSdFat class__ builds on the [SdFat Library](https://github.com/greiman/SdFat) from Bill Greiman which provides FAT16/FAT32 and exFAT support.
|
||||||
|
|
||||||
|
## SD Card
|
||||||
|
|
||||||
|
Here is the information how to wire the SD card to the ESP32
|
||||||
|
|
||||||
|
| SD | ESP32
|
||||||
|
|-------|-----------------------
|
||||||
|
| CS | VSPI-CS0 (GPIO 05)
|
||||||
|
| SCK | VSPI-CLK (GPIO 18)
|
||||||
|
| MOSI | VSPI-MOSI (GPIO 23)
|
||||||
|
| MISO | VSPI-MISO (GPIO 19)
|
||||||
|
| VCC | VIN (5V)
|
||||||
|
| GND | GND
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- https://github.com/pschatzmann/arduino-audio-tools
|
||||||
|
- https://github.com/pschatzmann/arduino-libhelix
|
||||||
|
- https://github.com/greiman/SdFat
|
||||||
|
- https://github.com/pschatzmann/ESP32-A2DP
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file player-sdfat-a2dp.ino
|
||||||
|
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-player/player-sdfat-a2dp/README.md
|
||||||
|
*
|
||||||
|
* @author Phil Schatzmann
|
||||||
|
* @copyright GPLv3
|
||||||
|
*/
|
||||||
|
|
||||||
|
//remove this, to find issues regarding mp3 decoding
|
||||||
|
#define HELIX_LOGGING_ACTIVE false
|
||||||
|
|
||||||
|
#include "AudioTools.h"
|
||||||
|
#include "AudioTools/Communication/A2DPStream.h"
|
||||||
|
#include "AudioTools/Disk/AudioSourceSDFAT.h"
|
||||||
|
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
|
||||||
|
|
||||||
|
const char *startFilePath="/";
|
||||||
|
const char* ext="mp3";
|
||||||
|
AudioSourceSDFAT source(startFilePath, ext); // , PIN_AUDIO_KIT_SD_CARD_CS);
|
||||||
|
A2DPStream out;
|
||||||
|
MP3DecoderHelix decoder;
|
||||||
|
AudioPlayer player(source, out, decoder);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||||
|
|
||||||
|
// setup player
|
||||||
|
// Setting up SPI if necessary with the right SD pins by calling
|
||||||
|
// SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS);
|
||||||
|
player.setVolume(0.1);
|
||||||
|
player.begin();
|
||||||
|
|
||||||
|
// setup output - We send the test signal via A2DP - so we conect to a Bluetooth Speaker
|
||||||
|
auto cfg = out.defaultConfig(TX_MODE);
|
||||||
|
cfg.silence_on_nodata = true; // prevent disconnect when there is no audio data
|
||||||
|
cfg.name = "LEXON MINO L"; // set the device here. Otherwise the first available device is used for output
|
||||||
|
//cfg.auto_reconnect = true; // if this is use we just quickly connect to the last device ignoring cfg.name
|
||||||
|
out.begin(cfg);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
player.copy();
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user