Skip to content

NSF Driver: instrument compression #333

@Gumball2415

Description

@Gumball2415

currently, instruments and sequences have to be stored in a single bank shared with the NSF driver. this causes issues with instrument data overflow, where the instrument data cannot fit within the shared bank. this issue is further exacerbated when the NSF driver increases in size, further reducing the instrument data capacity of the fixed bank.

as a proposed fix before bhop integration, instrument data can be redefined to add banking definitions, similar to song definitions.

given an instrument, for instance:

; 2A03 instrument
ft_inst_0:
	.byte 0
	.byte $11
	.word ft_seq_2a03_0
	.word ft_seq_2a03_4

; FDS instrument
ft_inst_1:
	.byte 7
	.byte $01
	.word ft_seq_fds_5
	.byte $3C
	.byte $3F
	.byte $3F
	.byte $07
	.byte $00
	.byte $09
	.byte $09
	.byte $09
	.byte $0C
	.byte $09
	.byte $09
	.byte $01
	.byte $00
	.byte $3F
	.byte $3F
	.byte $3F
	.byte $00
	.byte $3F
	.word $0000
	.byte $00

; N163 instrument
ft_inst_2:
	.byte 9
	.byte $01
	.word ft_seq_n163_0
	.byte $10
	.byte $00
	.word ft_waves_2

we may add bank numbers to each sequence reference, N163 wavetable, or FDS modulation/wave tables.

; 2A03 instrument
ft_inst_0:
	.byte 0
	.byte $11
	.word ft_seq_2a03_0
	.byte <.bank(ft_seq_2a03_0)
	.word ft_seq_2a03_4
	.byte <.bank(ft_seq_2a03_4)

; FDS instrument
ft_inst_1:
	.byte 7
	.byte $01
	.word ft_seq_fds_5
	.byte <.bank(ft_seq_fds_5)
	.word ft_mod_fds_0
	.byte <.bank(ft_mod_fds_0)
	.word ft_wave_fds_0
	.byte <.bank(ft_wave_fds_0)
	.byte $00
	.byte $3F
	.word $0000

; N163 instrument
ft_inst_2:
	.byte 9
	.byte $01
	.word ft_seq_n163_0
	.byte <.bank(ft_seq_n163_0)
	.byte $10
	.byte $00
	.word ft_wave_n163_2
	.byte <.bank(ft_wave_n163_2)

to save space, FDS instruments may define their modulation tables and waveforms as a reference to a label instead of hardcoding it into the instrument definition. this also helps with data deduplication as FDS instruments can share modtable and waveform data.

VRC7 instruments may store custom patch information as a reference to a label instead of hardcoding it into the instrument definitions to further save space on the fixed bank.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestnsf-driversound engine used in NSF/assembly file export

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions