conda-forge / sox-feedstock

A conda-smithy repository for sox.
BSD 3-Clause "New" or "Revised" License
5 stars 10 forks source link

Add support for mp3 and ogg #9

Closed tcwalther closed 2 years ago

tcwalther commented 8 years ago

It would be fantastic if you could add mp3 and ogg support to sox. Currently, it supports:

AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb au avr cdda cdr cvs cvsd cvu dat dvms
f32 f4 f64 f8 fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu maud nist prc raw s1 s16 s2
s24 s3 s32 s4 s8 sb sf sl sln smp snd sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3 u32 u4
u8 ub ul uw vms voc vox wav wavpcm wve xa
183amir commented 8 years ago

How is that added? Could you open a pull request please?

tcwalther commented 8 years ago

I'm quite new to conda feedstocks. I'll happily submit a PR once I understand how it all works. In the meantime, it would be great if you could provide me some assistance.

I pulled the docker image condaforge/linux-anvil, tried to ./configure sox in there and looked at the output. I couldn't get it better than this:

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

First, I tried running ./configure in a conda environnent, but when I did that, configure would just fail, saying that C compiler cannot create executables. When running ./configure outside an environment, I get the above output. I then tried installing lame via anaconda (HCC/lame) - it's not available via yum - but that didn't help. I then tried installing libogg via yum, but that didn't get picked up either.

I'd be happy for tips on how to proceed from here. In the meantime, I'll just use the sox that comes with my system's package manager.

183amir commented 8 years ago

Can you compile sox with mp3 support on your machine without conda and docker? What are the instructions?

tcwalther commented 8 years ago

On my Mac, I simply run ./configure, followed by make. I already have all the prerequisites installed, it seems. Here's the configure output: http://hastebin.com/ivafiqicej.txt

I tested the resulting sox binary, and it indeed loads mp3 and ogg files.

Looking through the configure log, the following lines seem to be important for MP3:

checking for mad.h... yes
checking for id3tag.h... yes
checking lame/lame.h usability... yes

And for ogg:

checking for vorbis/codec.h... yes

And since we're at it, FLAC:

checking for FLAC/all.h... yes

I found the following tutorial on installing sox with mp3 support on CentOS: http://arstech.net/installing-sox-with-mp3-support-on-centos/

However, they recommend installing the libraries libmad, libid3tag, lame, libvorbis and flac (and their -devel counterparts) via yum, which is of course not cross-platform compatible. I'm not sure how this is usually handled conda-forge.

183amir commented 7 years ago

Sorry somehow I forgot this thread.

@tcwalther you need to make those libraries (libmad, libid3tag, lame, libvorbis, and flac) available in conda-forge first and then add them as dependencies here.

carlthome commented 6 years ago

libvorbis is on conda-forge but sox doesn't seem to find it.

conda install -c conda-forge -y sox libvorbis
soxi test.ogg

soxi FAIL formats: no handler for detected file type `vorbis'

Chethan-21 commented 5 years ago

Hi,

I am trying to apply GAIN for audio file extension [ WAVE ]. But SOX library is returning failure saying "no handler for given file type 'wav' "...

How do I add wave file format handler and recompile the SOX open source code.

Please let know...Thanks in Advance.

Mazagov commented 5 years ago

Any chance of adding Flac support?

183amir commented 5 years ago

Unless you put the effort or somebody else, I don't see it happening. Once dependencies of Sox are separate conda packages, you can open a pull request here to add support for them in sox.

183amir commented 2 years ago

mp3 support was added in https://github.com/conda-forge/sox-feedstock/pull/18 please open separate issues for other codecs.