Discussion:
[SoX-users] Enabling LADSPA When Building a SOX Binary
Christopher Stevens
2017-07-03 04:07:04 UTC
Permalink
Hello SOX gurus,
I'm attempting to build an Amazon Linux binary of SOX with LADSPA plugin
support, starting with helpful instructions found here for the SOX part:
http://marcelog.github.io/articles/static_sox_transcoding_lambda_mp3.html

I was able to follow the instructions with minor tweaks and also found a
great introduction on installing LADSPA here:
http://archive.oreilly.com/pub/a/linux/2001/02/02/ladspa.html

So far I've made some progress... I think, with this:

====
sudo su
wget http://www.ladspa.org/download/ladspa_sdk.tgz
tar zxf ladspa_sdk.tgz
cd ladspa_sdk/src
#update all "-mkdirhier" to "mkdir -p" in makefile, then:
make
make install
export LADSPA_PATH=/usr/lib/ladspa
====

After that, I run the configure file when preparing to build SOX. I'm
getting this output in terminal:

====
...
BUILD OPTIONS
Debugging build............no
Distro name ...............not specified!
Dynamic loading support....no
Pkg-config location........$(libdir)/pkgconfig
Play and rec symlinks......yes
Symlinks enabled...........yes

OPTIONAL DEVICE DRIVERS
ao (Xiph)..................no
alsa (Linux)...............no
coreaudio (Mac OS X).......no
sndio (OpenBSD)............no
oss........................yes
pulseaudio.................no
sunaudio...................no
waveaudio (MS-Windows).....no

OPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
flac.......................no
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp2/mp3....................no
id3tag....................no
lame......................no
mad.......................no
twolame...................no
oggvorbis..................no
opus.......................no
sndfile....................no
wavpack....................no

OTHER OPTIONS
ladspa effects.............no
magic support..............no
png support................no
OpenMP support.............yes, -fopenmp
...
====

Note how ladspa effects is set to "no". I can confirm that there are a few
default ones in LADSPA_PATH; sine.so, noise.so, filter.so, etc.

Do you have an idea how I can include LADSPA support in my binary? I've
never used a related plugin with SOX. If I could get this to work on Amazon
Linux, I can create cool vocal effects for my automated-ish music project.

If you could help me succeed, I'll respond with a customized, automated
thank you song from my project. :D

Many thanks in advance!

Kind regards,

Chris
Eric Wong
2017-07-03 05:31:58 UTC
Permalink
Post by Christopher Stevens
Hello SOX gurus,
I'm attempting to build an Amazon Linux binary of SOX with LADSPA plugin
Hi Christopher,

Not sure what Amazon Linux packages, but it doesn't include a LADSPA
package?

<snip>
Post by Christopher Stevens
export LADSPA_PATH=/usr/lib/ladspa
You only need that at runtime, but I would make sure ladspa.h
is locatable to your build. It's usually /usr/include/ladspa.h,
or maybe /usr/local/include/ladspa.h.
Post by Christopher Stevens
After that, I run the configure file when preparing to build SOX. I'm
You probably need ltdl, too; since LADSPA depends on dynamic
loading.

config.log can usually provide clues about what failed during
./configure

Thanks for any updates and results you can provide!
Christopher Stevens
2017-07-03 11:31:21 UTC
Permalink
Hello Eric,
Thank you for the lightning fast response!

Regarding Amazon Linux, it's evolved from Red Hat Enterprise Linux (RHEL)
and CentOS. While not my personal preference yet, it's required for my AWS
Lambda project. Using yum, The following packages were *not *found:

yum install ladspa ladspa-devel

Thank you for the clarification on LADSPA Path. I'll be sure to set that
when running, not worrying about it when building at this stage.

You mentioned a need to install ltdl. I was able to install the following,
also installing the libtool-ltdl dependency:

sudo yum install libtool-ltdl-devel

While unable to enable LADSPA yet when building SOX, I was able to locate
config.log, posting the full log contents here for further troubleshooting:

https://pastebin.com/XykNdexE

Thanks again for the excellent support while troubleshooting this. :)

Kind regards,

Chris
Eric Wong
2017-07-03 17:16:46 UTC
Permalink
Post by Christopher Stevens
Hello Eric,
Thank you for the lightning fast response!
No problem, caught me at a lucky time :)

<snip> OK
Post by Christopher Stevens
While unable to enable LADSPA yet when building SOX, I was able to locate
https://pastebin.com/XykNdexE
It's probably --disable-shared breaking things, LADSPA relies on
dynamic loading, and ltdl use won't be enabled w/o shared library
support(*).

