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

Changing performances with rotary encoder crashes in USB Gadget Mode #583

Open probonopd opened 12 months ago

probonopd commented 12 months ago

On a Raspberry Pi Zero 2 with a 0.96" OLED via i2c and no i2s DAC:

I can reproduce this. It is the 9th time I try to load a performance that I get the crash.

When the crash happens, dmesg on the host PC says

sound midiC0D0: rawmidi drain error (avail = 3353, buffer_size = 4096)

(Note: This does not happen when I don't use USB Gadget Mode but attach a MIDI controller instead. Then I can load performances more often than 8 times both with the rotary encoder and via MIDI without the crash.)

Additional information:

diyelectromusic commented 12 months ago

Some additional thoughts:

Given the answers to the above, I expect we'll need to produce some kind of debug version with extra printing to try to work out what is going on. You might have to send me your MIDI file too - although the chances of reproducing it might be a bit slim, I'll certainly have a go! If it turns out it is only one specific MIDI file anyway, then email that over and I'll have a look at it anyway.

Oh, and can we see your minidexed.ini file too?

The key in all this, as I'm sure you know, is changing one thing at a time and documenting all the results :)

As gadget mode is so new, it could even be an issue with the USB drivers in circle itself...

Kevin

diyelectromusic commented 12 months ago

Actually can you check your 'MIDIAutoVoiceDumpOnPC' setting? If this is enabled (I left this as the default on the assumption someone decided it should be enabled in the system when I was adding the option!) then every voice change triggers a sysex dump to all connected MIDI ports. Selecting a performance will trigger 8 individual voice sysex dumps potentially back over the USB Gadget link...

If that is enabled, try disabling it and see if that makes a difference.

Kevin

Banana71 commented 12 months ago

On a Raspberry Pi Zero 2 with a HD44780 LCD via i2c and with i2s DAC GY PCM5102:

Installed MiniDexed_2023-12-05-e5b2656 Enabled USB Gadget Mode Set sound output to i2s Attached Pi to host computer (PC Windows 11) MIDIAutoVoiceDumpOnPC=0

No crashes observed so far, all performances play perfectly. But after selecting a performance with the encoder or via MIDI, the display remains frozen for 3 seconds. The rotations on the encoder are recorded and after three seconds the correct performance is displayed according to the rotation. The sound output works during this time.

diyelectromusic commented 12 months ago

I've just sat here randomly selecting performances using an encoder on a Pi 3A+ in gadget mode and have seen no freezing or pausing so far. I've also confirmed that yes, I do get a whole pile of sysex dumps back over the USB link for every performance change!

I was just also randomly playing notes while doing it and all seems fine...

Kevin

Banana71 commented 12 months ago

MIDIAutoVoiceDumpOnPC has no influence on the behavior for me

probonopd commented 11 months ago

At the moment I'd say this is too obsure an issue to spend much time on right now. I can reproduce it, but it's not really a problem for me. So I'd say let's leave this issue open as a reminder in case others experience it, too, but let's not spend time on it at the moment.

diyelectromusic commented 10 months ago

Can you see if this is still an issue with the latest build?

If so, we need a means of reproducing it that can be duplicated by someone else and ideally answers to the questions I posed above.

Kevin