Glk sound volume

Is sound volume in Glk on a logarithmic scale (like decibels), or linear? I seem to recall someone saying the former at one point, but doe’s infglk summary implies the latter. The glk spec doesn’t seem to say one way or the other, which would also tend to imply that the scale is linear.


The infglk summary? Doesn’t that just give the argument name?

The spec says:

“Mathematically, these volume changes should be taken as linear multiplication of a waveform represented as linear samples. As I understand it, linear PCM encodes the sound pressure, and therefore a volume of 0x8000 should represent a 6 dB drop.”

Thanks for the quote from the spec, my powers of skim were obviously running slim. It’s actually Doe’s Infglk Reference I’m referring to, with a filename of summary.txt. Here’s how it presents volume:

[code] Sound
glk_schannel_set_volume chan vol

Purpose: Sets volume of given sound channel
Takes effect immediately
Parameters: chan = channel
vol = decimal/hexadecimal number of volume
starts at full volume 65536 ($10000)
three quarters volume = 49152 ($C000)
half volume = 32768 ($8000)
Returns: 1 = success, 0 = failure

Example: result = glk_schannel_set_volume(gg_mychan, $C000);[/code]

Full, half, three quarters implies a linear scale. Unfortunately, the document is not pristine, there are errors and oversights…

Anyway, thanks. That answers my question.

Ah, yeah, I think I said “half volume” like that in the spec too. Anyhow, the comment is supposed to clear that up.