Skip to content

Commit

Permalink
Merge pull request #2 from umjammer/0.0.3
Browse files Browse the repository at this point in the history
0.0.3
  • Loading branch information
umjammer authored Mar 15, 2024
2 parents 716ff3e + 1176abc commit 385584e
Show file tree
Hide file tree
Showing 33 changed files with 1,107 additions and 942 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
Expand All @@ -36,11 +40,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,19 +54,34 @@ 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@v1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

# ℹ️ 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 -Dmaven.test.skip=true

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ 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
# ✏️ 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 -Dmaven.test.skip=true

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
27 changes: 19 additions & 8 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 @@ -15,10 +15,21 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Checkout repository
uses: actions/checkout@v4

- name: Check w/o SNAPSHOT when "bump version"
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

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

- name: Build with Maven
run: |
wget -O src/test/resources/unpacked.bin https://github.com/bwhitman/learnfm/blob/f5415157c65b0298dad692e5e332c71644718e28/unpacked.bin?raw=true
mvn -B package --file pom.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
unpacked.bin
/tmp/
local.properties
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
4 changes: 4 additions & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#test.midi=/foo/bar.mid

vavi.test.volume=0.02
vavi.test.volume.midi=0.2
76 changes: 66 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,72 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound-dx7</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>

<properties>
<vavi.test.volume>0.02</vavi.test.volume>
<vavi.test.volume.midi>0.2</vavi.test.volume.midi>
</properties>

<profiles>
<profile>
<id>local</id>
<activation>
<file>
<exists>${basedir}/local.properties</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>read-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/local.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
<compilerArgs>
<arg>--add-exports</arg>
<arg>java.desktop/com.sun.media.sound=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.2</version>
<configuration>
<argLine>
--add-opens java.desktop/com.sun.media.sound=ALL-UNNAMED
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
-Dvavi.test.volume=${vavi.test.volume}
-Dvavi.test.volume.midi=${vavi.test.volume.midi}
</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
Expand All @@ -36,34 +83,43 @@
</repository>
</repositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.4</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-sound</artifactId>
<version>1.0.10</version>
<version>1.0.16</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
26 changes: 17 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
[![Release](https://jitpack.io/v/umjammer/vavi-sound-dx7.svg)](https://jitpack.io/#umjammer/vavi-sound-dx7) [![Java CI with Maven](https://github.com/umjammer/vavi-sound-dx7/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/umjammer/vavi-sound-dx7/actions)
[![Release](https://jitpack.io/v/umjammer/vavi-sound-dx7.svg)](https://jitpack.io/#umjammer/vavi-sound-dx7)
[![Java CI](https://github.com/umjammer/vavi-sound-dx7/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-sound-dx7/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-sound-dx7/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/vavi-sound-dx7/actions/workflows/codeql-analysis.yml)
![Java](https://img.shields.io/badge/Java-17-b07219)

# vavi-sound-dx7

<img alt="logo" src="https://github.com/umjammer/vavi-sound-dx7/assets/493908/ad201f35-b348-4e3c-8382-6570f56bc9cf" width="160" /> <sub><a href="https://www.yamaha.com/ja/tech-design/design/synapses/id_009">© YAMAHA</a></sub>

DX7 emulated synthesizer. `javax.sound.midi.spi` compatible.

## spec.
### spec.

* sysex [43, 00, 09, 20, 00] supported
* control change 1, 2, 3, 64 supported

## install

* maven repo: [jitpack](https://jitpack.io/#umjammer/vavi-sound-dx7)
* maven [jitpack](https://jitpack.io/#umjammer/vavi-sound-dx7)
* copy [`unpacked.bin`](https://github.com/bwhitman/learnfm/blob/f5415157c65b0298dad692e5e332c71644718e28/unpacked.bin) into your class path
* edit `dx7.properties`, create your instruments set
* edit `dx7.properties`([sample](src/test/resources/dx7.properties)), create your instruments set

## Usage

## with [Herr Mueller's DX7](http://www.vstforx.de/index.php/disco-news-blog/29-goodies/92-vstforx-presents-herr-mueller-s-dx7)
### with [Herr Mueller's DX7](http://www.vstforx.de/index.php/disco-news-blog/29-goodies/92-vstforx-presents-herr-mueller-s-dx7)

without the real dx7 machine, you can play dx7 sound!
without a real dx7 machine, you can play dx7 sound!

![herrMueller](https://lh3.googleusercontent.com/pw/ACtC-3erXg2jLuvfN_0EvFXnGhCRSRaf5D75KJZfOtmtUk8NuZGNkLOm87vipTViapFHoixBgOuMFQ4WTKMZAmfaMeU-wLlZol_udw5XMDLNDj_O9i-5Vl7U4mG-O8r0hJijXE7liyY2RjSXLVLAir0dyg2P=w640-h225-no?authuser=0)
![SS 2020-11-10 15 42 30](https://user-images.githubusercontent.com/493908/195994898-beb01841-8a6b-4071-91e1-542b36a4ac4c.jpg)

## thanks
## References

* https://github.com/google/music-synthesizer-for-android
* gervill
Expand All @@ -30,4 +37,5 @@ without the real dx7 machine, you can play dx7 sound!

* better default instruments set
* syx, vcs loader (use SoundbankReader)
* automatic instruments recognizer/classifier
* automatic instruments recognizer/classifier
* ~~volume~~ works! thanks gervill
47 changes: 47 additions & 0 deletions src/main/java/vavi/sound/dx7/Context.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package vavi.sound.dx7;

import java.util.HashMap;
import java.util.Map;


/**
* Context.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (nsano)
* @version 0.00 2022-06-15 nsano initial version <br>
*/
public class Context {
public float sampleRate;

// The original DX7 had one single LFO. Later units had an LFO per note.
public Lfo lfo;
public FreqLut freqLut;
public PitchEnv pitchEnv;

private static Map<Float, Context> instances = new HashMap<>();

public static Context getInstance(float sampleRate) {
if (instances.containsKey(sampleRate)) {
return instances.get(sampleRate);
} else {
Context context = new Context(sampleRate);
instances.put(sampleRate, context);
return context;
}
}

private Context(float sampleRate) {
this.sampleRate = sampleRate;
freqLut = new FreqLut(sampleRate);
lfo = new Lfo(sampleRate);
pitchEnv = new PitchEnv(sampleRate);
}

public void setSampleRate(float sampleRate) {
this.sampleRate = sampleRate;
Context context = getInstance(sampleRate);
this.freqLut = context.freqLut;
this.lfo = context.lfo;
this.pitchEnv = context.pitchEnv;
}
}
Loading

0 comments on commit 385584e

Please sign in to comment.