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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ body:
attributes:
label: Version
description: The release you flashed (e.g. from its file name), or the commit if you built it yourself.
placeholder: v0.6.1
placeholder: v0.7.0
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ body:
attributes:
label: Version
description: The release you are using, if the request is about something you've seen on hardware.
placeholder: v0.6.1
placeholder: v0.7.0
validations:
required: false
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
SP1_HOST_BUILD_DIR: ${{ runner.temp }}/host
run: |
sh tools/host-tests/hostbuild.sh routetest.cc uitest.c miditest.cc miditest_alt.cc \
miditest_pickup.cc miditest_clock.cc ../../third_party/feldd/test/test_usb_rt_parse.c
miditest_pickup.cc miditest_clock.cc ../../third_party/feldd/test/test_usb_rt_parse.c \
uactest.c
"$SP1_HOST_BUILD_DIR/routetest"
"$SP1_HOST_BUILD_DIR/uitest"
"$SP1_HOST_BUILD_DIR/miditest"
Expand All @@ -41,6 +42,7 @@ jobs:
"$SP1_HOST_BUILD_DIR/miditest_pickup_takeover"
"$SP1_HOST_BUILD_DIR/miditest_clock"
"$SP1_HOST_BUILD_DIR/test_usb_rt_parse"
"$SP1_HOST_BUILD_DIR/uactest"

firmware:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion LICENSES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ what was changed.
| `MIT-sp1-tape-looper.txt` | chattock | the board definition, power-off and watchdog sequence, and codec bring-up adapted from chattock/sp1-tape-looper |
| `MIT-SP-1-dev.txt` | Tim Knapen | the SP-1 pin map and hardware documentation from timknapen/SP-1-dev |
| `MIT-sp1-midi.txt` | Eric Lewis | the original `stem_player` Zephyr board that the board definition descends from |
| `Apache-2.0.txt` | the Zephyr Project contributors | `boards/teenageengineering/stem_player/Kconfig.defconfig`, `Kconfig.stem_player` and `stem_player_defconfig` (inherited from Zephyr's board template), `zephyr-patches/`, `firmware/src/sp1_usbd.c` (derived from Zephyr's USB sample helper), and the Zephyr RTOS compiled into every firmware image |
| `Apache-2.0.txt` | the Zephyr Project contributors; Ryan Gilmore | `third_party/sp1-usb-audio/` (USB audio out; it also carries its own `LICENSE` and `NOTICE`), `firmware/src/sp1_uac.{c,h}` and `tools/host-tests/uactest.c` (derived from it), `boards/teenageengineering/stem_player/Kconfig.defconfig`, `Kconfig.stem_player` and `stem_player_defconfig` (inherited from Zephyr's board template), `zephyr-patches/`, `firmware/src/sp1_usbd.c` (derived from Zephyr's USB sample helper), and the Zephyr RTOS compiled into every firmware image |

A built firmware image also contains other Zephyr modules (CMSIS, Nordic's `hal_nordic`) under
their own licences. Release archives will carry a generated bill of materials listing them.
17 changes: 17 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ USB-MIDI 1.0 device class (M5a) — vendored unmodified in third_party/feldd/
instead of feldd's clock router and MIDI-thru. Commit and file list:
third_party/feldd/README.md.

USB audio out (M5c) — vendored unmodified in third_party/sp1-usb-audio/upstream/
ryanmgilmore/sp1-usb-audio — Copyright (c) 2026 Ryan Gilmore — Apache-2.0
https://github.com/ryanmgilmore/sp1-usb-audio
Licence text: LICENSES/Apache-2.0.txt (and upstream/LICENSE).
The whole repository at one commit; its own NOTICE
(third_party/sp1-usb-audio/upstream/NOTICE) is carried forward with it: it
credits Nordic Semiconductor ASA (Apache-2.0) for the modified driver in
module/nrf-usbd-isofast/, and chattock/sp1-tape-looper (MIT) for the SP-1
audio bring-up in sp1/fw/src/audio.c. Wakes uses usb-audio/uacring.c,
MODIFIED by third_party/sp1-usb-audio/patches/uacring.patch (word copies in
place of memcpy/memset), applied at build time to a copy; the vendored file
is unchanged. tools/host-tests/uactest.c is derived from its
test/test_uacring.c and stays Apache-2.0. firmware/src/sp1_uac.{c,h} (the
USB Audio Class 1.0 function) follow its usb-audio/usb_audio.c for the fill
function and the stream start/stop, and are Apache-2.0. Commit and what each
part is for: third_party/sp1-usb-audio/README.md.

Zephyr RTOS — Apache-2.0 — https://github.com/zephyrproject-rtos/zephyr
Licence text: LICENSES/Apache-2.0.txt
boards/teenageengineering/stem_player/Kconfig.defconfig, Kconfig.stem_player
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ IMPORTANT: Flashing custom firmware on the SP-1 is at your own risk. SP-1s are a

## Status

**v0.6.1, pre-release for beta testing.** Report problems with the bug form under [Issues](https://github.com/Worldwave/Wakes/issues).
**v0.7.0, pre-release for beta testing.** Report problems with the bug form under [Issues](https://github.com/Worldwave/Wakes/issues).

## Flashing

Expand Down Expand Up @@ -60,6 +60,7 @@ Output: `build/zephyr/wakes-sp1.bin`. The Zephyr patch is required and is lost o
| [`docs/DEFAULTS.md`](docs/DEFAULTS.md) | every default, and what a reset restores |
| [`docs/MIDI.md`](docs/MIDI.md) | MIDI over USB: what it does, and how to change it |
| [`config/midi.ini`](config/midi.ini) | the MIDI script: channel, legato, CC numbers (editable) |
| [`config/audio.ini`](config/audio.ini) | USB audio out: its level (parked or on VOL) and the speaker while a host records (editable) |
| [`docs/SAFETY.md`](docs/SAFETY.md) | rules for anyone changing the firmware |

## Licence
Expand Down
43 changes: 43 additions & 0 deletions config/audio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
; =====================================================================================
; Wakes — the audio settings
; =====================================================================================
;
; How Wakes' sound leaves the device. Edit it in your fork, build (or let CI build) and
; flash: the build reads this file and FAILS with the line number if something in it is
; wrong, so a typo can never become a firmware that silently ignores your setting.
;
; Lines starting with ; are comments. Every setting can be left out to get its default.


[usb]
; USB AUDIO OUT. Plugged into a computer, phone or other USB host, Wakes shows up as an
; audio input ("Wakes Audio Out", or "Wakes" -- the name depends on the host): 48 kHz,
; 16-bit stereo, no driver. It carries what the speaker and headphones get -- the output
; select (OUT / AUX / OUT+AUX / OUTxAUX) and the drive included. Nothing changes until a
; host actually takes the audio (records or monitors the input); these settings apply only
; while it does. Headphones always play.

; How USB audio out sets its level:
; parked (default) = while a host takes USB audio, VOL is set to `parked_level` and its
; buttons do nothing, so a recording's level never depends on where VOL happened to
; be. When the host stops, VOL goes back to where you left it.
; Wakes has ONE output level for every output, so parking it parks the headphones
; (and the speaker, if `speaker = on`) at that level too. That is deliberate: it is
; the cheapest way to do it. A separate level for USB alone would need a second gain
; pass over every block of audio (about 0.3 % of the CPU), which Wakes keeps for its
; engines.
; vol = VOL moves USB audio out like everything else, like the volume knob of a
; hardware synth on a mixer track.
level = parked

; The level USB audio out is parked at, in dB: one of VOL's steps -- 0, -3, -6, -9, -12,
; -15, -18, -21, -24, -27 or -30. 0 is full scale, which Wakes' loudest patches (the
; drive's top steps) reach; -6 leaves a recording some headroom.
parked_level = -6

; The speaker while a host takes USB audio:
; off (default) = quiet: the host is recording, so the room only gets a second copy.
; It comes back as soon as the host stops taking the audio (or goes to sleep, or the
; cable is pulled).
; on = it keeps playing.
speaker = off
2 changes: 2 additions & 0 deletions config/midi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ clock = on
; grid: swing, triplets, playing by hand) it uses auto. The console's "MIDI notes vs
; clock" line shows the measurement and the lead in use.
; auto = Wakes' own delay (8.5 ms): Marbles' beats leave the output when the clock's do.
; While the host is recording Wakes over USB audio, that output is 1 ms later, and
; auto (and notes, until it has measured) follows it: 9.5 ms.
; A number: that many ms, for a host whose clock offset you would rather set here.
; With notes or auto, leave the host's own clock offset / sync delay for Wakes at 0.
; Beat 1 after a Start is the exception: nothing said when it would come, so it sounds
Expand Down
8 changes: 5 additions & 3 deletions docs/MIDI.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# MIDI on Wakes

Plug the SP-1 into a computer, phone or a USB host like the OP-XY, and Wakes shows up as a
class-compliant **USB-MIDI** port called `wakes-sp1` — no driver. It listens; it does not send.
class-compliant **USB-MIDI** port called `Wakes` — no driver. It listens; it does not send.
(Through v0.6.x the port was called `wakes-sp1`: re-select it once in your DAW or host.)

Nothing about it needs setting up on the device, and there are **no new pages**: notes play
Plaits straight away, and everything deeper is set in the MIDI script,
Expand Down Expand Up @@ -124,7 +125,8 @@ Marbles locks to the host, the way a Eurorack Marbles does with a cable in its C
default `clock_lead = notes` Wakes measures where the host's quantised notes fall on its
clock and leads by exactly that: Marbles' beats land with the notes, and **the host needs no
clock offset for Wakes — leave it at 0**. Until notes arrive (or with notes off the 16th grid:
swing, triplets, playing by hand) it leads by Wakes' own delay (`auto`, 8.5 ms). The console's
swing, triplets, playing by hand) it leads by Wakes' own delay (`auto`, 8.5 ms; 9.5 ms while the
host records Wakes over USB audio, which leaves Wakes 1 ms later than the speaker). The console's
`MIDI notes vs clock` line shows the measurement and the lead in use. Beat 1 after a Start is
the exception — nothing said when it would come — so Marbles is on time from beat 2. Notes
cannot be played early: give Wakes' track the DAW's usual hardware latency compensation.
Expand Down Expand Up @@ -214,7 +216,7 @@ What it sets:
- `pickup` — `shared` (default), `sum` or `takeover` (above).
- `clock` — `on` (default): Marbles follows MIDI clock and transport (above); `off` ignores them.
- `clock_lead` — `notes` (default: as far as the host's notes say), `auto` (8.5 ms, Wakes' own
delay) or 0–200 ms: how far ahead of the host's
delay; 9.5 ms while a host records Wakes over USB audio) or 0–200 ms: how far ahead of the host's
clock Marbles runs (above).
- one line per parameter — `name = cc N`, or `none`.
- `[bind]` — `velocity` and `aftertouch` (channel pressure) can push a parameter by a depth
Expand Down
Binary file modified docs/Wakes - Manual.pdf
Binary file not shown.
42 changes: 42 additions & 0 deletions firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ add_custom_command(
add_custom_target(sp1_midi_gen DEPENDS ${SP1_MIDI_OUT})
add_dependencies(app sp1_midi_gen)

# ---- the audio settings: config/audio.ini -> sp1_audio_gen.h (M5c) ----
# How sound leaves the device: USB audio out's level mode and the speaker while a host takes
# it. Same rule as the MIDI script: a bad value fails the build, naming the line.
set(SP1_AUDIO_INI ${CMAKE_CURRENT_SOURCE_DIR}/../config/audio.ini)
set(SP1_AUDIO_GEN ${CMAKE_CURRENT_SOURCE_DIR}/../tools/gen_audio.py)
set(SP1_AUDIO_H ${CMAKE_CURRENT_BINARY_DIR}/sp1_generated/sp1_audio_gen.h)
add_custom_command(
OUTPUT ${SP1_AUDIO_H}
COMMAND ${Python3_EXECUTABLE} ${SP1_AUDIO_GEN} ${SP1_AUDIO_INI} ${SP1_AUDIO_H}
DEPENDS ${SP1_AUDIO_INI} ${SP1_AUDIO_GEN}
COMMENT "Generating the audio settings from config/audio.ini"
)
add_custom_target(sp1_audio_gen DEPENDS ${SP1_AUDIO_H})
add_dependencies(app sp1_audio_gen)

target_sources(app PRIVATE
src/main.c
src/sp1_led.c
Expand Down Expand Up @@ -414,4 +429,31 @@ if(CONFIG_SP1_PLAITS)
target_sources(app PRIVATE ${FELDD_OUT} ${FELDD}/src/usb_rt_parse.c)
target_include_directories(app PRIVATE ${FELDD}/src)
endif()

if(CONFIG_SP1_USB_AUDIO)
# M5c: USB audio out. The class is ours (src/sp1_uac.c); the ring and packet
# regulator are Ryan Gilmore's uacring.c, vendored unmodified in
# third_party/sp1-usb-audio, with Wakes' patch (word copies instead of picolibc's
# byte-loop memcpy) applied to a copy STRICTLY, as for feldd above.
set(UAC ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/sp1-usb-audio)
set(UAC_OUT ${CMAKE_CURRENT_BINARY_DIR}/sp1-usb-audio/uacring.c)
execute_process(
COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/../tools/apply_patch.py
${UAC}/upstream/usb-audio/uacring.c ${UAC}/patches/uacring.patch ${UAC_OUT}
RESULT_VARIABLE uac_rc)
if(NOT uac_rc EQUAL 0)
message(FATAL_ERROR "third_party/sp1-usb-audio/patches/uacring.patch does not apply")
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${UAC}/upstream/usb-audio/uacring.c ${UAC}/patches/uacring.patch
${CMAKE_CURRENT_SOURCE_DIR}/../tools/apply_patch.py)
target_sources(app PRIVATE src/sp1_uac.c ${UAC_OUT})
target_include_directories(app PRIVATE ${UAC}/upstream/usb-audio)
# Wakes' tuning (96-frame blocks) ahead of uacring.h, exactly as uactest builds it;
# and no loop distribution, or GCC turns the word copies back into memcpy/memset
# calls (tools/ci/check_image.py checks the image).
set_source_files_properties(${UAC_OUT} PROPERTIES COMPILE_OPTIONS
"-include;${CMAKE_CURRENT_SOURCE_DIR}/src/sp1_uac_tuning.h;-fno-tree-loop-distribute-patterns;-fno-unroll-loops")
endif()
endif()
24 changes: 20 additions & 4 deletions firmware/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ config SP1_USB_VID

config SP1_USB_PID
hex "USB product ID"
default 0x5212
default 0x5213
help
0x5211 through M4e (console only); 0x5212 from M5a (console + MIDI).
0x5211 through M4e (console only); 0x5212 from M5a (console + MIDI);
0x5213 from M5c (console + MIDI + audio out). Interim: pid.codes
1209:4440 is requested (pidcodes/pidcodes.github.com#1301).

config SP1_USB_MANUFACTURER
string "USB manufacturer string"
default "worldwave"
default "Worldwave"

config SP1_USB_PRODUCT
string "USB product string (the name hosts show for the device and its MIDI port)"
default "wakes-sp1"
default "Wakes"
help
"wakes-sp1" through v0.6.x; "Wakes" from M5c (Adara). DAWs remember MIDI routings by
port name, so a change means re-selecting the port once on each host.

config SP1_USB_MAX_POWER
int "bMaxPower, in units of 2 mA"
Expand Down Expand Up @@ -111,6 +116,17 @@ config SP1_MIDI
config/midi.ini at build time. Costs nothing until a host sends something.
n: no MIDI function on the USB device at all.

config SP1_USB_AUDIO
bool "USB audio out: the SP-1's output to the host, USB Audio Class 1.0 (M5c)"
default y
depends on SP1_PLAITS && UDC_NRF_ISO_IN_FAST
help
The output the codecs get, after VOL, sent to the host as a 48 kHz 16-bit
stereo input (src/sp1_uac.c). Output only: nothing is received from the host.
Packets go out from the USB interrupt through the ISO IN fast path
(zephyr-patches/udc_nrf-fast-paths.patch), which is required. Costs nothing
until a host opens the stream.

config SP1_PLAITS
bool "Plaits voice as the audio source (M3)"
default y
Expand Down
4 changes: 2 additions & 2 deletions firmware/VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_MAJOR = 0
VERSION_MINOR = 6
PATCHLEVEL = 1
VERSION_MINOR = 7
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =
3 changes: 3 additions & 0 deletions firmware/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ CONFIG_RING_BUFFER=y
# That frees Zephyr's USB threads to run below audio (CONFIG_SP1_USB_THREADS_BELOW_AUDIO,
# on by default with it).
CONFIG_UDC_NRF_OUT_FAST=y
# M5c: USB audio out sends every packet from the USB interrupt (Ryan Gilmore's ISO IN fast
# path, same patch). CONFIG_SP1_USB_AUDIO (default y) needs it.
CONFIG_UDC_NRF_ISO_IN_FAST=y

CONFIG_LOG=n
CONFIG_ASSERT=n
Expand Down
Loading
Loading