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

Explore 00 00 80 3f #25

Closed
featherbear opened this issue Aug 20, 2022 · 2 comments
Closed

Explore 00 00 80 3f #25

featherbear opened this issue Aug 20, 2022 · 2 comments

Comments

@featherbear
Copy link
Owner

See https://en.wikipedia.org/wiki/Single-precision_floating-point_format

image

Affects PV values, and affects the below code

decode(bytes: Buffer | number) {
let temp: Buffer
if (!Buffer.isBuffer(bytes)) {
const buff = Buffer.allocUnsafe(4)
buff.writeUInt32BE(bytes) // TODO: Should this be LE?
temp = buff
} else {
temp = bytes
}
if (temp.equals(new Uint8Array([0x00, 0x00, 0x80, 0x3f]))) {
return true
} else if (temp.equals(new Uint8Array([0x00, 0x00, 0x00, 0x00]))) {
return false
}
return bytes
}
}

@featherbear
Copy link
Owner Author

float32 LE makes sense for pan

@featherbear
Copy link
Owner Author

float32 LE makes sense for analogue gain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant