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

Added code for enabling compressor (compressor code is in Synth_Dexed) / Fixes for README.md / Added stereo plate reverb #59

Merged
merged 7 commits into from
Apr 3, 2022

Conversation

dcoredump
Copy link
Contributor

@dcoredump dcoredump commented Mar 30, 2022

I now added compressor code to Synth_Dexed so it is available inside MiniDexed. The compressor is enabled in src/dexedadapter.h.

The initial setup of the compressor is:

  • Threshold: -20.0 dB
  • Ratio: 5.0
  • Attack: 5ms
  • Release: 200ms
  • HP-Filter: enabled

List of new methods in Synth_Dexed:

void setCompressor(bool comp);
bool getCompressor(void);
void setCompressorPreGain_dB(float32_t pre_gain);
void setCompressorAttack_sec(float32_t attack_sec);
void setCompressorRelease_sec(float32_t release_sec);
void setCompressorThresh_dBFS(float32_t thresh_dBFS);
void setCompressionRatio(float32_t comp_ratio);
float32_t getCompressorPreGain_dB(void);
float32_t getCompressorAttack_sec(void);
float32_t getCompressorRelease_sec(void);
float32_t getCompressorThresh_dBFS(void);
float32_t getCompressionRatio(void);

I also fixed some build instructions inside the README.md.

Also now added first implementation of the stereo plate reverb (currently with fixed parameters).

@rsta2
Copy link
Contributor

rsta2 commented Mar 31, 2022

Isn't it possible to hand over the ReverbBuffer[] directly to m_pSoundDevice->Write() in minidexed.cpp line 607, without copying it to SampleBuffer[] before? This would save some processing time. I think both buffers have the same contents after copying.

@probonopd
Copy link
Owner

Thank you very much @dcoredump. I tested this on a RPi 2 with the headphone jack and with HDMI. With HDMI I get all sorts of strage (and interesting sounding! but definitely unintentional) sounds, which I don't get with PWM (headphone jack). Did you have a chance to test this with HDMI yet?

@dcoredump
Copy link
Contributor Author

Isn't it possible to hand over the ReverbBuffer[] directly to m_pSoundDevice->Write() in minidexed.cpp line 607, without copying it to SampleBuffer[] before? This would save some processing time. I think both buffers have the same contents after copying.

The reverb handling code came in by mistake...

I still have to adjust some things, but I'm on a good way. I will add the reverb internally to the signal, then the reverb array is omitted.

@dcoredump
Copy link
Contributor Author

Thank you very much @dcoredump. I tested this on a RPi 2 with the headphone jack and with HDMI. With HDMI I get all sorts of strage (and interesting sounding! but definitely unintentional) sounds, which I don't get with PWM (headphone jack). Did you have a chance to test this with HDMI yet?

I'm sorry, but I haven't been able to test it with HDMI yet. I'll get myself a HDMI->audio converter.

I would be very surprised that it works with PWM but not with HDMI. I actually didn't do anything else but put the compressor at the end of getSamples().

Can you try setting Dexed::setCompressor(true) to false in minidexed.cpp:36 and try again?

@dcoredump dcoredump changed the title Added code for enabling compressor (compressor code is in Synth_Dexed) / Fixes for README.md Added code for enabling compressor (compressor code is in Synth_Dexed) / Fixes for README.md / Added stereo plate reverb Apr 1, 2022
@probonopd
Copy link
Owner

@rsta2 does this build work for you with HDMI?

@rsta2
Copy link
Contributor

rsta2 commented Apr 2, 2022

@probonopd Yes, the kernel7.img works with PWM and HDMI. Please note that the size of these kernel images is hard at the limit or over the limit of the default maximum kernel size of 2 MBytes. For bigger kernel images you have to specify the option -o KERNEL_MAX_SIZE=0x400000 (e.g. for 4 MBytes) to configure in build.sh. That's why the other kernels do not work, because they are bigger.

@probonopd
Copy link
Owner

That seems to have done the trick!

Wow, what a cool sound. Thanks @dcoredump.

I still have to adjust some things, but I'm on a good way. I will add the reverb internally to the signal, then the reverb array is omitted.

Please let me know when this is ready for being merged. Thanks!

@dcoredump
Copy link
Contributor Author

We need a mixer object, so we can do a mix of all instances (what is currently working) and a mix of the reverb sends of the instances, so every instance can be adjusted of how many reverb should be send.

I think it max also be better to use a float32_t as type for the signal chain instead of int16_t. Why? Most effects use internaly floats because they are easier to handle. For "small" microcontrollers, which do not have a FPU, integeger arithmetic must be used, but for a Raspi this is not needed. With floats we can drop every integer->float converting (and back) for every effect we want to use...

I will try to create a mixer class and switch to floats in the signal chain. Only at the end of the signal chain arm_float_q15() has to be called to use the Neon-DSP functions to convert as fast as possible to integer.

@dcoredump
Copy link
Contributor Author

Forgot to say: you can merge this and perhaps add the reverb setup to the UI. Or you can wait until I am rwady with my tasks from above.

@probonopd
Copy link
Owner

probonopd commented Apr 3, 2022

Thanks @dcoredump. @rsta2 wdyt, should I merge this now so that it could be integrated into the menus? Or merge #61 first?

@rsta2
Copy link
Contributor

rsta2 commented Apr 3, 2022

@probonopd You can merge PR #59 now. Sounds really cool.

@probonopd probonopd merged commit 3b51ed8 into probonopd:main Apr 3, 2022
@probonopd
Copy link
Owner

Merged!

@probonopd
Copy link
Owner

@dcoredump: What does the Send parameter do? I'd like to add it to the documentation.

@dcoredump
Copy link
Contributor Author

I think I have chosen the wrong name and will fix it soon. It should be named level.

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.

3 participants