Skip to content
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ OPTION(WANT_OPENAL "Include OpenAL (Cross Platform) support" OFF)
OPTION(WANT_DEVTEST "Build WildMIDI DevTest file to check files" OFF)

OPTION(WANT_SF2 "SoundFont2 (SF2) support via TinySoundFont" ON)
OPTION(WANT_MAFM "Yamaha MA-series FM synthesis for SMAF files" ON)

CMAKE_DEPENDENT_OPTION(WANT_MP_BUILD "Build with Multiple Processes (/MP)" OFF "WIN32;MSVC" OFF)
CMAKE_DEPENDENT_OPTION(WANT_OSX_DEPLOYMENT "OSX Deployment" OFF "APPLE" OFF)
Expand Down Expand Up @@ -219,6 +220,10 @@ IF (WANT_SF2)
SET(WILDMIDI_SF2 1)
ENDIF()

IF (WANT_MAFM)
SET(WILDMIDI_MAFM 1)
ENDIF()

IF (AMIGA OR AROS)
SET(WILDMIDI_AMIGA 1)
ENDIF()
Expand Down
33 changes: 33 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
WildMIDI — third-party attributions
===================================

This product includes software developed by third parties, retained under
their original licenses. This NOTICE file is provided in satisfaction of the
attribution requirements of those licenses.

--------------------------------------------------------------------------------
Yamaha MA-series FM / ADPCM synthesis (src/mafm/)
--------------------------------------------------------------------------------

The files under src/mafm/ are ported to C from the akustikrausch
"yamaha-smaf-player" project:

https://github.com/akustikrausch/yamaha-smaf-player
Copyright (c) Andreas Wendorf (Akustikrausch)
Licensed under the Apache License, Version 2.0.

The C translation preserves the original algorithms. Each ported file retains
its "SPDX-License-Identifier: Apache-2.0" header. A copy of the Apache License,
Version 2.0 is available at:

http://www.apache.org/licenses/LICENSE-2.0

Ported so far:
src/mafm/yamaha_adpcm.{c,h} -- 4-bit Yamaha (OPNA-B) ADPCM codec
src/mafm/smaf_voice.{c,h} -- VM35 / VMA voice-exclusive -> FM patch decode
src/mafm/ma_fm_core.{c,h} -- FM DSP: operators, envelopes, 2/4-op voices

The WildMIDI-side wrapper (src/mafm.c, include/mafm.h) that drives this synth is
original WildMIDI code under the project's usual GPL/LGPL, not Apache-2.0.

See docs/SMAF_FM.md for the design and the porting plan.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ cannot provide.
CHANGELOG

0.5.1 (unreleased)
* Support for playing and converting Yamaha SMAF (`.mmf`) ringtone files:
the HandyPhone (MA-1/MA-2) and Mobile Standard (MA-3/MA-5) score formats.
The MA-7 "SEQU" format is not supported.
* Yamaha MA-series FM synthesis for SMAF: a file carrying a custom FM voice
bank plays with its own instruments and embedded ADPCM percussion instead
of a General MIDI approximation. `WANT_MAFM=ON`; see `docs/SMAF_FM.md`.
* Player: playlist support. A filename given to the player may now be a
directory, which is searched recursively for files to play (bug #215.)
* Player: new `-S/--shuffle` switch plays the files in random order.
Expand Down
4 changes: 3 additions & 1 deletion amiga/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ endif
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/mafm/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/player/%.c
$(CC) -c $(CFLAGS) -o $@ $<

# Objects
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o internal_midi.o patches.o sample.o sf2.o synth.o opl3.o
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o f_smaf.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o smaf2mid.o internal_midi.o patches.o sample.o sf2.o mafm.o ma_fm_core.o smaf_voice.o yamaha_adpcm.o synth.o opl3.o
PLAYER_OBJ= amiga.o wm_tty.o playlist.o msleep.o getopt_long.o out_none.o out_wave.o out_ahi.o wildmidi.o

# Build targets
Expand Down
4 changes: 3 additions & 1 deletion amiga/Makefile.vbcc
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ endif
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/mafm/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/player/%.c
$(CC) -c $(CFLAGS) -o $@ $<

# Objects
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o internal_midi.o patches.o sample.o sf2.o synth.o opl3.o
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o f_smaf.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o smaf2mid.o internal_midi.o patches.o sample.o sf2.o mafm.o ma_fm_core.o smaf_voice.o yamaha_adpcm.o synth.o opl3.o
PLAYER_OBJ= amiga.o wm_tty.o playlist.o msleep.o getopt_long.o out_none.o out_wave.o out_ahi.o wildmidi.o

# Build targets
Expand Down
1 change: 1 addition & 0 deletions amiga/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/* #undef HAVE_SQRTF */
/* #undef HAVE_POWF */

#define WILDMIDI_MAFM 1
#define WILDMIDI_SF2 1

#define AUDIODRV_AHI 1
Expand Down
8 changes: 7 additions & 1 deletion android/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LOCAL_SRC_FILES := \
src/f_hmp.c \
src/f_midi.c \
src/f_mus.c \
src/f_smaf.c \
src/f_xmidi.c \
src/file_io.c \
src/gus_pat.c \
Expand All @@ -22,12 +23,17 @@ LOCAL_SRC_FILES := \
src/reverb.c \
src/sample.c \
src/sf2.c \
src/mafm.c \
src/mafm/ma_fm_core.c \
src/mafm/smaf_voice.c \
src/mafm/yamaha_adpcm.c \
src/synth.c \
src/opl3.c \
src/wildmidi_lib.c \
src/wm_error.c \
src/xmi2mid.c \
src/hmp2mid.c \
src/hmi2mid.c
src/hmi2mid.c \
src/smaf2mid.c

include $(BUILD_SHARED_LIBRARY)
1 change: 1 addition & 0 deletions android/jni/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define HAVE_SQRTF 1
#define HAVE_POWF 1

#define WILDMIDI_MAFM 1
#define WILDMIDI_SF2 1

/* Define our audio drivers */
Expand Down
13 changes: 13 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

// Yamaha MA-series FM synthesis for SMAF files. On by default, but
// consumers can opt out with -Dmafm=false (mirrors the WANT_MAFM CMake
// option); the mafm sources then compile to their empty stubs.
const want_mafm = b.option(bool, "mafm", "Enable Yamaha MA FM synthesis for SMAF files") orelse true;
const mafm_define: ?i64 = if (want_mafm) 1 else null;

const lib_mod = b.createModule(.{
.target = target,
.optimize = optimize,
Expand Down Expand Up @@ -31,14 +37,20 @@ pub fn build(b: *std.Build) void {
"src/f_hmp.c",
"src/f_hmi.c",
"src/f_midi.c",
"src/f_smaf.c",
"src/sample.c",
"src/synth.c",
"src/opl3.c",
"src/sf2.c",
"src/mafm.c",
"src/mafm/ma_fm_core.c",
"src/mafm/smaf_voice.c",
"src/mafm/yamaha_adpcm.c",
Comment thread
psi29a marked this conversation as resolved.
"src/mus2mid.c",
"src/xmi2mid.c",
"src/hmp2mid.c",
"src/hmi2mid.c",
"src/smaf2mid.c",
};

const defaultFlags = .{
Expand All @@ -62,6 +74,7 @@ pub fn build(b: *std.Build) void {
.HAVE_INTTYPES_H = 1,
.WORDS_BIGENDIAN = null,
.WILDMIDI_AMIGA = null,
.WILDMIDI_MAFM = mafm_define,
.HAVE_SYS_SOUNDCARD_H = null,
.AUDIODRV_ALSA = null,
.AUDIODRV_OSS = null,
Expand Down
4 changes: 3 additions & 1 deletion djgpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ endif
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/mafm/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/player/%.c
$(CC) -c $(CFLAGS) -o $@ $<
%.o: ../src/player/dos/%.c
$(CC) -c $(CFLAGS) -o $@ $<


# Objects
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o internal_midi.o patches.o sample.o sf2.o synth.o opl3.o
LIB_OBJ= wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o f_smaf.o mus2mid.o xmi2mid.o hmp2mid.o hmi2mid.o smaf2mid.o internal_midi.o patches.o sample.o sf2.o mafm.o ma_fm_core.o smaf_voice.o yamaha_adpcm.o synth.o opl3.o
PLAYER_OBJ= wm_tty.o playlist.o msleep.o getopt_long.o out_none.o dosirq.o dosdma.o dossb.o out_dossb.o out_wave.o wildmidi.o

# Build targets
Expand Down
1 change: 1 addition & 0 deletions djgpp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/* #undef HAVE_SQRTF */
/* #undef HAVE_POWF */

#define WILDMIDI_MAFM 1
#define WILDMIDI_SF2 1

#define AUDIODRV_DOSSB 1
Loading
Loading