GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - vampirefrog/libfmvoice: C library for loading, saving and converting FM sound chip voice files in various formats

BranchesTags
Open more actions menu

Latest commit

 

History

122 Commits
122 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
ansidecl.h
ansidecl.h
 
 
bnk_file.c
bnk_file.c
 
 
bnk_file.h
bnk_file.h
 
 
bnkdump.c
bnkdump.c
 
 
dmp_file.c
dmp_file.c
 
 
dmp_file.h
dmp_file.h
 
 
dmpdump.c
dmpdump.c
 
 
dx21dump.c
dx21dump.c
 
 
fb01dump.c
fb01dump.c
 
 
fb01spam.c
fb01spam.c
 
 
fm_voice_bank.c
fm_voice_bank.c
 
 
fm_voice_bank.h
fm_voice_bank.h
 
 
fmbankdump.c
fmbankdump.c
 
 
ins_file.c
ins_file.c
 
 
ins_file.h
ins_file.h
 
 
insdump.c
insdump.c
 
 
libfmvoice.sublime-project
libfmvoice.sublime-project
 
 
loader.c
loader.c
 
 
loader.h
loader.h
 
 
md5.c
md5.c
 
 
md5.h
md5.h
 
 
op3_file.c
op3_file.c
 
 
op3_file.h
op3_file.h
 
 
op3dump.c
op3dump.c
 
 
opl_voice.c
opl_voice.c
 
 
opl_voice.h
opl_voice.h
 
 
opm_file.c
opm_file.c
 
 
opm_file.h
opm_file.h
 
 
opm_voice.c
opm_voice.c
 
 
opm_voice.h
opm_voice.h
 
 
opmdump.c
opmdump.c
 
 
opn_voice.c
opn_voice.c
 
 
opn_voice.h
opn_voice.h
 
 
platform.h
platform.h
 
 
sbi_file.c
sbi_file.c
 
 
sbi_file.h
sbi_file.h
 
 
sbidump.c
sbidump.c
 
 
syx_dx21.c
syx_dx21.c
 
 
syx_dx21.h
syx_dx21.h
 
 
syx_fb01.c
syx_fb01.c
 
 
syx_fb01.h
syx_fb01.h
 
 
tfi_file.c
tfi_file.c
 
 
tfi_file.h
tfi_file.h
 
 
tfidump.c
tfidump.c
 
 
tools.c
tools.c
 
 
tools.h
tools.h
 
 
y12_file.c
y12_file.c
 
 
y12_file.h
y12_file.h
 
 
y12dump.c
y12dump.c
 
 

Repository files navigation

FM voice loading, saving and conversion library

Project status

Linux Build

Code for loading and saving various FM voice formats meant for the Yamaha YM series of chips (OPL, OPM, OPN etc.), format autodetection code, and conversion between the various formats.

This library is meant to be used in fmtoy and vgm2x.

File Formats

Format Type Op Max voices
INS OPN 4 1
DMP OPN 4 1
OPM OPM 4 unlimited
TFI OPN 4 1
Y12 OPN 4 1
SBI OPL 2 1
INS OPL 2 1
BNK OPL 2 65536
IBK OPL 2 128
CMF OPL 2 128/256/65536

Structures

OPL

FieldBitDescription
76543210
ch_fb_cnt[0] D C B A FB CNT Channel mask, feedback, connection
dam_dvb_ryt_bd_sd_tom_tc_hh AM VIB RYT BD SD TOM TC HH
am_vib_eg_ksr_mul AM VIB EGT KSR MUL
ksl_tl KSL TL
ar_dr AR DR
sl_rr SL RR
ws WS Waveform select

Conversion

Conversion between OPL, OPM and OPN voices is only possible in some cases, in other cases it involves approximation, and in others it is not possible.

OPM files

Reading:

uint8_t *data; // Have your data in this buffer
size_t data_len; // with this length
struct opm_file opm;
int r = opm_file_load(&opm, data, data_len);
if(r != OPM_FILE_SUCCESS) {
	fprintf(stderr, "Could not load file: %s (%d)\n", opm_file_error_string(r), r);
	exit(1);
}

Writing:

size_t write_fn(void *buf, size_t bufsize, void *data_ptr) {
	FILE *f = (FILE *)data_ptr;
	return fwrite(buf, 1, bufsize, f);
}

struct opm_file opm;
opm_file_init(&opm);

FILE *f = fopen("out.opm", "w");
int opm_file_save(&opm, write_fn, f);
fclose(f);

Building with emscripten

emmake make libfmvoice.a

Formulae

OPM LFO

$f_{LFO} = \frac{f_{master}}{(8 \times (256 - R))}$

OPN LFO

$f_{LFO} = \frac{f_{master}}{2^{LFO\_DIV} \times (108 - LFO\_FREQ)}$

About

C library for loading, saving and converting FM sound chip voice files in various formats

Topics

bnkdmpdx21fb01fmfrequency-modulationinstrumentop3operatoroplopmopnopzsbisynthesissysexsyxvoicey12

Resources

Readme
GPL-3.0 license
Activity

Stars

9 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.