-
Notifications
You must be signed in to change notification settings - Fork 81
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
Multi-core support #47
Conversation
* System options can be defined cleaner using the "-o" option * Include KY-040 driver from Circle (removed from MiniDexed)
* Enable multi-core support on Raspberry Pi 2-4 * Does still work on the Raspberry Pi 1 with restrictions * Use CSoundBaseDevice::Write() instead overriding GetChunk() * CMiniDexed is not derived from the sound device classes any more * Add option SCREEN_DMA_BURST_LENGTH=1 to relieve bus congestion
Thanks @rsta2. Here are my test results: Raspberry Pi Zero with HDMI: Works if MIDI keyboard is directly attached to Pi. Does not work if MIDI keyboard is attached to Official Raspberry Pi Keyboard and Hub which is attached to Pi, getting Raspberry Pi 2 with HDMI: Works if MIDI keyboard is directly attached to Pi. Does not work if MIDI keyboard is attached to Official Raspberry Pi Keyboard and Hub which is attached to Pi, getting Did not find a way to use the ASCII keyboard anymore. Did not test Raspberry Pi 3 and 4 yet. Volume knob on MIDI keyboard works. Volume on LCD GUI works (tested on Raspberry Pi 2 because that is where I have connected the hardware atm). LCD GUI also works correctly when the volume is changed via MIDI. Very nicely implemented! Pitch Bend and modulation don't seem to do anything that I could hear. |
@probonopd Thanks for testing. There seems to be a problem with the Official Raspberry Pi Keyboard and Hub with Circle. This is probably independent from this PR. It should have happened with the previous MiniDexed version too? Can you try the option The debug output is disabled by default, when the respective options are not found in minidexed.ini. But they are present and enabled in the default .ini file. I think, we should remove them there for production. I tried to implement Pitch Bend and modulation, but because it did not work here, I did not included this in the PR. So it will not work at the moment. What happened to the lost MIDI events? Does this still happen? Nice, that you like the LCD volume display. :) |
I still had
|
I think, we had this problem with your USB keyboard and hub before on the RPi 4. It was gone after the boot ROM update. Strange. |
Yes, please remove the Maybe the RPi 1 (and Zero) is too slow, to handle USB MIDI without event loss in time. The USB HCI controller emits 8000 interrupts per second. That's huge. |
Note that I can reproduce "stuck notes" on the Raspberry Pi 2 using the MIDI keyboard as well. To reproduce: Use "ORGAN 1" voice and play rapid glissando; after a while you will hear a "stuck" note. We could probably code a tester using a Raspberry Pi Pico that would select the "ORGAN 1" voice and would play fast notes in glissando style for testing... |
Is this with |
Without. |
OK. That's bad. You should try this on the RPi 3, when you have some time. mt32-pi did work for you, and it does not run on the RPi 2. I did not hear stuck notes at all with all MiniDexed versions so far with my AKAIpro LPK25 keyboard. It seems to behave differently then yours. I cannot reproduce this. |
To be fair, I didn't stress-test it to the same extent ;-) As the next step, let me see if I can reproduce this using a Raspberry Pi Pico acting as a MIDI keyboard playing notes in really fast succession... |
Tried "E.ORGAN 1" (voice 17) from the default bank again, sliding for one minute up and down on the keyboard, using a RPi 2B. No stuck note. Perhaps this is more a test for midi_adapter on the Pico, because it handles the USB in this scenario. |
Strange... If I play the same note several times, then the MIDI OFF signal should make that note go silent no matter how often a MIDI ON signal for that note was previously received, correct? So by playing each note slowly I should get all notes back to OFF state. But this is not what happens. Some notes keep playing. In other words, I keep playing all white keys on the keyboard rapidly and intensively until one note gets stuck, playing forever. With "E.ORGAN 1" (voice 17) I can get stuck, but I didn't get this with "E.PIANO" yet. (Makes sense: organ-style voices play forever if you keep the key pressed forever while piano-style voices don't.) So maybe it's not the keyboard that gets stuck after all, but something else? |
This synth engine behaves differently. This is something, that I noticed too. If you send two "note on" for a specific note, you also have to send two "note off" for that note. Otherwise it will not stop generating sound. I can easily reproduce this here, because I can send single MIDI bytes here via the serial line. |
With MiniDexed_2022-03-14.zip and |
Yes, the question remains, why some "note off" events get lost, and if this happens on the RPi 3, and with mt32-pi? I suppose with |
That's true.
I'll try that next. |
Without Using mt32-pi-0.11.0 on the same hardware and using an Organ-style voice (= a voice that plays forever if you keep the key pressed forever) I cannot reproduce the stuck notes issue. I notice it has (only) So the question is, why do I get stuck notes in MiniDexed without |
Can you try mt32-pi without |
With quite some forceful effort and persistence I can get stuck notes on mt32-pi without |
I'm quickly preparing a full CPU speed patch for MiniDexed with PR #47. Yes, this is a difference in the synth engine. |
Here it is: You still have to add the option |
Does the full-speed patch have any downsides (as long as |
Normally the CPU runs at a reduced speed in bare metal applications. With this update and the setting "fast=true" in the file cmdline.txt, it runs at the full speed.
… into multi-core-support
Done. |
BTW. With the option |
Can still produce stuck keys with (only) Should we merge this PR anyway? |
I would merge it, because we need the multi-core support anyway, and it's not a step back. The problem was there before. mt32-pi is very sophisticated after a long development. I think we cannot expect to reach the same after a month. There is room for improvement, that's for sure. |
Thanks @rsta2 |
You are welcome. |
This PR modifies the following:
There is a new menu item in the UI, which controls the volume level.
The MIDI message dump and profiling should be disabled on the Raspberry Pi 1, otherwise one hears audio drops, when the screen scrolls.
Tested on RPi 1A+ (PWM, HDMI), 2B (PWM, I2S, HDMI) and 4B (PWM, I2S, HDMI). The UI has been tested with a RPi 1A+ only (because my hardware is connected there).