• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    C
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android midi driver using Sonivox EAS library

Logo Midi Driver .github/workflows/build.yml GitHub All Releases JitPack

Android midi driver using Sonivox EAS library. The library is available in Releases.

Licensed under Apache license.

Includes Sonivox EAS library rebuilt without spurious references to libutils and libcutils. The ARM versions have been build with the assembler source files.

Load DLS soundfont files

I have attempted to add code to load DLS soundfont files, which I have not been able to get working. The code is in the DLS branch and the relevent issue is Costum soundfont is possible?.

If anyone would like to take this up and attempt to get it working that would be much appreciated. I know Google know how it works because they have fixed a bug in it...

    Author: Eric Laurent <[email protected]>
    Date:   Thu May 14 09:10:40 2015 -0700

    DLS parser: fix wave pool size check.

    Bug: 21132860.

Bugs

Google has fixed the 64 bit reverb bug: #15 - Fix math functions for 64-bit. The driver should now work correctly on all 64 bit devices.

The Sonivox library is now built as a static library and linked with the midi library. This should resolve problems with various android versions.

Use

Add the driver to your build.gradle with

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and:

dependencies {
    implementation 'com.github.billthefarmer:mididriver:v1.24'
}

Constructor

The constructor has been made private and getInstance() methods added so it is not possible to have more than one instance in an app. See the demo app for an example.

Methods

    static MidiDriver getInstance() // Get instance of driver

    static MidiDriver getInstance(OnMidiStartListener l)

    void start() // Start the driver. Call from onResume().

    void stop()  // Stop the driver. Call from onPause();

    void addOnMidiStartListener(OnMidiStartListener l)

    void queueEvent(byte[]) // Send a midi message. This method now just
                            // calls write()

Listener

    void onMidiStart() // This is called when the driver has started so
                       // that program change messages, etc, may be sent.
                       // This is now somewhat redundant but has been left in.

Native Methods

    boolean init()  // Return true on success, or false on failure.
	
    int[] config()  // Return a four element array of ints with part of
                    // the EAS config:

        config[0] = pLibConfig->maxVoices;
        config[1] = pLibConfig->numChannels;
        config[2] = pLibConfig->sampleRate;
        config[3] = pLibConfig->mixBufferSize;

    boolean write(byte buffer[]) // Writes midi data to the Sonivox
                                 // synthesizer. The length of the array
                                 // should be the exact length of the
                                 // message or messages. Returns true
                                 // on success, false on
                                 // failure.

    boolean setVolume(int volume) // Set master volume for EAS
                                  // synthesizer (between 0 and 100).
                                  // Returns true on success, false on
                                  // failure.
    boolean setReverb(int preset) // Set Reverb effect preset for EAS
                                  // synthesizer (value from
                                  // ReverbConstants). Returns true
                                  // on success, false on failure.

    boolean shutdown() // Shut down the synthesizer. Returns true on
                       // success, false on failure.

C/C++ Native Functions

#include "midi.h"

    jboolean midi_init()  // Return true on success, or false on failure.
    jboolean midi_write(EAS_U8 *bytes, jint length)
                                 // Writes midi data to the Sonivox
                                 // synthesizer. The length of the array
                                 // should be the exact length of the
                                 // message or messages. Returns true
                                 // on success, false on
                                 // failure.
    jboolean midi_setVolume(jint volume)
                                  // Set master volume for EAS
                                  // synthesizer (between 0 and 100).
                                  // Returns true on success, false on
                                  // failure.
    jboolean midi_setReverb(jint preset)
                                  // Set Reverb effect preset for EAS
                                  // synthesizer. Preset could be:
                                  //   -1: turn reverb off
                                  //    0: large hall
                                  //    1: hall
                                  //    2: chamber
                                  //    3: room.
                                  // Returns true on success, false on
                                  // failure.
    jboolean midi_shutdown() // Shut down the synthesizer. Returns true on
                             // success, false on failure.

Native library locations

The location of the native libmidi.so libraries for building native code may be found by doing a search in the app build folder. This location may change with different versions of the android build tools.

