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

Support multiple Dexed instances #50

Merged
merged 9 commits into from
Mar 19, 2022
Merged

Support multiple Dexed instances #50

merged 9 commits into from
Mar 19, 2022

Conversation

rsta2
Copy link
Contributor

@rsta2 rsta2 commented Mar 19, 2022

This PR adds support for multiple Dexed instances (Tone Generators, TG). It's not possible to load the performance configuration from a file at the moment. I will add this soon.

Currently voice bank, voice number, volume and assigned MIDI channel (1-16, OMNI mode or OFF) can be selected from the UI for each TG. The TGs can be switched by double clicking the switch. When you hold the switch for one second, you will go back to the home position (TG1, VOICE) in the menu. By default TG1 is in OMNI mode, all other TGs are not assigned to a MIDI channel. The PC keyboard fakes MIDI events on channel 1.

The mixer is not perfect yet. That's why the volume is reduced, when only a few TGs are active. I had to reduce the MaxNotes value for Raspberry Pi 1 (8 now) and increased the chunk size default for RPi 1 to 1024. Otherwise there are audio drops. The chunk size is limited to a value of 4096 now.

I tested this on RPi 3B (with 32 and 64-bit and UI) and RPi 1 (without UI) only. It is noticeable, that the CPU load could rise to a critical level with eight active TGs. CPU core 1 handles two TGs, core 2 and 3 handle three TGs each. Core 0 is free to handle all other stuff (MIDI, sound driver, UI). fast=true in cmdline.txt may be required, at least on the RPi 2.

Let me know, when you need modifications.

* Currently 2 similar instances, which work with the same parameters
* Only 1 instance with max. 8 notes polyphony on RPi 1
* Chunk size needs to be increased on RPi 1
* Core 1 kicks core 2 and 3 and processes two TGs then
* Cores 2 and 3 wait for a kick and process three TGs each then
* When all cores are ready, the output will be summed up
* All 8 TGs generate the same sound at the moment
* The maximum chunk size is limited to 4096 now
* Active TG number is shown on LCD display
* Next TG is selected by double click
* MIDI receive and PC keyboard are still in omni mode
* on MIDI cable 0, channel 0
* instead of calling key[down|up]()
* derive from class CMIDIDevice
* ui: New menu item "MIDI" for configures assigned MIDI channel
* ui: Holding switch for at least one second returns to menu home
* ui: Do not show TG instance, if there is only one
* By default TG1 is in omni mode, all other TGs are not assigned
* config: Default chunk size is 1024 without multi-core
@probonopd
Copy link
Owner

Wow, this is HUGE. 🥇 Testing now.

@probonopd
Copy link
Owner

probonopd commented Mar 19, 2022

Wonderful. Now imagine there'd be GUI controls (similar to volume) for Stereo balance (would this have to be implemented in Synth_Dexed?)) and for detune (an existing Dexed parameter). Instant TX802 feeling 👍

@probonopd probonopd merged commit d6025f1 into probonopd:main Mar 19, 2022
@probonopd
Copy link
Owner

fwif, so far I did not notice the need for fast=true on RPi 2.

@rsta2
Copy link
Contributor Author

rsta2 commented Mar 19, 2022

@probonopd Thank you very much! :)

I think Stereo balance cannot be implemented in Synth_Dexed that easy, at least not in the Dexed class, because the delivered sound data is Mono at the moment. One can multiply the samples with different factors to create a Stereo shift. But the clipping problem can occur then again. I don't know, if @dcoredump wants to change this, to provide Stereo sound data. For the Reverb FX it is also necessary to have Stereo.

I'm not sure at the moment because of the Detune parameter, which exists in each of the six OPs in DX7/Dexed. So if you have a Detune setting of (say) +4 in the Performance, how does this influence the six Detune values for the OPs? We have to find this out, before we can add this to the UI menu.

Ah OK, I did not test it on the RPi 2. But I have seen load values of over 60% on the RPi 3B with all TGs active, so I thought it could be tight on the RPi 2. But it's good, when it is working there too.

BTW. I have to go somewhere today and will be back tomorrow.

@rsta2 rsta2 deleted the multi-instance branch March 19, 2022 15:25
@probonopd
Copy link
Owner

probonopd commented Mar 19, 2022

I'm not sure at the moment because of the Detune parameter, which exists in each of the six OPs in DX7/Dexed.

I am looking for the detune that detunes a whole Dexed instance overall (TG). This exists in the Dexed GUI.

image

@rsta2
Copy link
Contributor Author

rsta2 commented Mar 20, 2022

I am looking for the detune that detunes a whole Dexed instance overall (TG). This exists in the Dexed GUI.

Great hint! After searching for this in the Dexed code, I found that it has a masterTune parameter and Synth_Dexed already has it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants