Skip to content

Commit 4b9a7c9

Browse files
committed
Updated README.md
1 parent e9b9c79 commit 4b9a7c9

File tree

1 file changed

+67
-3
lines changed

1 file changed

+67
-3
lines changed

README.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,69 @@
1-
## Kotlin Multiplatform MIDI library
2-
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
1+
2+
## Kotlin Multiplatform SoundFont library
3+
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
34
[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
5+
>:warning: This library is NOT ready for production use.:warning:
6+
7+
Library for [sample-based synthesis](https://en.wikipedia.org/wiki/Sample-based_synthesis "Sample-based synthesis") to play [MIDI](https://en.wikipedia.org/wiki/MIDI "MIDI") files. The library is split in two modules:
8+
* **Midi module**: Allows to read and write standard MIDI files and parsing/encoding MIDI messages. Can generate F32 audio data from MIDI messages.
9+
* **SoundFont module**: Allows to load `.sf2` files from filesystem and from memory. Is basically a KMP wrapper around [TinySoundFont](https://github.com/schellingb/TinySoundFont) library.
10+
11+
The goal of this library is to allow operations on MIDI files and generating audio in Kotlin Multiplatform projects. The library has `batteries-included` so no configuration is required.
12+
13+
Non goals:
14+
* Audio file export (such as WAV or MP3)
15+
* Base File I/O operations
16+
* Audio format conversion
17+
* Resampling, mixing etc...
18+
19+
20+
Platform support:
21+
| Android |iOS | Mingw X64 | Linux X64 |
22+
|--|--|--|--|
23+
| :heavy_check_mark: | :hourglass: | :heavy_check_mark: | :heavy_check_mark: |
24+
25+
26+
27+
28+
___
29+
### Features
30+
This library is in early stage. Full set of features as well as documentation is yet to be released.
31+
32+
33+
34+
___
35+
### Installation
36+
>:warning: This library is not YET available on Maven Central :warning:
37+
> For now use the `msf.zip` file provided in [releases](https://github.com/lemcoder/MikroSoundFont/releases/) and unpack it in [local maven repository](https://www.baeldung.com/maven-local-repository).
38+
39+
To add library to Your project paste the following snippet in your TOML file.
40+
```
41+
[versions]
42+
mikrosoundfont = "<latest_version>"
43+
44+
[libraries]
45+
mikrosoundfont-midi = { module = "pl.lemanski.mikrosoundfont:midi", version.ref = "mikrosoundfont" }
46+
mikrosoundfont-soundFont = { module = "pl.lemanski.mikrosoundfont:soundFont", version.ref = "mikrosoundfont" }
47+
```
48+
___
49+
### Usage
50+
```
51+
val midiBuffer // .mid file bytes
52+
val sfBuffer // .sf2 file bytes
53+
54+
val midiMessages = MidiFileParser(midiBuffer).parse().getMessages()
55+
val soundFont = MikroSoundFont.load(sfBuffer)
56+
57+
val sampleRate = 44_100
58+
val audioBytes = MidiSequencer(soundFont, 44_100).apply {
59+
loadMidiEvents(midiMessages)
60+
}.generate()
61+
62+
// use audioBytes (e.g. write to .wav file)
63+
```
64+
65+
___
466

5-
Library for reading and writing MIDI files. Can also generate F32 sound data using [TinySoundFont](https://start.ktor.io)
67+
### Useful resources:
68+
* [Sandard MIDI files specification](https://drive.google.com/file/d/1t4jcCCKoi5HMi7YJ6skvZfKcefLhhOgU/view?u)
69+
* [Summary of MIDI messages](https://drive.google.com/file/d/1I-bH8zhfS37fnLzV-xnonOCYZycaGzbn/view)

0 commit comments

Comments
 (0)