$ find ./build -name libmidi.so
./build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/libmidi.so
./build/intermediates/merged_native_libs/debug/out/lib/armeabi-v7a/libmidi.so
./build/intermediates/merged_native_libs/debug/out/lib/x86/libmidi.so
./build/intermediates/merged_native_libs/debug/out/lib/x86_64/libmidi.so
./build/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libmidi.so
./build/intermediates/merged_native_libs/release/out/lib/armeabi-v7a/libmidi.so
./build/intermediates/merged_native_libs/release/out/lib/x86/libmidi.so
./build/intermediates/merged_native_libs/release/out/lib/x86_64/libmidi.so
./build/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/libmidi.so
./build/intermediates/stripped_native_libs/debug/out/lib/armeabi-v7a/libmidi.so
./build/intermediates/stripped_native_libs/debug/out/lib/x86/libmidi.so
./build/intermediates/stripped_native_libs/debug/out/lib/x86_64/libmidi.so
./build/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libmidi.so
./build/intermediates/stripped_native_libs/release/out/lib/armeabi-v7a/libmidi.so
./build/intermediates/stripped_native_libs/release/out/lib/x86/libmidi.so
./build/intermediates/stripped_native_libs/release/out/lib/x86_64/libmidi.so

More Repositories

1

editor

Android simple text editor
Java
470
star
2

diary

Android personal diary - forked from http://git.savannah.gnu.org/cgit/diary.git
Java
275
star
3

tuner

Android accordion tuner
Java
175
star
4

scope

Android Oscilloscope
Java
143
star
5

sig-gen

Android Signal Generator
Java
115
star
6

currency

Android currency conversion
Java
86
star
7

notes

Android notebook
Java
81
star
8

print

Android print app
Java
56
star
9

ctuner

Musical instrument strobe tuner
C++
54
star
10

gurgle

Fairly simple android word game
Java
53
star
11

audiotools

Automatically exported from code.google.com/p/audiotools
Swift
49
star
12

crossword

Android crossword solver
Java
33
star
13

accordion

Android accordion emulator
Java
31
star
14

specie

Android currency conversion app
Java
18
star
15

gridle

Android word game
Java
17
star
16

wordlesolver

Wordle (Gurgle) solver with code from https://github.com/PoorLazyCoder/Wordle-Solver
Java
14
star
17

shorty

Create shortcuts for Intent Radio or VLC
Java
14
star
18

melodeon

Android melodeon emulator
Java
13
star
19

snarks

Java game originally written in 6502 machine code
Java
11
star
20

CustomCalendarView

Android custom calendar view - not quite forked from https://github.com/npanigrahy/Custom-Calendar-View
Java
11
star
21

MarkdownView

Android markdown view forked from https://github.com/falnatsheh/MarkdownView
Java
11
star
22

samurai-sudoku

Samurai, Hexadoku, Dodeka and Sudoku using Donald Knuth's Dancing Links algorithm
C++
10
star
23

gpdf

GEDCOM genealogy pdf chart creation
C
9
star
24

histogram

Android image histogram
Java
8
star
25

billthefarmer.github.io

Web pages
HTML
8
star
26

raspi-sonivox

Raspberry Pi implementation of the Android EAS Sonivox MIDI library
C
8
star
27

buses

Android bus times app
Java
7
star
28

weather

Android weather app
Java
7
star
29

draw

Draw - draw icons and things
Java
5
star
30

c-accordion

Automatically exported from code.google.com/p/accordion
C
5
star
31

oglaf

Oglaf
Kotlin
4
star
32

blog

Sources for my Hugo blog and home page.
HTML
4
star
33

cadec

Cadec simulator
C
4
star
34

ffts-android

Android fork of FFTS project
Shell
4
star
35

mkfilter

Mkfilter code from https://github.com/university-of-york/cs-www-users-fisher
C
3
star
36

sudoku-cam

Sudoku Camera
C++
3
star
37

tdr

Time Domain Reflectometer
Java
3
star
38

busapp

Flutter bus app
C++
3
star
39

pollen

Pollen UK - show UK pollen forecast
Java
2
star
40

stb

Sussex Tune Book
Awk
2
star
41

abc2ps

Updated version of abc2ps plus scripts
C
2
star
42

questionnaire

Hugo questionnaire generator
JavaScript
2
star
43

billthefarmer

2
star
44

c-melodeon

Automatically exported from code.google.com/p/melodeon
C
2
star
45

theme-hugo-foundation6

JavaScript
1
star
46

whatever-o-meter

Wordpress and Hugo plugin for creating a whatever-o-meter
JavaScript
1
star
47

location

Android location app
Java
1
star
48

flutter-oglaf

Oglaf app in flutter
Dart
1
star
49

anne

C++
1
star