Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
classes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
academy
classes
Commits
466b332e
Commit
466b332e
authored
8 months ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
e1ed40e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
output_devices/I2S/hello.MAX98357A.RP2040.sample.ino
+52
-0
52 additions, 0 deletions
output_devices/I2S/hello.MAX98357A.RP2040.sample.ino
output_devices/I2S/hello.h
+14
-0
14 additions, 0 deletions
output_devices/I2S/hello.h
with
66 additions
and
0 deletions
output_devices/I2S/hello.MAX98357A.RP2040.sample.ino
0 → 100644
+
52
−
0
View file @
466b332e
//
// hello.MAX98357A.RP2040.sample.ino
// XIAO RP2040 MAX98537A I2S amp audio sample hello-world
//
// Neil Gershenfeld 11/7/24
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//
#include
<I2S.h>
#include
"hello.h"
#define clock 1
#define frame (clock+1)
#define data 4
#define sample_frequency 44100
#define sample_length 40876
#define sample_bits 16
#define sample_scale 0.1
#define fade 10000
I2S
i2s
(
OUTPUT
);
void
setup
()
{
i2s
.
setBCLK
(
clock
);
i2s
.
setDATA
(
data
);
i2s
.
setBitsPerSample
(
sample_bits
);
i2s
.
begin
(
sample_frequency
);
}
void
loop
()
{
int32_t
sample
;
//
// loop over samples
//
for
(
int
i
=
0
;
i
<
sample_length
;
++
i
)
{
//
// output left and right channels, fading out
//
if
(
i
>
(
sample_length
-
fade
))
sample
=
((
sample_length
-
i
-
1
)
/
(
fade
-
1
))
*
sample_scale
*
hello
[
i
];
else
sample
=
sample_scale
*
hello
[
i
];
i2s
.
write
(
sample
);
i2s
.
write
(
sample
);
}
delay
(
500
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
output_devices/I2S/hello.h
0 → 100644
+
14
−
0
View file @
466b332e
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment