iiwusynth-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iiwusynth-devel] Patch for reverb control through commands


From: M. Nentwig
Subject: [iiwusynth-devel] Patch for reverb control through commands
Date: Sun, 24 Feb 2002 16:35:30 +0200

Hello,

as discussed earlier, I implemented a bunch of commands for controlling
the reverb unit. The patch is attached. It was generated with diff -r
(orig. dir) (work dir). If there is a better way, please let me know.
It also includes the two lines I used to make pan control work.

I had so much fun playing around with 'instable' room sizes (size > 1).
If you're doing horror movies, this is -your- effect. But keep the
fingers close to Ctrl-C :-)

With the current implementation (stereo dry signal gets mixed with
stereo reverb signal, but reverb has only mono input), the 'dry' setting
in the reverb is pretty useless. When hooking up a reverb box to a real
mixer in this fashion, one would usually set the effect to '100 % wet'.
My suggestion is to remove the 'dry' feature completely (no dry path in
reverb).
Speaking of it, the CPU load caused by the reverb seems to be rather
small.

Short summary about commands:
rev_preset x: Chooses preset x from the built-in settings. 0<x<=4.
rev_setroomsize num: Sets the roomsize parameter (careful with >1,
limited to 1.2).
rev_setdamp: Sets damping
rev_setwidth: Sets width. Limited to 100, anything higher sounds too
strange.
rev_setwet: Wet gain of the reverb unit. (linear, 10 => 20 dB).
rev_setdry: Dry gain.
rev_setbypass: Disables the reverb unit entirely by turning it off in
the synth. It doesn't consume any CPU cycles in the off state. Maybe
'bypass' is the wrong word here, 'disable' would be better.

Regards

Markus

PS: The patch sets 0.3 reverb send level as default for all voices (last
line in patch). As soon as controller 91 / reverb send is working, this
is obsolete.



diff -r iiwu_orig/iiwusynth/src/iiwu_cmd.c
iiwu_work/iiwusynth/src/iiwu_cmd.c
23a24
> #include "iiwu_synth.h"
49a51,64
>   { "rev_preset", iiwu_handle_reverbpreset,
>                                       "rev_preset num          Load
preset num into the reverb unit" },
>   { "rev_setroomsize", iiwu_handle_reverbsetroomsize,
>                                       "rev_setroomsize num     change
reverb room size" },
>   { "rev_setdamp", iiwu_handle_reverbsetdamp,
>                                       "rev_setdamp num         change
reverb damping" },
>   { "rev_setwidth", iiwu_handle_reverbsetwidth,
>                                       "rev_setwidth num        change
reverb width" },
>   { "rev_setwet", iiwu_handle_reverbsetwet,
>                                       "rev_setwet num          change
reverb wet level" },
>   { "rev_setdry", iiwu_handle_reverbsetdry,
>                                       "rev_setdry num          change
reverb dry level" },
>   { "rev_setbypass", iiwu_handle_reverbsetbypass,
>                                       "rev_setbypass num       num=1:
disable reverb unit entirely" },
383a399,548
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_preset' command.
>  * Load the values from a reverb preset into the reverb unit. */
> int
> iiwu_handle_reverbpreset(iiwu_synth_t* synth, int ac, char** av, char*
reply, int len)
> {
>   int Reverb_Preset_Number;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_preset: too few arguments");
>     return -1;
>   }
>   Reverb_Preset_Number=atoi(av[0]);
>   if (iiwu_synth_set_reverb(synth, Reverb_Preset_Number)!=IIWU_OK){
>     snprintf(reply, len, "rev_preset: Failed. Parameter out of
range?");
>     return -1;
>   };
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setroomsize' command.
>  * Load the new room size into the reverb unit. */
> int
> iiwu_handle_reverbsetroomsize(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len)
> {
>   iiwu_real_t RoomSize;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setroomsize: too few arguments.");
>     return -1;
>   }
>   RoomSize=atof(av[0]);
>   if (RoomSize < 0){
>     snprintf(reply, len, "rev_setroomsize: Room size must be
positive!");
>     return -1;
>   }
>   if (RoomSize > 1.2){
>     snprintf(reply, len, "rev_setroomsize: Room size too big!");
>     return -1;
>   }
>   iiwu_revmodel_setroomsize(synth->reverb, RoomSize);
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setdamp' command.
>  * Load the new damp factor into the reverb unit. */
> int
> iiwu_handle_reverbsetdamp(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len)
> {
>   iiwu_real_t Damp;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setdamp: too few arguments.");
>     return -1;
>   }
>   Damp=atof(av[0]);
>   if (Damp < 0. || Damp > 1){
>     snprintf(reply, len, "rev_setdamp: damp must be between 0 and
1!");
>     return -1;
>   }
>   iiwu_revmodel_setdamp(synth->reverb, Damp);
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setwidth' command.
>  * Load the new width into the reverb unit. */
> int
> iiwu_handle_reverbsetwidth(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len)
> {
>   iiwu_real_t Width;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setwidth: too few arguments.");
>     return -1;
>   }
>   Width=atof(av[0]);
>   if (Width < 0 || Width > 100){
>     snprintf(reply, len, "rev_setroomsize: Too wide! (0..100)");
>     return 0;
>   }
>   iiwu_revmodel_setwidth(synth->reverb, Width);
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setwet' command.
>  * Load the new wet level into the reverb unit. */
> int
> iiwu_handle_reverbsetwet(iiwu_synth_t* synth, int ac, char** av, char*
reply, int len)
> {
>   iiwu_real_t Wet;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setwet: too few arguments.");
>     return -1;
>   }
>   Wet=atof(av[0]);
>   if (abs(Wet) > 30){
>     snprintf(reply, len, "rev_setwet: Value too high! (Value of 10 =>
+20 dB)");
>     return 0;
>   }
>   iiwu_revmodel_setwidth(synth->reverb, Wet);
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setdry' command.
>  * Load the new dry level into the reverb unit. */
> int
> iiwu_handle_reverbsetdry(iiwu_synth_t* synth, int ac, char** av, char*
reply, int len)
> {
>   iiwu_real_t Dry;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setdry: too few arguments.");
>     return -1;
>   }
>   Dry=atof(av[0]);
>   if (abs(Dry) > 30){
>     snprintf(reply, len, "rev_setdry: Value too high! (Value of 10 =>
+20 dB)");
>     return 0;
>   }
>   iiwu_revmodel_setdry(synth->reverb, Dry);
>   return 0;
> }
>
> /* Purpose:
>  * Response to 'rev_setbypass' command.
>  * Change the IIWU_REVERB flag in the synth */
> int
> iiwu_handle_reverbsetbypass(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len)
> {
>   int BypassOn;
>   if (ac < 1) {
>     snprintf(reply, len, "rev_setbypass: too few arguments.");
>     return -1;
>   }
>   BypassOn=atoi(av[0]);
>
>   if (BypassOn!=1 && BypassOn!=0){
>     snprintf(reply, len, "rev_setbypass: Needs '0' or '1'.");
>     return -1;
>   };
>
>   /* Bypass switch on => Synth doesn't use reverb. */
>   if (BypassOn){
>     synth->settings.flags &= (!IIWU_REVERB); /* Clear the bit */
>   } else {
>     synth->settings.flags |= IIWU_REVERB;    /* Set the bit */
>   };
diff -r iiwu_orig/iiwusynth/src/iiwu_cmd.h
iiwu_work/iiwusynth/src/iiwu_cmd.h
61a62,69
> /** still command line, reverb specific **/
> int iiwu_handle_reverbpreset(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
> int iiwu_handle_reverbsetroomsize(iiwu_synth_t* synth, int ac, char**
av, char* reply, int len);
> int iiwu_handle_reverbsetdamp(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
> int iiwu_handle_reverbsetwidth(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
> int iiwu_handle_reverbsetwet(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
> int iiwu_handle_reverbsetdry(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
> int iiwu_handle_reverbsetbypass(iiwu_synth_t* synth, int ac, char**
av, char* reply, int len);
diff -r iiwu_orig/iiwusynth/src/iiwu_synth.c
iiwu_work/iiwusynth/src/iiwu_synth.c
60d59
<
889c888,890
<   if (USE_REVERB(synth) && (reverb_send > 0.0f)) {
---
>   /* if (USE_REVERB(synth) && (reverb_send > 0.0f)) { */
>   /* Previous line cuts off reverb tails. */
>   if (USE_REVERB(synth)) {
892c893
<
---
>
diff -r iiwu_orig/iiwusynth/src/iiwu_voice.c
iiwu_work/iiwusynth/src/iiwu_voice.c
698a699,700
>   /* Same for Pan. '10' is the MIDI pan ctrl number. <MN> */
>   iiwu_voice_modulate(voice, 1, 10);
747,748c749,750
<   /* pan */
<   voice->pan = voice->gen[GEN_PAN].val;
---
>   /* pan handled by modulate_voice earlier <MN>*/
>   // voice->pan = voice->gen[GEN_PAN].val;
752c754
<
---
>   voice->reverb_send = 0.3; /* Temporary hack to force reverb <MN> */






reply via email to

[Prev in Thread] Current Thread [Next in Thread]