Generally, I suggest trying default configs as much as possible
when troubleshooting.


(*) Theoretically, it ought to be possible to build sox as only
a static library, but still have the static library
enable dynamic loading of LADSPA and such... Build systems
are a PITA and maybe it wasn't worth the effort.
Christopher Stevens
2017-07-03 19:42:46 UTC
Permalink
Aha! Good points indeed.

I just had a first step towards success, thanks to your input! When running
./configure *without* "--prefix=/usr/sox-14.4.2 --disable-shared
--enable-static" arguments, I'm seeing this:

====

ladspa effects.............yes
====

Yes! :D

This also works still:

--enable-static --prefix=/usr/sox-14.4.2

I'll now move on to installing, configuring and testing plugins, keeping
you posted on the next wall or completion of this task. There are still
some uncertainties on how this will work but I'm very close now.

Cheers!

Chris
Christopher Stevens
2017-07-04 00:44:29 UTC
Permalink
Progress, hitting a final wall perhaps:

It seems like everything is in order for enabling ladspa. Awesome! The last
challenge I'm having is using a choice ladspa plugin to bring pitch to my
currently narrative thank you song voices with the vocoder plugin found
here:

http://www.sirlab.de/linux/download_vocoder_ladspa.html

Installation was pretty straightforward:

wget http://www.sirlab.de/linux/download/vocoder-ladspa-0.4.tgz
tar zxf vocoder-ladspa-0.4.tgz
cd vocoder-0.4
#edit INSTALL_PLUGINS_DIR in Makefile to taste, then
make
make install

Eric,
It looks like the example I originally found from 2012 was written by you
(cool!):
https://sourceforge.net/p/sox/patches/92/

