Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor juno6 to see AMY's voice support and work nicer with other music apps on Tulip #202

Merged
merged 35 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
886ee34
close to getting juno6 working with AMY voices on its own
bwhitman Apr 4, 2024
7de560e
cleaning up. working for now, but see #201 for next steps
bwhitman Apr 5, 2024
9e3b130
close on patches app
bwhitman Apr 8, 2024
e6a4411
patch setting works, now for arpeg and piano
bwhitman Apr 8, 2024
bb29c5f
fix for #200
bwhitman Apr 8, 2024
ea7d5a4
working arpeggiator in voices/midi
bwhitman Apr 9, 2024
01c865e
removing arpeg and patch selector from juno
bwhitman Apr 10, 2024
cfc9a93
starting to port back polyvoice. for dan to look at
bwhitman Apr 12, 2024
66b63b2
pattern stub
bwhitman Apr 12, 2024
5ac6432
better branch
bwhitman Apr 12, 2024
168c12c
getting around osx update issue with unichar again
bwhitman Apr 12, 2024
f284e80
Sync manifest and midi changes with main.
dpwe Apr 15, 2024
f58cc08
midi.py switched over to Synth object &c.
dpwe Apr 15, 2024
9f00fcc
added arpegg.py, working with voices.py (for latest chan).
dpwe Apr 16, 2024
2db916c
arpegg.py: Remove the old arpegg.run() code.
dpwe Apr 16, 2024
aab72bd
midi.py,arpegg.py: Respect the time arg to midi_step.
dpwe Apr 16, 2024
d92b61b
voices.py,midi.py: Able to change polyphony without running out of vo…
dpwe Apr 17, 2024
7e2203a
juno6.py ought to work but kills 2 of 4 voices.
dpwe Apr 17, 2024
6867296
piano works
bwhitman Apr 18, 2024
0c68b44
fixing up indications of `timestamp` in amy code, thx douglas
bwhitman Apr 23, 2024
9849c74
memorypatches implementation working
bwhitman Apr 24, 2024
44be659
finding first patch free
bwhitman Apr 24, 2024
f49d643
docs
bwhitman Apr 24, 2024
cc5d614
support stereo wav for load_sample
bwhitman Apr 24, 2024
eeaaed9
stop h-scrolling in lists on voices
bwhitman Apr 26, 2024
7a6daec
stub for on the fly u8g2->lvgl fonts
bwhitman Apr 29, 2024
d8c9c82
Merge branch 'juno6-amy' of github.com:bwhitman/tulipcc into juno6-amy
bwhitman Apr 29, 2024
ddb2f22
upping amy
bwhitman Apr 29, 2024
eedd98b
checking (not working, but compiles) of bitmap lvgl fonts
bwhitman Apr 29, 2024
2c91750
getting closer on fonts. may split to separate branch
bwhitman May 5, 2024
11dfde5
closer.. not yet
bwhitman May 5, 2024
c7c9a4a
committing my best attempt yet at this so i can go back to it when i …
bwhitman May 5, 2024
7c951b6
some kerning issues still but closer than before.
bwhitman May 5, 2024
f4ab15e
defaults
bwhitman May 5, 2024
081b9c9
mostly working!
bwhitman May 5, 2024
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: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
[submodule "lv_binding_micropython"]
path = lv_binding_micropython
url = https://github.com/bwhitman/lv_binding_micropython
branch = tulip

2 changes: 1 addition & 1 deletion amy
Submodule amy updated from a4d7b7 to 798442
36 changes: 31 additions & 5 deletions docs/tulip_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ tulip.key_scan(0) # remember to turn it back off or you won't be able to type in
tulip.remap() # interactive, can write to your boot.py for you
tulip.key_remap(scan_code, modifier, target_cp437_code)

# You can also register a keyboard callback. Useful for full screen apps that share with others
# there can only be one keyboard callback running.
tulip.keyboard_callback(key)
def key(k):
print("got key: %d" % (key))

tulip.keyboard_callback() # removes callbacks.

# Return the last touch panel coordinates, up to 3 fingers at once
(x0, y0, x1, y1, x2, y2) = tulip.touch()

Expand Down Expand Up @@ -266,7 +274,7 @@ tulip.set_time()

## Music / sound

Tulip comes with the AMY synthesizer, a very full featured 120-oscillator synth that supports FM, PCM, additive synthesis, partial synthesis, filters, and much more. See the [AMY documentation](https://github.com/bwhitman/amy/blob/main/README.md) for more information, Tulip's version of AMY comes with stereo sound, chorus and reverb. It includes a "small" version of the PCM patch set (29 patches) alongside all the Juno-6 and DX7 patches.
Tulip comes with the AMY synthesizer, a very full featured 120-oscillator synth that supports FM, PCM, additive synthesis, partial synthesis, filters, and much more. See the [AMY documentation](https://github.com/bwhitman/amy/blob/main/README.md) for more information, Tulip's version of AMY comes with stereo sound, chorus and reverb. It includes a "small" version of the PCM patch set (29 patches) alongside all the Juno-6 and DX7 patches. It also has support for loading WAVE files in Tulip as samples.

Once connected to Wi-Fi, Tulip can also control or respond to an [Alles mesh.](https://github.com/bwhitman/alles/blob/main/README.md) Alles is a wrapper around AMY that lets you control the synthesizer over Wi-Fi to remote speakers, or other computers or Tulips. Connect any number of Alles speakers to the wifi to have instant surround sound! See the Alles [getting started tutorial](https://github.com/bwhitman/alles/blob/main/getting-started.md) for more information and for more music examples.

Expand All @@ -293,7 +301,24 @@ amy.send(voices='0', load_patch=101, note=50, vel=1, client=2) # just a certain
alles.local() # turns off mesh mode and goes back to local mode
```

Tuilp's Alles synth includes a stereo chorus unit which has a set of control parameters:
To load your own WAVE files as samples, use `tulip.load_sample`:

```python
# To save space / RAM, you may want to downsample your WAVE files to 22050Hz. We detect SR automatically.
patch = tulip.load_sample("flutea4.wav") # samples are converted to mono if they are stereo

# You can optionally tell us the loop start and end point (in samples), and base MIDI note of the sample.
patch = tulip.load_sample("flutea4.wav", midinote=81, loopstart=1020, loopend=1500)

# The patch number can now be used in the custom Tulip memory PCM sample player.
# It has all the features of the AMY's PCM wave type.
amy.send(osc=20, wave=amy.CUSTOM, patch=patch, vel=1, note=50)

# You can load up to 32 custom PCM patches. Be careful of memory use. load_sample will return -1 if there's no more room.
# You can unload already allocated patches:
tulip.unload_patch(patch) # frees the RAM and the patch slot
tulip.unload_patch() # frees all allocated PCM patches
```

Tulip also ships with our own [`music.py`](https://github.com/bwhitman/tulipcc/blob/main/tulip/shared/py/music.py), which lets you create chords, progressions and scales through code:

Expand Down Expand Up @@ -339,13 +364,14 @@ You can also send MIDI messages "locally", e.g. to a running program that is exp
```python
tulip.music_map(1,129) # change MIDI channel 1 to patch 129.

def callback(x): # for now you have to define a callback with a dummy parameter
def callback():
m = tulip.midi_in()
if(m[0]==144):
print("Note on, note # %d velocity # %d" % (m[1], m[2]))

tulip.midi_callback(callback)
tulip.midi_callback() # turns off callbacks
tulip.midi_add_callback(callback)
tulip.midi_remove_callback(callback) # turns off callback
tulip.midi_remove_callbacks() # turns off all

m = tulip.midi_in() # returns bytes of the last MIDI message received
tulip.midi_out((144,60,127)) # sends a note on message
Expand Down
2 changes: 1 addition & 1 deletion lv_binding_micropython
Submodule lv_binding_micropython updated 3 files
+1 −0 .gitmodules
+72 −103 lv_conf.h
+1 −1 lvgl
6 changes: 6 additions & 0 deletions tulip/esp32s3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ execute_process(COMMAND bash -c "cp ../../shared/lv_fonts/*.c ../../../lv_bindin
WORKING_DIRECTORY "."
)


# Then out font conf
execute_process(COMMAND bash -c "cp ../../shared/lv_font.h ../../../lv_binding_micropython/lvgl/src/font/"
WORKING_DIRECTORY "."
)

# Then we generate a lvgl.pp.c file, which is just the compiler preprocessor running in this env
execute_process(COMMAND bash -c "xtensa-esp32s3-elf-gcc -E -DLVGL_PREPROCESS -I ../../../lv_binding_micropython/pycparser/utils/fake_libc_include -I../../../lv_binding_micropython -I. -I../../../lv_binding_micropython/lvgl/src ../../../lv_binding_micropython/lvgl/lvgl.h > ../build/lvgl.pp.c"
WORKING_DIRECTORY "."
Expand Down
4 changes: 4 additions & 0 deletions tulip/esp32s3/esp32_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ list(APPEND MICROPY_SOURCE_PORT
gccollect.c
fatfs_port.c
machine_bitstream.c
machine_sdcard.c
machine_timer.c
machine_pin.c
machine_touchpad.c
Expand Down Expand Up @@ -140,8 +141,10 @@ list(APPEND MICROPY_SOURCE_EXTMOD
${TULIP_SHARED_DIR}/sounds.c
${TULIP_SHARED_DIR}/sequencer.c
${TULIP_SHARED_DIR}/lodepng.c
${TULIP_SHARED_DIR}/lvgl_u8g2.c
${TULIP_SHARED_DIR}/u8fontdata.c
${TULIP_SHARED_DIR}/u8g2_fonts.c
${TULIP_SHARED_DIR}/memorypcm.c
${AMY_DIR}/src/dsps_biquad_f32_ae32.S
${AMY_DIR}/src/algorithms.c
${AMY_DIR}/src/custom.c
Expand Down Expand Up @@ -266,6 +269,7 @@ target_compile_definitions(${MICROPY_TARGET} PUBLIC
target_compile_options(${MICROPY_TARGET} PUBLIC
-Wno-clobbered
-Wno-uninitialized
-Wno-dangling-pointer
-Wno-deprecated-declarations
-Wno-missing-field-initializers
-Wno-unused-const-variable
Expand Down
6 changes: 5 additions & 1 deletion tulip/esp32s3/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@
#define MICROPY_PY_NETWORK_WLAN (1)
#endif
#ifndef MICROPY_HW_ENABLE_SDCARD
#define MICROPY_HW_ENABLE_SDCARD (0) // TODO
#ifdef TDECK
#define MICROPY_HW_ENABLE_SDCARD (1)
#else
#define MICROPY_HW_ENABLE_SDCARD (0)
#endif
#endif
#define MICROPY_HW_SOFTSPI_MIN_DELAY (0)
#define MICROPY_HW_SOFTSPI_MAX_BAUDRATE (esp_rom_get_cpu_ticks_per_us() * 1000000 / 200) // roughly
Expand Down
4 changes: 4 additions & 0 deletions tulip/esp32s3/usb_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ bool check_interface_desc_boot_keyboard(const void *p) {
(intf->bInterfaceProtocol == 1)) {
isKeyboard = true;
Interface_Number = intf->bInterfaceNumber;


esp_err_t err = usb_host_interface_claim(Client_Handle, Device_Handle,
Interface_Number, intf->bAlternateSetting);
if (err != ESP_OK) printf("usb_host_interface_claim failed: 0x%x\n", err);
Expand Down Expand Up @@ -574,6 +576,8 @@ void new_enumeration_config_fn(const usb_config_desc_t *config_desc) {
// so the first "descriptor type" found is actually TYPE_CONFIGURATION
// and the call to show_config_desc(p) is equivalent to doing
// show_config_desc(config_desc) here.


const uint8_t *p = &config_desc->val[0];
uint8_t bLength;
int indent = 1;
Expand Down
156 changes: 0 additions & 156 deletions tulip/fs/app/juno6/arpegg.py

This file was deleted.

Loading
Loading