Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSF Driver: instrument compression #333

Open
Gumball2415 opened this issue Jan 26, 2025 · 0 comments
Open

NSF Driver: instrument compression #333

Gumball2415 opened this issue Jan 26, 2025 · 0 comments
Labels
enhancement New feature or request nsf-driver sound engine used in NSF/assembly file export

Comments

@Gumball2415
Copy link
Collaborator

Gumball2415 commented Jan 26, 2025

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.

@Gumball2415 Gumball2415 added enhancement New feature or request nsf-driver sound engine used in NSF/assembly file export labels Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nsf-driver sound engine used in NSF/assembly file export
Projects
None yet
Development

No branches or pull requests

1 participant