sox

JNA Bindings to the Sound eXchange(SoX) Library

License

License

Categories

Categories

Ant Build Tools JNA Development Tools Native
GroupId

GroupId

com.anthemengineering
ArtifactId

ArtifactId

sox-jna
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

sox
JNA Bindings to the Sound eXchange(SoX) Library
Project URL

Project URL

https://github.com/anthemengineering/sox-jna
Source Code Management

Source Code Management

https://github.com/anthemengineering/sox-jna/

Download sox-jna

How to add to project

<!-- https://jarcasting.com/artifacts/com.anthemengineering/sox-jna/ -->
<dependency>
    <groupId>com.anthemengineering</groupId>
    <artifactId>sox-jna</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.anthemengineering/sox-jna/
implementation 'com.anthemengineering:sox-jna:1.0.0'
// https://jarcasting.com/artifacts/com.anthemengineering/sox-jna/
implementation ("com.anthemengineering:sox-jna:1.0.0")
'com.anthemengineering:sox-jna:jar:1.0.0'
<dependency org="com.anthemengineering" name="sox-jna" rev="1.0.0">
  <artifact name="sox-jna" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.anthemengineering', module='sox-jna', version='1.0.0')
)
libraryDependencies += "com.anthemengineering" % "sox-jna" % "1.0.0"
[com.anthemengineering/sox-jna "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
net.java.dev.jna : jna-platform jar 5.4.0
net.java.dev.jna : jna jar 5.4.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.assertj : assertj-core jar 2.9.1

Project Modules

There are no modules declared in this project.

sox-jna

This project is a Java JNA binding to the Sound eXchange(SoX) audio processing library.

Maven Coordinates

<dependency>
  <groupId>com.anthemengineering</groupId>
  <artifactId>sox-jna</artifactId>
  <version>${sox-jna.version}</version>
</dependency>

Maven Central

Dependencies

Install sox-14.4.2 onto your library path.

Mac

brew install sox

This installs sox.h to your include path at /usr/local/Cellar/sox/__VERSION__/include/sox.h. Use that as the path to the sox.h as the jnaerator argument.

Ubuntu

sudo apt install libsox-dev

You may need to also run sudo apt install build-essential

This installs sox.h to your include path at /usr/include/sox.h. Use that as the path to the sox.h as the jnaerator argument.

Generating JNA Bindings

In order to generate the JNA bindings you must have the 'sox.h' file on your system in a way that jnaerator can read from it.

Via maven

The pom file is setup in a way that it will look for the 'sox.h' file:

  • on linux at /usr/include/sox.h (based on the apt install of the 'devel' sox package)
  • on mac at /usr/local/Cellar/sox/__VERSION__/include/sox.h (as if brew installed it)
  • manually configured via a flag given to maven: -Dsox_header=/my/path/to/incude/sox.h

The configuration parameters is given via the src/main/jnaerator/config.jnaerator maven resource file.

./mvnw process-resources  com.nativelibs4java:maven-jnaerator-plugin:generate

This command generates sources underneath the target/generated-sources/jna-bindings/com/anthemengineering/sox/jna path.

Manual way (because knowing how things works is a good thing)

wget https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12/jnaerator-0.12-shaded.jar
java -jar jnaerator-0.12-shaded.jar -runtime JNA -mode Directory -library sox -package com.anthemengineering.sox.jna sox.h

Building the sox-jna wrapper

./mvnw package

This should then generate the jar: target/sox-$VERSION.jar.

Small examples

  • SoxMain.java
    $ ./mvnw exec:java -Dexec.mainClass=com.anthemengineering.sox.SoxMain -Dexec.classpathScope=test
    
  • SoxEffectsChainMain.java
    $ ./mvnw exec:java -Dexec.mainClass=com.anthemengineering.sox.SoxEffectsChainMain -Dexec.classpathScope=test
    

Useful Links

com.anthemengineering

Anthem Engineering

Versions

Version
1.0.0