NES Sound file
application/octet-stream
Magic Bytes
Offset: 0
4E 49 54 46 30
The NES Sound file (NSF) is a legacy audio data format developed by Kevin Horton for storing music and sound effects extracted from Nintendo Entertainment System ROMs. It is primarily used by developers, musicians, and retro gaming enthusiasts to play back 8-bit chip tunes through dedicated emulators or hardware-compatible plugins. Because the format contains 6502 machine code designed for the NES CPU, it is considered safe for modern operating systems but requires specialized interpretation to function correctly.
Validation Code
How to validate .nsf files in Python
Python
def is_nsf(file_path: str) -> bool:
"""Check if file is a valid NSF by magic bytes."""
signature = bytes([0x4E, 0x49, 0x54, 0x46, 0x30])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .nsf files in Node.js
Node.js
function isNSF(buffer: Buffer): boolean {
const signature = Buffer.from([0x4E, 0x49, 0x54, 0x46, 0x30]);
return buffer.subarray(0, 5).equals(signature);
}
Go
func IsNSF(data []byte) bool {
signature := []byte{0x4E, 0x49, 0x54, 0x46, 0x30}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
GET
/api/v1/nsf
curl https://filesignature.org/api/v1/nsf