Skip to content

Commit 0a79c7a

Browse files
pschatzmanntomcombriatsensoriumtfry-gitdependabot[bot]
authored
Feb2024 (#3)
* Added class MetaOscil, example of a s weep using it, and tables for band_limited square wave * Adapted comments at beginning of example * Corrected spurious parenthesis * Implemented variadic constructor and variadic initializer for the frequencies * Added comments and (hopefully) doxygen entries * Added BandLimited tables for tri, square and saw waves * Updated example * Removed some old test tables * Added keywords for MetaOscil * Readded standard way of feeding a MetaOsc with Oscil in order to allow initialization in the setup via a for loop for polyphonic purposes * Less ambiguous name * All names should be changed... * Removed unneeded functions, implemented dichotomic search * Updated keywords * Removed addOscil from MetaOscil, improved example with explanations * remove old docs * remove old docs * regenerate docs, check some typos * move multilines to multiLine branch * add .vscode * .vscode not *.vscode * remove cogl_sqrti.h, as Thomas' suggestion in file * Delete License.txt duplicate of LICENSE.TXT * regen after some removals * add rel 1.1.0 news * Slightly update NEWS.txt * Initial port to Arduino Giga. Crude, unfinished, and not tested on hardware, yet. * This actually allows to play the Sinewave example on the Giga's inbuilt DAC. Somehow the code is extremly touchy about the correct amount of buffers to use. Smells buggy. * Clean up initial dac output mode. This is not currently reliable, however, due to arduino-libraries/Arduino_AdvancedAnalog#35 * Some more bits * Rewrite platform detection macros to avoid flood of silly clang warnings. * Create compile_examples.yml Experimental workflow for automated build testing * Update compile_examples.yml * Fix theremin example * Limit example to compile (avoid ones that require a specific configuration; list not yet complete) * Include PinChangeInt library for automated builds * Next attempt at proper dependencies for compiling examples * Further limit what gets compiled for now * Modernize PinChangeInterupt example * Fix capitalization * Next attempt at covering sensors examples * Update for fixed Arduino_AdvancedAnalog * Add esp8266 to compilation matrix (excluding AVR only sketch) * Avoid broken triangle_warm_8192 table for now * Give up on exclusion matrix for now * Add autobuilds for Giga * Add more auto-checks (sensorium#180) Arduino lint and report size deltas (for PRs only) * Fixed External audio output (sensorium#179) * Fixed External audio output on Arduino Giga Co-authored-by: Thomas Friedrichsmeier <[email protected]> * Add required lib for Giga * Remove broken TIMED_PWM mode, add PDM_VIA_SERIAL, instead. Also, some cleanups. * Fix lib name * Re-add forward declarations (needed on AVR) * Hopefully more robust define for IS_STM32 * Experimental support for STM32 boards with the stmduino.com core. This is completely untested, as I'm struggling to find out how to upload using the core. If it works, it should allow to support many more boards, however, and also the core seems actively maintained (in contrast to the maple based cores) * Basics working * Document and auto-build new STM32duino-port * Prettier file names * Next attempt at telling the cores apart, reliably * Compilation fix for libmaple based STM32 core * Fix on more url * Implement analog reads for the STM32duino core. Note that this also utilizes the AUDIO_HOOK_HOOK that we are going to need in the Arduino Giga, too. * Add missing file * Document and auto-build SAMD21 port (sensorium#182) * Tweak platform define * Added documentation for Arduino Giga, reverted default output pin to have mono mode on the jack's tip * A litte more cleanup and attribution * Added documentation on AUDIO_HOOK_HOOK * Fixed triangle_warm8192 wavetable * Added github CI workflow for Pico * Morphed the giga port into MBED port, updated doc accordingly * Fix analog reads for STM32F411 And document the board as tested * Update dependency * Add recommended dependabot check * Fix compilation * Trying to modularize a bit more Audio_Input * Starting implementing Audio_Input for giga * First try at implementing audio input on giga using new modularized paradigm * Fixed audio input for giga * Don't nag on failures of report job Of course a proper fix would be better... * Documentation in MozziGuts.cpp * Cleaned up the modularization for AUDIO_INPUT, allowing legacy (async ADC) or custom modes * Fix for stereo, less nesting in #if'S * Formatting * Cleanups * Fixed compilation for EXTERNAL_AUDIO_OUTPUT for "new" STM32duino * Better fix for EXTERNAL_AUDIO_OUTPUT and STM32duino * Correct fix for STM32duino and EXTERNAL_AUDIO * Creating a devel branch for Arduino R4 * Correct hardware define for Uno R4 * fix number types * Revert to recommending Roger Clark's core In Stev Strong's core, pwmWrite() appears to be bugged (at least with the STM32F1 blue pill board) * Use a board with reasonable amount of flash for auto-builds * Barebones of Arduino R4 implementation * Correct audioConfig using built-in DAC, first attempt on IRQ for R4 New attempt at setting correctly the timer Timer config seems ok. Moved tables to RAM. Crude output (but PWM to slow?) * EXTERNAL_AUDIO should work. Moving to analogWave.h for standard output * First try at branching R4 output straight on the buffer data Set the buffer size as a define for easy future changes First try at hooking mozzi buffers with in-built analog generation Untested More low-level implementation for the dac, just an IRQ conflict remains * Add a second timer for synchronised remove of the buffer samples * Added documentation * samplerate at audio rate * tidy * Changed hardware define for Arduino Uno R4 Fig pgmspace for move to Renesas name * More modularization for Renesas * Modularization of Renesas Analog and documentation * Fix IntegerType.h * Bump actions/checkout from 3 to 4 in /.github/workflows Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Initial implementation of async ADC for Uno R4 * Cleanup and documentation * Added explanation on ADC callback * Updated readme * Updated version number * Fix frequency offset for AVR * Improved readability * Github workflow: Revert version increas in checkout action To test, whether this fixes the "report" stage on PR, or whether that breakage is due to something else. * Improved readability Added documentation for tweak on AVR timer frequency * Fix of mozziAnalogRead for Renesas * Updated version number * typos in docs * Replaced unsigned long into uint32_t for Oscil. Should optimize slightly for 32bitters * mozzi_midi as header only * Made midiToFreq table private * Inlining all functions of mozzi_midi.h * Add Uno R4 to automated builds * Attempt to reduce number of duplicate workflow builds * Update to upload/download-artifact @v4 * Silence warning * Fix workflow de-duplication logic * Fix deduplication logic once more... * Added comments to midi note table --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: tomcombriat <[email protected]> Co-authored-by: mr.sensorium <[email protected]> Co-authored-by: Thomas Friedrichsmeier <[email protected]> Co-authored-by: Thomas Friedrichsmeier <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent c49ecaa commit 0a79c7a

File tree

880 files changed

+37937
-4426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

880 files changed

+37937
-4426
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
7+
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
8+
- package-ecosystem: github-actions
9+
directory: /.github/workflows/
10+
schedule:
11+
interval: daily
12+
labels:
13+
- "topic: infrastructure"

.github/workflows/arduino_lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Arduino Lint
2+
on:
3+
push:
4+
pull_request:
5+
# Allow manual trigger
6+
workflow_dispatch:
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: arduino/arduino-lint-action@v1
15+
with:
16+
project-type: library
17+
library-manager: update
18+
compliance: specification
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Compile Examples
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/**"
8+
- "examples/**"
9+
- "**.cpp"
10+
- "**.h"
11+
- "**.hpp"
12+
pull_request:
13+
paths:
14+
- ".github/workflows/**"
15+
- "examples/**"
16+
- "**.cpp"
17+
- "**.h"
18+
- "**.hpp"
19+
workflow_dispatch:
20+
repository_dispatch:
21+
22+
jobs:
23+
# debounce job to reduce duplicate compilations, taken from https://stackoverflow.com/questions/75714742/do-not-trigger-github-action-workflow-on-push-if-a-pr-is-open-on-the-branch
24+
debounce:
25+
runs-on: ubuntu-latest
26+
env:
27+
GH_TOKEN: ${{ github.token }}
28+
outputs:
29+
abort: ${{ steps.debounce.outputs.abort }}
30+
steps:
31+
- name: Debounce
32+
if: github.event_name == 'push'
33+
id: debounce
34+
run: |
35+
pr_branches=$(gh pr list --repo $GITHUB_REPOSITORY -q '.[] | select(.isCrossRepository == false)' --json isCrossRepository --json headRefName)
36+
this_branch=$(echo $GITHUB_REF | sed -e 's/refs\/heads\///')
37+
if [[ $(echo "$pr_branches" | grep "$this_branch") ]]; then
38+
echo "This push is associated with a pull request. Skipping the job."
39+
echo "abort=true" >> "$GITHUB_OUTPUT"
40+
fi
41+
42+
build:
43+
name: ${{ matrix.board.fqbn }}
44+
runs-on: ubuntu-latest
45+
needs: debounce
46+
if: needs.debounce.outputs.abort != 'true'
47+
48+
env:
49+
SKETCHES_REPORTS_PATH: sketches-reports
50+
51+
strategy:
52+
fail-fast: false
53+
54+
# Of course we'll want to add all supported arches. See https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/.github/workflows/compile-examples.yml for a complex multi-board setup
55+
matrix:
56+
board:
57+
- fqbn: arduino:avr:uno
58+
platforms: |
59+
- name: arduino:avr
60+
internalid: arduino_avr # This is just some unique id string we assign for use in the artifact name (fqbn does not qualify due to containing colons)
61+
- fqbn: esp8266:esp8266:huzzah
62+
type: 8266
63+
platforms: |
64+
- name: esp8266:esp8266
65+
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
66+
internalid: esp8266
67+
- fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8
68+
platforms: |
69+
- name: STMicroelectronics:stm32
70+
source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
71+
internalid: stm32_official
72+
- fqbn: arduino:mbed_giga:giga
73+
platforms: |
74+
- name: arduino:mbed_giga
75+
internalid: arduino_giga
76+
# SAMD boards. There is also an Adrafruit fork of this core, and the two seem to have diverged, considerably. I have no idea on the differences.
77+
- fqbn: arduino:samd:adafruit_circuitplayground_m0
78+
platforms: |
79+
- name: arduino:samd
80+
internalid: arduino_samd
81+
- fqbn: rp2040:rp2040:rpipico
82+
type: rp2040
83+
platforms: |
84+
- name: rp2040:rp2040
85+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
86+
internalid: rp2040
87+
- fqbn: arduino:renesas_uno:minima
88+
platforms: |
89+
- name: arduino:renesas_uno
90+
internalid: arduino_unor4
91+
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v3
95+
96+
- name: Compile examples
97+
uses: arduino/compile-sketches@v1
98+
with:
99+
github-token: ${{ secrets.GITHUB_TOKEN }}
100+
fqbn: ${{ matrix.board.fqbn }}
101+
platforms: ${{ matrix.board.platforms }}
102+
# limit to only some sketches for now, while figuring out the workflow
103+
sketch-paths: |
104+
- examples/01.Basics
105+
- examples/02.Control
106+
- examples/06.Synthesis
107+
libraries: |
108+
- source-path: ./
109+
- name: PinChangeInterrupt
110+
- name: MIDI Library
111+
- name: Arduino_AdvancedAnalog
112+
enable-deltas-report: true
113+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
114+
115+
- name: Save sketches report as workflow artifact
116+
uses: actions/upload-artifact@v4
117+
with:
118+
if-no-files-found: error
119+
path: ${{ env.SKETCHES_REPORTS_PATH }}
120+
name: sketches-reports-artifact-${{ matrix.board.internalid }}
121+
122+
# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
123+
report:
124+
needs: build # Wait for the compile job to finish to get the data for the report
125+
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
126+
continue-on-error: true # Not the programmer's fault, if reporting fails
127+
runs-on: ubuntu-latest
128+
steps:
129+
# This step is needed to get the size data produced by the compile jobs
130+
- name: Download sketches reports artifact
131+
uses: actions/download-artifact@v4
132+
with:
133+
pattern: sketches-reports-artifact-*
134+
merge-multiple: true
135+
path: ${{ env.SKETCHES_REPORTS_PATH }}
136+
137+
- uses: arduino/report-size-deltas@v1
138+
with:
139+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
Mozzi-resources
3+
.vscode
34
*.out
45
*.ogg
56
*.mp3

AudioConfigMBED.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#ifndef AUDIOCONFIGMBED_H
2+
#define AUDIOCONFIGMBED_H
3+
4+
#if not IS_MBED()
5+
#error This header should be included for MBED OS boards, only
6+
#endif
7+
8+
#if (AUDIO_MODE == HIFI)
9+
#error HIFI mode is not available for this CPU architecture (but several high quality output options are available)
10+
#endif
11+
12+
// Audio output options
13+
#define INTERNAL_DAC 1 // output using internal DAC driven via DMA. Output is only possible on the DAC pins (A12, and A13 on the Giga)
14+
#define PDM_VIA_SERIAL 2 // output PDM coded sample on a hardware serial UART. NOTE: currently to be considered experimental. Tune is not correct for all combinatinos of AUDIO_RATE & PDM_RESOLUTION
15+
// Also NOTE that you will almost certainly want to use at least some basic RC filter circuit with this mode
16+
17+
// Set output mode
18+
#define MBED_AUDIO_OUT_MODE INTERNAL_DAC
19+
20+
#if (MBED_AUDIO_OUT_MODE == PDM_VIA_SERIAL)
21+
// For use in PDM_VIA_SERIAL, only: Peripheral to use. Note that only the TX channel is actually used, but sine this is a hardware UART, the corresponding
22+
// RX channel needs to be claimed, as well. NOTE: This does not necessarily correspond to the labeling on your board! E.g. SERIAL2_TX is TX1 on the Arduino Giga.
23+
#define PDM_SERIAL_UART_TX_CHANNEL_1 SERIAL2_TX
24+
#define PDM_SERIAL_UART_RX_CHANNEL_1 SERIAL2_RX
25+
#endif
26+
27+
/// User config end. Do not modify below this line
28+
29+
#if (MBED_AUDIO_OUT_MODE == INTERNAL_DAC)
30+
#define AUDIO_BITS 12
31+
#define AUDIO_CHANNEL_1_PIN A13
32+
#define AUDIO_CHANNEL_2_PIN A12
33+
#define BYPASS_MOZZI_OUTPUT_BUFFER true
34+
#elif (MBED_AUDIO_OUT_MODE == PDM_VIA_SERIAL)
35+
#define AUDIO_BITS 16 // well, used internally, at least. The pins will not be able to actually produce this many bits
36+
#define PDM_RESOLUTION 2
37+
#define BYPASS_MOZZI_OUTPUT_BUFFER true
38+
#else
39+
#error Invalid output mode configured in AudioConfigMBED.h
40+
#endif
41+
42+
//#define BYPASS_MOZZI_INPUT_BUFFER true
43+
#define AUDIO_BIAS ((uint16_t) 1<<(AUDIO_BITS-1))
44+
45+
#endif // #ifndef AUDIOCONFIGMBED_H

AudioConfigRenesas.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef AUDIOCONFIGRENESAS_H
2+
#define AUDIOCONFIGRENESAS_H
3+
4+
#if not IS_RENESAS()
5+
#error This header should be included for Arduino FSB board (Uno R4/Renesa) family, only
6+
#endif
7+
8+
9+
10+
11+
#define AUDIO_CHANNEL_1_PIN A0
12+
#if (AUDIO_CHANNELS > 1)
13+
#define AUDIO_CHANNEL_2_PIN 10
14+
#endif
15+
16+
#define AUDIO_BITS 12 // outputting resolution of the on-bard DAC. Other values are *NOT* expected to work.
17+
18+
#define AUDIO_BITS_PER_CHANNEL AUDIO_BITS
19+
20+
#define AUDIO_BIAS ((uint16_t) 1<<(AUDIO_BITS-1))
21+
22+
#define BYPASS_MOZZI_OUTPUT_BUFFER true // Mozzi initial buffer are not of the good type, so we bypass it and create our own
23+
24+
#endif // #ifndef AUDIOCONFIGRENESAS_H
25+

AudioConfigSTM32duino.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef AUDIOCONFIGSTM32_H
2+
#define AUDIOCONFIGSTM32_H
3+
4+
#if not IS_STM32DUINO()
5+
#error This header should be included for STM32 (stm32duino.com core), only
6+
#endif
7+
8+
// Audio output pin. If you want to change this, make sure to also set AUDIO_PWM_TIMER to whichever timer is responsible for your PWM pin, and set the other timers to non-conflicting values
9+
#define AUDIO_CHANNEL_1_PIN PA8 // Note: PB8 does not appear to be available as a PWM pin with this core.
10+
// The timer used for running the audio update loop. This must _not_ be the same timer responsible for PWM on the output pins! NOTE: Timer 3 appears to clash with SPI DMA transfers under some circumstances
11+
#define AUDIO_UPDATE_TIMER TIM2
12+
13+
#if (AUDIO_MODE == HIFI)
14+
// Second out pin for HIFI mode. This must be on the same timer as AUDIO_CHANNEL_1_PIN!
15+
// Note that by default we are not using adjacent pins. This is to leave the "Serial1" pins available (often used for upload/communication with Arduino IDE). If you don't need that, PA9 is a good choice.
16+
#define AUDIO_CHANNEL_1_PIN_HIGH PA9
17+
// Total audio bits.
18+
#define AUDIO_BITS 14
19+
#define AUDIO_BITS_PER_CHANNEL 7
20+
#else
21+
// The more audio bits you use, the slower the carrier frequency of the PWM signal. 10 bits yields ~ 70kHz on a 72Mhz CPU (which appears to be a reasonable compromise)
22+
#define AUDIO_BITS 10
23+
#define AUDIO_BITS_PER_CHANNEL AUDIO_BITS
24+
#if (AUDIO_CHANNELS > 1)
25+
// Second out pin for stereo mode. This must be on the same timer as AUDIO_CHANNEL_1_PIN!
26+
#define AUDIO_CHANNEL_2_PIN PA9
27+
#endif
28+
#endif
29+
30+
#define AUDIO_BIAS ((uint16_t) 1<<(AUDIO_BITS-1))
31+
32+
#endif // #ifndef AUDIOCONFIGSTM32_H
33+

CircularBuffer.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ On 18 April 2014, the simplified version on the Wikipedia page for power of 2 si
55
doesn't work - cbIsEmpty() returns true whether the buffer is full or empty.
66
*/
77

8+
#define MOZZI_BUFFER_SIZE 256 // do not expect to change and it to work.
9+
// just here for forward compatibility if one day
10+
// the buffer size might be editable
11+
812
/** Circular buffer object. Has a fixed number of cells, set to 256.
913
@tparam ITEM_TYPE the kind of data to store, eg. int, int8_t etc.
1014
*/
@@ -47,9 +51,13 @@ class CircularBuffer
4751
unsigned long count() {
4852
return (num_buffers_read << 8) + start;
4953
}
54+
inline
55+
ITEM_TYPE * address() {
56+
return items;
57+
}
5058

5159
private:
52-
ITEM_TYPE items[256];
60+
ITEM_TYPE items[MOZZI_BUFFER_SIZE];
5361
uint8_t start; /* index of oldest itement */
5462
uint8_t end; /* index at which to write new itement */
5563
uint8_t s_msb;

IntegerType.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef INTTYPE_H_
2+
#define INTTYPE_H_
13

24
template<uint8_t BYTES> struct IntegerType {
35
// at an odd value, such as 3 bytes? Add one more byte (up to at most 8 bytes)..
@@ -25,3 +27,5 @@ template<> struct IntegerType<8> {
2527
typedef uint64_t unsigned_type;
2628
typedef int64_t signed_type;
2729
};
30+
31+
#endif /* INTTYPE_H_ */

0 commit comments

Comments
 (0)