probonopd / MiniDexed

Dexed FM synthesizer similar to 8x DX7 (TX816/TX802) running on a bare metal Raspberry Pi (without a Linux kernel or operating system)
https://github.com/probonopd/MiniDexed/wiki
1.13k stars 81 forks source link

Implement Bank Select Buttons and MIDI Buttons #737

Closed diyelectromusic closed 1 week ago

diyelectromusic commented 1 month ago

Closes https://github.com/probonopd/MiniDexed/issues/736

Implements buttons and MIDI buttons via the following additional config items in minidexed.ini

ButtonPinBankUp=
ButtonActionBankUp=
ButtonPinBankDown=
ButtonActionBankDown=
MIDIButtonBankUp=
MIDIButtonBankDown=

Needs testing for following cases:

Note: this does not depend on the setting of PerformanceSelectToLoad - if operating on performance banks then they are always automatically loaded and selected when using buttons or MIDI buttons for selecting. Nothing else made sense to me as there is no "scroll then load" type action going on as would be the case via the UI itself.

Also, when a bank changes, the first voice/performance is automatically loaded. This might cause a bit of a delay when moving through performances maybe as I think loading performances can be a little slow...? Lets see how people get on...

So if anyone fancies giving it a go with the above configuration but also with your existing configs please do.

Kevin

github-actions[bot] commented 1 month ago

Build for testing: MiniDexed_2024-10-21-d1da3ad Use at your own risk.

plamikcho commented 4 weeks ago

Hi Kevin, I tried the attached build but it does not start due to an error. My setup is RPi3, SSD1306, PCM5102 and 4 buttons for TG and PG up/down. The buttons are working fine on a build from main branch. I see something strange in the log - GPIO button on pin: 80 (50) which is strange, probably this is the issue that causes the device halt. IMG_20241025_133014

#
# minidexed.ini
#

# Sound device
SoundDevice=i2s
#SoundDevice=pwm
#SoundDevice=hdmi
SampleRate=48000
#ChunkSize=256
DACI2CAddress=0
ChannelsSwapped=0

# MIDI
MIDIBaudRate=31250
#MIDIThru=umidi1,ttyS1
MIDIRXProgramChange=1

# HD44780 LCD
LCDEnabled=1
LCDPinEnable=17
LCDPinRegisterSelect=4
LCDPinReadWrite=0
LCDPinData4=22
LCDPinData5=23
LCDPinData6=24
LCDPinData7=25
LCDI2CAddress=0x00

# SSD1306 LCD
# For a 128x32 display, set LCDColumns=20; LCDRows=2
# For a 128x64 display, set LCDColumns=20; LCDRows=4
SSD1306LCDI2CAddress=0x3c
SSD1306LCDWidth=128
SSD1306LCDHeight=32

# Default is 16x2 display (e.g. HD44780)
LCDColumns=20
LCDRows=2

# GPIO Button Navigation
#  Any buttons set to 0 will be ignored
ButtonPinPrev=0
ButtonActionPrev=
ButtonPinNext=0
ButtonActionNext=
ButtonPinBack=11
ButtonActionBack=longpress
ButtonPinSelect=11
ButtonActionSelect=click
ButtonPinHome=11
ButtonActionHome=doubleclick
ButtonPinShortcut=11
# (Shortcut doesn't have an action)

ButtonPinPgmUp=13
ButtonActionPgmUp=click
ButtonPinPgmDown=12
ButtonActionPgmDown=click

# ButtonPinTGUp=5
# ButtonActionTGUp=click
# ButtonPinTGDown=6
# ButtonActionTGDown=click

ButtonPinBankUp=5
ButtonActionBankUp=click
ButtonPinBankDown=6
ButtonActionBankDown=click

# MIDI Button Navigation
#  Specify MIDI CC to act as a button
#  NB: Off < 64 < ON
# CC channel: 0=OFF; 1-16 MIDI Ch; >16 Omni
MIDIButtonCh=17
MIDIButtonNotes=0
MIDIButtonPrev=00
MIDIButtonNext=0
MIDIButtonBack=0
MIDIButtonSelect=0
MIDIButtonHome=00
MIDIButtonPgmUp=80
MIDIButtonPgmDown=81
MIDIButtonTGUp=0
MIDIButtonTGDown=0

# Timeouts in milliseconds for double click and long press
DoubleClickTimeout=400
LongPressTimeout=400

# KY-040 Rotary Encoder
EncoderEnabled=1
EncoderPinClock=10
EncoderPinData=9

# Debug
MIDIDumpEnabled=0
ProfileEnabled=0

# Performance
PerformanceSelectToLoad=1
PerformanceSelectChannel=1

# MasterVolume: 0..100
MasterVolume=80

# Enable new User-Interface
UIMainEnabled=1
# Start-Screen ( 0=Menu ; 1=Bank+Voice ; 2=Performance )
# (this setting is only effective if UIMainEnabled=1)
DefaultScreen=2
diyelectromusic commented 4 weeks ago

Thanks for giving that a go. Can you post your minidexed.ini so I can see how your configuration is matching up with those messages?

Thanks :)

Kevin

plamikcho commented 4 weeks ago

Attached my configuration. Hope it will help to find the issue, this feature is in my wish list.

diyelectromusic commented 4 weeks ago

Thanks. Looks like it's getting confused between a MIDI button and GPIO button... I've probably got a range/limit wrong somewhere :)

Watch this space!

Kevin

diyelectromusic commented 4 weeks ago

Yes - I missed out a translation. When this finishes building and posts a new release, please give this one a go?

btw - I see you have used GPIO 5/6 twice in your configuration - I'm not sure what will happen there tbh. I think it complains if there is a duplicate?

But there error checking for GPIO pins is pretty non-existent I'm afraid at the moment (more here: https://github.com/probonopd/MiniDexed/issues/336)

Thanks, Kevin

github-actions[bot] commented 4 weeks ago

Build for testing: MiniDexed_2024-10-25-e984ed3 Use at your own risk.

plamikcho commented 4 weeks ago

No, it is not a duplicate, I've used the buttons for TG-+ for the bank select and the TGs are commented. EDIT: It is working fine now, thank you very much! This feature makes the navigation between the patches really fast while keeping them organised in banks.

diyelectromusic commented 4 weeks ago

Great!

Are you using MIDI too? Would be nice to know the MIDI buttons and the GPIO both work as expected :)

Thanks, Kevin

plamikcho commented 4 weeks ago

Unfortunately I am not using MIDI buttons, my keyboard (KS37) does not have any buttons that can be assigned to MIDI.

diyelectromusic commented 4 weeks ago

Ok, MIDI buttons for Pgm Up/Down, Bank Up/Down, and TG Up/Down seem to work for m.

Kevin

soyersoyer commented 1 week ago

Unfortunately I am not using MIDI buttons, my keyboard (KS37) does not have any buttons that can be assigned to MIDI.

You can assign MIDI CC-s to the KS37's rec/stop/play buttons with SysEX Controls. It works if you disable the internal clock on the back of the KS37.

plamikcho commented 1 week ago

Thanks @soyersoyer, I'll try it.

diyelectromusic commented 1 week ago

Please can this be merged in now?

Kevin

github-actions[bot] commented 1 week ago

Build for testing: MiniDexed_2024-11-16-8568b85 Use at your own risk.

probonopd commented 1 week ago

Merged. Please update the wiki accordingly @diyelectromusic. Thanks!