Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 92 additions & 10 deletions .github/workflows/arduino-cli-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@ on:
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
build_all:
description: "Build heavy sketches too?"
required: false
default: "false"

jobs:
build:
name: Build ${{ matrix.board.name }} - ${{ matrix.sketch }}
name: Build ${{ matrix.board.name }} - ${{ matrix.sketch.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
sketch:
- ml_audio_test
- ml_midi_monitor
- name: ml_audio_test
manual_only: false
- name: ml_midi_monitor
manual_only: false
# - name: ml_epiano_example
# manual_only: true
# - name: ml_mod_tracker
# manual_only: true

board:

Expand Down Expand Up @@ -159,15 +171,85 @@ jobs:
exclude:
- board:
name: "XIAO_ESP32C3"
sketch: ml_audio_test
sketch:
name: ml_audio_test

- board:
name: "ESP32C3 Dev Module"
sketch: ml_audio_test
sketch:
name: ml_audio_test

- board:
name: "Generic STM32F4 Series - BlackPill F411CE"
sketch: ml_audio_test
sketch:
name: ml_audio_test


- board:
name: "Teensy 4.1"
sketch:
name: ml_epiano_example

- board:
name: "Generic STM32H7 Series - Daisy Seed"
sketch:
name: ml_epiano_example

- board:
name: "ESP8266 Dev Module"
sketch:
name: ml_epiano_example

- board:
name: "ESP32C3 Dev Module"
sketch:
name: ml_epiano_example

- board:
name: "XIAO_ESP32C3"
sketch:
name: ml_epiano_example

- board:
name: "Seeeduino XIAO (SAMD21)"
sketch:
name: ml_epiano_example

- board:
name: "Generic STM32F4 Series - BlackPill F411CE"
sketch:
name: ml_epiano_example


- board:
name: "XIAO_ESP32C3"
sketch:
name: ml_mod_tracker

- board:
name: "ESP32C3 Dev Module"
sketch:
name: ml_mod_tracker

- board:
name: "ESP8266 Dev Module"
sketch:
name: ml_mod_tracker

- board:
name: "Seeeduino XIAO (SAMD21)"
sketch:
name: ml_mod_tracker

- board:
name: "Generic STM32H7 Series - Daisy Seed"
sketch:
name: ml_mod_tracker

- board:
name: "Generic STM32F4 Series - BlackPill F411CE"
sketch:
name: ml_mod_tracker

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -215,8 +297,8 @@ jobs:

arduino-cli compile \
--fqbn "$FULL_FQBN" \
--output-dir build/${{ matrix.board.fname }}-${{ matrix.sketch }} \
examples/${{ matrix.sketch }}
--output-dir build/${{ matrix.board.fname }}-${{ matrix.sketch.name }} \
examples/${{ matrix.sketch.name }}

- name: Generate UF2 (SAMD21)
if: matrix.board.family == 'SAMD21'
Expand All @@ -233,8 +315,8 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.board.fname }}-${{ matrix.sketch }}
path: build/${{ matrix.board.fname }}-${{ matrix.sketch }}
name: firmware-${{ matrix.board.fname }}-${{ matrix.sketch.name }}
path: build/${{ matrix.board.fname }}-${{ matrix.sketch.name }}

- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
Expand Down
46 changes: 24 additions & 22 deletions src/audio_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,13 @@ I2S i2s(OUTPUT);
#endif

#ifdef OUTPUT_SAW_TEST
static float saw_left[SAMPLE_BUFFER_SIZE];
static float saw_right[SAMPLE_BUFFER_SIZE];
static int32_t saw_i32[SAMPLE_BUFFER_SIZE];
static float test_signal_saw_left[SAMPLE_BUFFER_SIZE];
static float test_signal_saw_right[SAMPLE_BUFFER_SIZE];
static int32_t test_signal_saw_i32[SAMPLE_BUFFER_SIZE];
#endif
#ifdef OUTPUT_SINE_TEST
static float sin_left[SAMPLE_BUFFER_SIZE];
static float sin_right[SAMPLE_BUFFER_SIZE];
static int32_t sine_i32[SAMPLE_BUFFER_SIZE];
static float test_signal_sin[4][SAMPLE_BUFFER_SIZE];
static int32_t test_signal_sine_i32[4][SAMPLE_BUFFER_SIZE];
#endif

