Re: Linux Vocoder (?)

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

 



DCZX wrote:
Does anyone know of a good vocoder app or plugin?

Pieter Palmers wrote:
http://www.sirlab.de/linux/download_vocoder.html

This is a nice program, but there is some problems with it, the stand alone application does not have support for JACK. It is desirable since JACK makes it a lot easier to plug a soft synths as formant. The LADSPA plugin could do this with inserted to a program (e.g AMS) but I wanted a more flexible approach so I thought it was a good idea using it with JACK-RACK. This is not possible because JACK-RACK assumes that every plugin has equally many input as output ports.

I changed the LADSPA-plugin so it registers two outputports and therfore works with JACK-RACK. Further more have I added some LADSPA_HINTS that suggests appropriate default values, however JACK-RACK seems not to be able to handle the controls in a proper way, but as far as I understand is my changes valid according to LADSPA specifications and the problem is in jack-rack.

I guess it could be done with ecasound too, but i never got the parameters right.

Here is the a patch for this, I admit it is not a very nice way of solving the problem but it works.

Johan


--- ../orig/vocoder-0.3/vocoder.c	2004-04-27 20:28:59.000000000 +0200
+++ ./vocoder.c	2006-07-13 12:41:00.000000000 +0200
@@ -3,6 +3,10 @@
 
    LADSPA Unique ID: 1441
 
+   Version 0.4
+   Added stereo output                              2006-07-12 (Johan Mattsson)
+   Added LADSPA_HINT_DEFAULT to port range hints.   2006-07-12 (Johan Mattsson)
+
    Version 0.3
    Added support for changing bands in real time 2003-12-09
 
@@ -62,11 +66,12 @@
 
 #define PORT_FORMANT   0
 #define PORT_CARRIER   1
-#define PORT_OUTPUT    2
-#define CTRL_BANDCOUNT 3
-#define CTRL_BAND1LVL  4
+#define PORT_OUTPUT_L  2
+#define PORT_OUTPUT_R  3
+#define CTRL_BANDCOUNT 4
+#define CTRL_BAND1LVL  5
 
-#define PORT_COUNT     4 + MAX_BANDS
+#define PORT_COUNT     5 + MAX_BANDS
 
 
 /* useful macros */
@@ -88,7 +93,8 @@
 
   LADSPA_Data * portFormant;	/* Formant signal port data location */
   LADSPA_Data * portCarrier;	/* Carrier signal port data location */
-  LADSPA_Data * portOutput;	/* Output audio port data location */
+  LADSPA_Data * portOutput_L;	/* Output audio port data location */
+  LADSPA_Data * portOutput_R;	/* Output audio port data location */
   LADSPA_Data * ctrlBandCount;	/* Band count control */
   LADSPA_Data * ctrlBandLevels[MAX_BANDS]; /* level controls for each band */
 
@@ -145,8 +151,11 @@
   case PORT_CARRIER:		/* carrier port? */
     vocoder->portCarrier = DataLocation;
     break;
-  case PORT_OUTPUT:		/* output port? */
-    vocoder->portOutput = DataLocation;
+  case PORT_OUTPUT_L:		/* output port? */
+    vocoder->portOutput_L = DataLocation;
+    break;
+  case PORT_OUTPUT_R:		/* output port? */
+    vocoder->portOutput_R = DataLocation;
     break;
   case CTRL_BANDCOUNT:		/* band count control? */
     vocoder->ctrlBandCount = DataLocation;
@@ -239,7 +248,7 @@
       vocoder_do_bandpasses (vocoder->bands_formant,
 			     vocoder->portFormant[i], vocoder);
 
-      vocoder->portOutput[i] = 0.0;
+      vocoder->portOutput_L[i] = 0.0;
       for (j=0; j < numbands; j++)
 	{
 	  vocoder->bands_out[j].oldval = vocoder->bands_out[j].oldval
@@ -247,9 +256,12 @@
 	       - vocoder->bands_out[j].oldval)
 	    * vocoder->bands_out[j].decay;
 	  x = vocoder->bands_carrier[j].y * vocoder->bands_out[j].oldval;
-	  vocoder->portOutput[i] += x * vocoder->bands_out[j].level;
+	  vocoder->portOutput_L[i] += x * vocoder->bands_out[j].level;
 	}
-      vocoder->portOutput[i] *= vocoder->mainvol;
+      vocoder->portOutput_L[i] *= vocoder->mainvol;
+
+      /* we need to copy audio to right port data location */
+      vocoder->portOutput_R[i] = vocoder->portOutput_L[i];
     }
 }
 
@@ -298,7 +310,9 @@
       = LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
     piPortDescriptors[PORT_CARRIER]
       = LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
-    piPortDescriptors[PORT_OUTPUT]
+    piPortDescriptors[PORT_OUTPUT_L]
+      = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
+    piPortDescriptors[PORT_OUTPUT_R]
       = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
     piPortDescriptors[CTRL_BANDCOUNT]
       = LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
@@ -307,19 +321,33 @@
     g_psDescriptor->PortNames = (const char **)pcPortNames;
     pcPortNames[PORT_FORMANT] = strdup("Formant");
     pcPortNames[PORT_CARRIER] = strdup("Carrier");
-    pcPortNames[PORT_OUTPUT] = strdup("Output");
+    pcPortNames[PORT_OUTPUT_L] = strdup("Output Left");
+    pcPortNames[PORT_OUTPUT_L] = strdup("Output Rigth");
     pcPortNames[CTRL_BANDCOUNT] = strdup("Number of bands");
 
     psPortRangeHints = ((LADSPA_PortRangeHint *)
 			calloc(PORT_COUNT, sizeof(LADSPA_PortRangeHint)));
     g_psDescriptor->PortRangeHints
       = (const LADSPA_PortRangeHint *)psPortRangeHints;
-    psPortRangeHints[PORT_FORMANT].HintDescriptor = 0;
-    psPortRangeHints[PORT_CARRIER].HintDescriptor = 0;
-    psPortRangeHints[PORT_OUTPUT].HintDescriptor = 0;
+    psPortRangeHints[PORT_FORMANT].HintDescriptor = LADSPA_HINT_BOUNDED_BELOW 
+      | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_HIGH;
+    psPortRangeHints[PORT_FORMANT].LowerBound = 0;
+    psPortRangeHints[PORT_FORMANT].UpperBound = 1;
+    psPortRangeHints[PORT_CARRIER].HintDescriptor = LADSPA_HINT_BOUNDED_BELOW 
+      | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_HIGH;
+    psPortRangeHints[PORT_CARRIER].LowerBound = 0;
+    psPortRangeHints[PORT_CARRIER].UpperBound = 1;
+    psPortRangeHints[PORT_OUTPUT_L].HintDescriptor = LADSPA_HINT_BOUNDED_BELOW 
+      | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_HIGH;
+    psPortRangeHints[PORT_OUTPUT_L].LowerBound = 0;
+    psPortRangeHints[PORT_OUTPUT_L].UpperBound = 1;
+    psPortRangeHints[PORT_OUTPUT_R].HintDescriptor = LADSPA_HINT_BOUNDED_BELOW 
+      | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_HIGH;
+    psPortRangeHints[PORT_OUTPUT_R].LowerBound = 0;
+    psPortRangeHints[PORT_OUTPUT_R].UpperBound = 1;
     psPortRangeHints[CTRL_BANDCOUNT].HintDescriptor
       = LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE
-      | LADSPA_HINT_INTEGER;
+      | LADSPA_HINT_INTEGER | LADSPA_HINT_DEFAULT_1;
     psPortRangeHints[CTRL_BANDCOUNT].LowerBound = 1;
     psPortRangeHints[CTRL_BANDCOUNT].UpperBound = MAX_BANDS;
 
@@ -329,7 +357,8 @@
 	pcPortNames[i] = malloc (sizeof ("Band 99 Level"));
 	sprintf(pcPortNames[i], "Band %d Level", i - CTRL_BAND1LVL + 1);
 	psPortRangeHints[i].HintDescriptor
-	  = LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE;
+	  = LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE
+         | LADSPA_HINT_DEFAULT_HIGH;
 	psPortRangeHints[i].LowerBound = 0;
 	psPortRangeHints[i].UpperBound = 1;
       }

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux