Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.16 #15

Merged
merged 9 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,25 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Build with Maven
run: mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml -Dmaven.test.skip=true
env:
GITHUB_TOKEN: ${{ github.token }}

#- run: |
# make bootstrap
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Java CI

on:
push:
Expand All @@ -22,10 +22,10 @@ jobs:
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp/
local.properties
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
[![Release](https://jitpack.io/v/umjammer/vavi-sound.svg)](https://jitpack.io/#umjammer/vavi-sound)
[![Java CI with Maven](https://github.com/umjammer/vavi-sound/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/umjammer/vavi-sound/actions)
[![Java CI](https://github.com/umjammer/vavi-sound/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound/actionsworkflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-sound/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/vavi-sound/actions/workflows/codeql-analysis.yml)
![Java](https://img.shields.io/badge/Java-8-b07219)
![Java](https://img.shields.io/badge/Java-17-b07219)

# vavi-sound

Provides old school Japanese cell phone sounds library as `javax.sound` SPI.
Includes many ADPCM codecs and the SSRC sampling rate converter.
Includes many ADPCM codecs and the [SSRC](https://github.com/shibatch/SSRC) sampling rate converter.

## Status

| **SPI** | **Codec** | **Description** | **IN Status** | **OUT Status** | **SPI Status** | **Comment** |
|:--------|:-------------|:---------------------------|:--------------|:---------------|:---------------|:----------------------------|
| midi | MFi | Japanese cell phone format | 🚧 | ✅ | ✅ | |
| midi | SMAF | YAMAHA cell phone format | 🚧 | ✅ | ✅ | |
| sampled | MFi | Japanese cell phone format | ✅ | ✅ | ✅ | |
| sampled | SMAF | YAMAHA cell phone format | ✅ | ✅ | ✅ | |
| sampled | CCITT ADPCM | G711, G721, G723 | ✅ | ✅ | ✅ | |
| sampled | DVI ADPCM | DVI ADPCM | ✅ | ✅ | ✅ | |
| sampled | IMA ADPCM | IMA ADPCM | ✅ | ✅ | ✅ | |
| sampled | MA ADPCM | YAMAHA ADPCM | ✅ | ✅ | ✅ | |
| sampled | MS ADPCM | Microsoft ADPCM | ✅ | ✅ | ✅ | |
| sampled | OKI ADPCM | OKI ADPCM | ✅ | ✅ | ✅ | |
| sampled | ROHM ADPCM | ROHM ADPCM | ✅ | ✅ | ✅ | |
| sampled | VOX ADPCM | VOX ADPCM | ✅ | ✅ | ✅ | |
| sampled | YAMAHA ADPCM | YAMAHA ADPCM | ✅ | ✅ | - | same as ym2068 |
| sampled | YM2068 ADPCM | YAMAHA ADPCM | ✅ | ✅ | ✅ | |
| sampled | ssrc | resampling | ✅ | - | ✅ | need to wait for phase 1 |
| **SPI** | **Codec** | **Description** | **IN Status** | **OUT Status** | **SPI Status** | **Comment** |
|:--------|:---------------------------------------------------------|:---------------------------|:--------------|:---------------|:---------------|:----------------------------|
| midi | [MFi](src/main/java/vavi/sound/midi/mfi) | Japanese cell phone format | 🚧 | ✅ | ✅ | |
| midi | [SMAF](src/main/java/vavi/sound/midi/smaf) | YAMAHA cell phone format | 🚧 | ✅ | ✅ | |
| sampled | [MFi](src/main/java/vavi/sound/sampled/mfi) | Japanese cell phone format | ✅ | ✅ | ✅ | |
| sampled | [SMAF](src/main/java/vavi/sound/sampled/smaf) | YAMAHA cell phone format | ✅ | ✅ | ✅ | |
| sampled | [CCITT ADPCM](src/main/java/vavi/sound/adpcm/ccitt) | G711, G721, G723 | ✅ | ✅ | ✅ | |
| sampled | [DVI ADPCM](src/main/java/vavi/sound/adpcm/dvi) | DVI ADPCM | ✅ | ✅ | ✅ | |
| sampled | [IMA ADPCM](src/main/java/vavi/sound/adpcm/ima) | IMA ADPCM | ✅ | ✅ | ✅ | |
| sampled | [MA ADPCM](https://gitlab.com/umjammer/vavi-sound-nda) | YAMAHA ADPCM | ✅ | ✅ | ✅ | |
| sampled | [MS ADPCM](src/main/java/vavi/sound/adpcm/ms) | Microsoft ADPCM | ✅ | ✅ | ✅ | |
| sampled | [OKI ADPCM](src/main/java/vavi/sound/adpcm/oki) | OKI ADPCM | ✅ | ✅ | ✅ | |
| sampled | [ROHM ADPCM](https://gitlab.com/umjammer/vavi-sound-nda) | ROHM ADPCM | ✅ | ✅ | ✅ | |
| sampled | [VOX ADPCM](src/main/java/vavi/sound/adpcm/vox) | VOX ADPCM | ✅ | ✅ | ✅ | |
| sampled | [YAMAHA ADPCM](src/main/java/vavi/sound/adpcm/yamaha) | YAMAHA ADPCM | ✅ | ✅ | - | same as ym2068 |
| sampled | [YM2068 ADPCM](src/main/java/vavi/sound/adpcm/ym2608) | YAMAHA ADPCM | ✅ | ✅ | ✅ | |
| sampled | [ssrc](src/main/java/vavi/sound/pcm/resampling/ssrc) | resampling | ✅ | - | ✅ | need to wait for phase 1 |

## Install

Expand All @@ -42,7 +42,7 @@ A. yes you can, follow those steps
* `vavi/sound/pcm/resampling/ssrc/SSRC.class`
* `vavi/util/SplitRadixFft.class`
* `vavi/util/I0Bessel.class`
* caution:
* ⚠ **caution**:
* your application complies with the LGPL. customers **have a right to reverse engineering your application**.
* if you include ssrc.jar with a distribution, you **must offer a way to get ssrc source code**.
* see also
Expand All @@ -57,6 +57,7 @@ A. yes you can, follow those steps

* use `Receiver` instead of `MetaEventListener`
* ssrc: use nio pipe for 1st pass
* on macos m2 ultra 1st pass is in a blink of an eye
* ~~`ima`, `ms` adpcm: wav reader~~
* ~~`tritonus:tritonus-remaining:org.tritonus.sampled.file.WaveAudioFileReader`~~
* wip at `vavi-sound-sandbox`
* ~~wip at [vavi-sound-sandbox](https://github.com/umjammer/vavi-sound-sandbox)~~ done in this project
3 changes: 3 additions & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#ssrc=/foo/bar.wav

#sf2=/Users/nsano/Library/Audio/Sounds/Banks/Orchestra/baz.sf2
61 changes: 44 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound</artifactId>
<version>1.0.15</version>
<version>1.0.16</version>

<name>Vavi Sound API</name>
<url>https://github.com/umjammer/vavi-sound</url>
Expand Down Expand Up @@ -57,24 +57,56 @@ TODO
<dev.null>NUL</dev.null>
</properties>
</profile>

<profile>
<id>assembly-with-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>assembly-with-test</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>PlayMFi</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>8</source>
<target>8</target>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
<executions>
<execution>
<goals>
Expand All @@ -91,11 +123,12 @@ TODO
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.1.2</version>
<configuration>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
-Dvavi.test.dev.null=${dev.null}
-Dvavi.test.volume=0.02
</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
Expand All @@ -119,7 +152,7 @@ TODO
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.1</version>
<version>5.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -130,7 +163,7 @@ TODO
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
Expand All @@ -144,15 +177,9 @@ TODO
</exclusions>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<groupId>com.github.umjammer</groupId> <!-- com.github.umjammer -->
<artifactId>vavi-util-codec-sandbox</artifactId>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
</exclusion>
</exclusions>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>vavi</groupId>
Expand Down
29 changes: 29 additions & 0 deletions src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

<id>jar-with-dependencies-and-tests</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>test</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}/test-classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.class</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
</assembly>
36 changes: 18 additions & 18 deletions src/main/java/readme.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# `vavi.sound`
# vavi.sound

このドキュメントは着メロライブラリの API 仕様です。
those are sound API specs for the japanese old school cellphone ringtones.

## Feature

* {@link javax.sound.midi.spi} として実装されているため特にプログラムで意識することなく MFi ファイルを midi ファイルとして取り扱い可能です。
* MFi バージョン 3.1 までの形式をサポートしています。
* MFi ←→ SMF の相互変換が可能です。
* 機種依存データのハンドラを追加する事で各機種に対応した着声が作成可能です。
* we can play MFi/SMAF as a midi file because it's implemented as `javax.sound.midi.spi`
* supports until MFi version 3.1
* mutual conversion between MFi ←→ SMF is possible
* by adding a handler for model-dependent data, you can create voice calls that are compatible with each model.

## Abstract

三つの大きなパートから構成されます。
`vavi.sound` consists of three parts.

1. ADPCM codecs
2. MFi library
3. {@link javax.sound.midi.spi} implementation
3. `javax.sound.midi.spi` implementation

### 1. ADPCM codecs

パッケージ
packages

* {@link vavi.sound.adpcm.ccitt}
* {@link vavi.sound.adpcm.ma}
* {@link vavi.sound.adpcm.vox}
* `vavi.sound.adpcm.ccitt`
* `vavi.sound.adpcm.ma`
* `vavi.sound.adpcm.vox`

着声に使用される ADPCM コーデックを取り扱うパッケージ群です。
Java の標準 IO ({@link java.io.InputStream}/{@link java.io.OutputStream}) として実装されているため
Expand All @@ -33,23 +33,23 @@ Java の標準 IO ({@link java.io.InputStream}/{@link java.io.OutputStream}) と

packages

* {@link vavi.sound.mfi}
* {@link vavi.sound.mfi.vavi}
* `vavi.sound.mfi`
* `vavi.sound.mfi.vavi`
* :

着メロライブラリの核となる部分です。MFi のファイル構造を取り扱い、MIDI 構造に変換する事が出来ます。
また MIDI から MFi への変換も可能です。基本的に {@link javax.sound.midi} パッケージと同じ構造をとっています。
機種依存データを扱うパッケージとして {@link vavi.sound.mfi.vavi.mitsubishi D社} と
{@link vavi.sound.mfi.vavi.nec N社} がサンプル実装されています。

### 3. {@link javax.sound.midi.spi} implementation
### 3. `javax.sound.midi.spi` implementation

packages

* {@link vavi.sound.midi}
* {@link vavi.sound.midi.mfi}
* `vavi.sound.midi`
* `vavi.sound.midi.mfi`

{@link javax.sound.midi.spi} の一実装として機能させるためのパッケージです。
`javax.sound.midi.spi` の一実装として機能させるためのパッケージです。
[SPI](http://java.sun.com/j2se/1.5.0/ja/docs/ja/guide/sound/programmer_guide/chapter1.html#111901)
仕様に従い登録すれば midi の一ファイル形式として MFi ファイルを
再生する事が可能になります。
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/vavi/sound/adpcm/AdpcmInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public AdpcmInputStream(InputStream in, ByteOrder byteOrder, int bits, ByteOrder
}

/** ADPCM (4bit) 換算時の長さ */
@Override
public int available() throws IOException {
//Debug.println("0: " + in.available() + ", " + ((in.available() * 2) + (rest ? 1 : 0)));
// TODO * 2 とか bits で計算すべき?
Expand All @@ -69,6 +70,7 @@ public int available() throws IOException {
/**
* @return PCM H or L (8bit LSB 有効)
*/
@Override
public int read() throws IOException {
//Debug.println(in);
if (!rest) {
Expand Down Expand Up @@ -98,7 +100,7 @@ public int read() throws IOException {
}
}

/* */
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/vavi/sound/adpcm/AdpcmOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public AdpcmOutputStream(OutputStream out, ByteOrder byteOrder, int bits, ByteOr
/**
* @param b PCM H or L byte を {@link #byteOrder} 順に指定 (LSB 8bit 有効)
*/
@Override
public void write(int b) throws IOException {
if (!flushed) {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vavi/sound/adpcm/ccitt/G711.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ abstract class G711 implements Codec {
private static final int SIGN_BIT = 0x80;
/** Quantization field mask. */
private static final int QUANT_MASK = 0xf;
/** Number of A-law segments. */
// private static final int NSEGS = 8;
// /** Number of A-law segments. */
// private static final int NSEGS = 8;
/** Left shift for segment number. */
private static final int SEG_SHIFT = 4;
/** Segment field mask. */
Expand Down
Loading
Loading