When I attempt to run this, I'm thinking some things have changed since
then as I see errors (or I'm likely doing something wrong to start):

sox -M formant.wav carrier.wav \
-b 16 result.wav rate 44100 \
ladspa vocoder 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Result:

sox FAIL rate: usage: ...

Edit (rate to --rate):

sox -M formant.wav carrier.wav \
-b 16 result.wav --rate 44100 \
ladspa vocoder 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Result:

sox FAIL formats: can't open input file `1': No such file or directory

If I run this:

analyseplugin vocoder

The ports hint to me that I'm using it out of order within SOX perhaps?

Plugin Name: "Vocoder"
Plugin Label: "vocoder"
Plugin Unique ID: 1441
Maker: "Achim Settelmeier (adapted to LADSPA by Josh Green)"
Copyright: "None"
Must Run Real-Time: No
Has activate() Function: Yes
Has deactivate() Function: No
Has run_adding() Function: No
Environment: Normal or Hard Real-Time
Ports: "Formant" input, audio
"Carrier" input, audio
"Output" output, audio
"Number of bands" input, control, 1 to 16, integer
"Band 1 Level" input, control, 0 to 1
"Band 2 Level" input, control, 0 to 1
"Band 3 Level" input, control, 0 to 1
"Band 4 Level" input, control, 0 to 1
"Band 5 Level" input, control, 0 to 1
"Band 6 Level" input, control, 0 to 1
"Band 7 Level" input, control, 0 to 1
"Band 8 Level" input, control, 0 to 1
"Band 9 Level" input, control, 0 to 1
"Band 10 Level" input, control, 0 to 1
"Band 11 Level" input, control, 0 to 1
"Band 12 Level" input, control, 0 to 1
"Band 13 Level" input, control, 0 to 1
"Band 14 Level" input, control, 0 to 1
"Band 15 Level" input, control, 0 to 1
"Band 16 Level" input, control, 0 to 1

Thanks much for your work on this project. Also, thanks again for taking a
look at this thread!

Kind regards,

Chris
Christopher Stevens
2017-07-05 12:11:04 UTC
Permalink
I'm still looking into this and haven't given up:

sox -M formant.wav carrier.wav \
-b 16 result.wav --rate 44100 \
ladspa vocoder 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

"sox FAIL formats: can't open input file `1': No such file or directory"

I'll let you know if I find a solution first. So far it seems that the
vocoder plugin is unusual in that it takes multiple input files. Most
ladspa discussion I see out there takes one and outputs one.

I haven't tried the other ladspa plugins yet either within SOX. Maybe I
should find and test one first there (searching for examples now).

I'm also going to play with the built-in ladspa commands separate with some
good reading here:
http://archive.oreilly.com/pub/a/linux/2001/02/02/ladspa.html

From what I can see though, the applyplugin command likes one input as well.

Kind regards,

Chris
Frank Williams
2017-07-05 14:24:17 UTC
Permalink
Chris, I wonder if this discussion from a while ago might relate usefully to your intended uses for LADSPA plugins in SoX...

http://sox.10957.n7.nabble.com/implementing-loudspeaker-crossovers-using-Sox-LADSPA-plugins-td5464.html

As for my own use, I did not pursue the discussed application further because of the problem of precisely synchronizing each individual stream. I may at some point revisit the issues, but not for some months at least.

Frank

Frank Williams
Via iPhone
Post by Christopher Stevens
sox -M formant.wav carrier.wav \
-b 16 result.wav --rate 44100 \
ladspa vocoder 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
"sox FAIL formats: can't open input file `1': No such file or directory"
I'll let you know if I find a solution first. So far it seems that the vocoder plugin is unusual in that it takes multiple input files. Most ladspa discussion I see out there takes one and outputs one.
I haven't tried the other ladspa plugins yet either within SOX. Maybe I should find and test one first there (searching for examples now).
http://archive.oreilly.com/pub/a/linux/2001/02/02/ladspa.html
From what I can see though, the applyplugin command likes one input as well.
Kind regards,
Chris
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
https://lists.sourceforge.net/lists/listinfo/sox-users
Christopher Stevens
2017-07-06 01:01:18 UTC
Permalink
Hello Frank,
Thanks for the great discussion link! I see some new things experiment
with. Absorbing now...

Kind regards,

Chris
Post by Frank Williams
Chris, I wonder if this discussion from a while ago might relate usefully
to your intended uses for LADSPA plugins in SoX...
http://sox.10957.n7.nabble.com/implementing-loudspeaker-crossovers-using-Sox-LADSPA-plugins-td5464.html
As for my own use, I did not pursue the discussed application further
because of the problem of precisely synchronizing each individual stream.
I may at some point revisit the issues, but not for some months at least.
Frank
Frank Williams
Via iPhone
On Jul 5, 2017, at 7:11 AM, Christopher Stevens <
sox -M formant.wav carrier.wav \
-b 16 result.wav --rate 44100 \
ladspa vocoder 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
"sox FAIL formats: can't open input file `1': No such file or directory"
I'll let you know if I find a solution first. So far it seems that the
vocoder plugin is unusual in that it takes multiple input files. Most
ladspa discussion I see out there takes one and outputs one.
I haven't tried the other ladspa plugins yet either within SOX. Maybe I
should find and test one first there (searching for examples now).
I'm also going to play with the built-in ladspa commands separate with
http://archive.oreilly.com/pub/a/linux/2001/02/02/ladspa.html
From what I can see though, the applyplugin command likes one input as well.
Kind regards,
Chris
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
https://lists.sourceforge.net/lists/listinfo/sox-users
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
https://lists.sourceforge.net/lists/listinfo/sox-users
Christopher Stevens
2017-07-06 20:02:25 UTC
Permalink
SUCCESS! LADSPA goodness is happening.

Of course as creative projects go, I decided not to go with a vocoder...
but I didn't give up until I got it to work first!

Thank you everyone for the support. Here's the thank you song I promised at
the resolution of my challenge. :D

With vocoder, blended with voiceover as it was harder to understand vocoded
words on their own after several variation trials (good for a future
project though):
https://s3.amazonaws.com/thank-you-song/vocoder-blended-test.mp3

With voiceover only, I personally like it better for my fun thank you song
project:
https://s3.amazonaws.com/thank-you-song/voice-over-test.mp3

Steps to make it work:
====
#where my plugins live
export LADSPA_PATH=/home/ec2-user/plugins

#ensure formant (mono voice) and carrier (mono pitch) audio files are set
to the vocoder plugin's requirements
sox formant.wav -b 16 formant1b.wav gain -1 rate 44100 dither -s
sox carrier.wav -b 16 carrier1b.wav gain -1 rate 44100 dither -s

#merge mono formant and carrier into a single audio stereo file left and
right channel
sox -M formant1b.wav carrier1b.wav formant_carrier.wav

#apply ladspa plugin via ladspa utilities directly
#!!! I'm stuck on how to make this work as part of sox, this gets the job
done directly though
applyplugin formant_carrier.wav final.wav vocoder vocoder 16 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
====

If interested to see what the song mention of Patreon is about (basically a
glorified tip jar to support electronic music habits), you're welcome to
preview it here, going live later this month:
https://www.patreon.com/preview/57d3ca9d09a64a8f97112c18cd914736

Thanks for what you do!

Kind regards,

Chris

Loading...