void Audio_Setup(void)
Expand All @@ -176,10 +175,10 @@ void Audio_Setup(void)
{
float saw = ((float)i * 2.0f) / ((float)SAMPLE_BUFFER_SIZE);
saw -= 1.0f;
saw_left[i] = saw;
saw_right[i] = saw;
test_signal_saw_left[i] = saw;
test_signal_saw_right[i] = saw;
saw *= 1073741824;
saw_i32[i] = saw;
test_signal_saw_i32[i] = saw;
}
#endif
#ifdef OUTPUT_SINE_TEST
Expand All @@ -196,10 +195,13 @@ void Audio_Setup(void)
w *= 1.0f / ((float)SAMPLE_BUFFER_SIZE);
w *= 2.0f * M_PI;
float sine = sin(w);
sin_left[i] = sine;
sin_right[i] = sin(w * 2.0f);
sine *= 1073741824;
sine_i32[i] = sine;
for (int n = 0; n < 4; n++)
{
sine = sin(n * w * 2.0f);
test_signal_sin[n][i] = sine;
sine *= 1073741824;
test_signal_sine_i32[n][i] = sine;
}
}
#endif

Expand Down Expand Up @@ -389,7 +391,7 @@ void ProcessAudio(uint16_t *buff, size_t len)
}
}

#endif
#endif /* (defined ARDUINO_SEEED_XIAO_M0) || (defined SEEED_XIAO_M0) */

#ifdef AUDIO_PRINT_STATS
#if (defined ARDUINO_RASPBERRY_PI_PICO) || (defined ARDUINO_GENERIC_RP2040)
Expand Down Expand Up @@ -429,10 +431,10 @@ void Audio_Output(const int16_t *samples)
void Audio_OutputMono(const int32_t *samples)
{
#ifdef OUTPUT_SAW_TEST
samples = saw_i32;
samples = (const int32_t *)test_signal_saw_i32;
#endif
#ifdef OUTPUT_SINE_TEST
samples = sine_i32;
samples = (const int32_t *)test_signal_sine_i32;
#endif

#ifdef ESP8266
Expand Down Expand Up @@ -529,7 +531,7 @@ void Audio_OutputMono(const int32_t *samples)
memcpy(out_temp[1], sig_f, sizeof(out_temp[1]));

dataReady = false;
#endif /* ARDUINO_DAISY_SEED */
#endif /* (defined ARDUINO_DAISY_SEED) || (defined STM32H7xx) */

#if (defined ARDUINO_SEEED_XIAO_M0) || (defined SEEED_XIAO_M0)
#ifdef CYCLE_MODULE_ENABLED
Expand All @@ -543,7 +545,7 @@ void Audio_OutputMono(const int32_t *samples)
#ifdef CYCLE_MODULE_ENABLED
calcCycleCount();
#endif
#endif /* ARDUINO_SEEED_XIAO_M0 */
#endif /* (defined ARDUINO_SEEED_XIAO_M0) || (defined SEEED_XIAO_M0) */

#ifdef ARDUINO_DISCO_F407VGxx
int16_t mono_s16[SAMPLE_BUFFER_SIZE];
Expand Down Expand Up @@ -866,12 +868,12 @@ void Audio_Input(float *left __attribute__((__unused__)), float *right __attribu
void Audio_Output(const float *left, const float *right)
{
#ifdef OUTPUT_SAW_TEST
left = saw_left;
right = saw_right;
left = (const float *)test_signal_saw_left;
right = (const float *)test_signal_saw_right;
#endif
#ifdef OUTPUT_SINE_TEST
left = sin_left;
right = sin_right;
left = (const float *)test_signal_sin[0];
right = (const float *)test_signal_sin[1];
#endif

#ifdef ESP32
Expand Down