SHENZHEN I/O

SHENZHEN I/O

Not enough ratings
LOUDSPEAKER W/ VOLUME CONTROL
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
2.756 KB
3 Dec, 2016 @ 6:44am
1 Change Note ( view )

Subscribe to download
LOUDSPEAKER W/ VOLUME CONTROL

Description
Relay audio waves from the audio jack to the speaker, taking volume into account.

----------------------------------------------------------------------------------------------------
  • source is a simple input connected to an audio jack.
  • volume is a simple input connected to a volume dial.
  • sink is a simple output connected to a loudspeaker.
  • Copy the audio signal from source to sink, adjusting for the volume.
  • The audio signal is a wave; values over 50 are "positive", values under 50 are "negative".
  • The maximal volume setting (100%) does not change the wave.
    The minimal setting (0%) silences the sound, so the output is always 50.
    The lower the volume, the weaker (closer to 50) the signal.
  • Generally, the output can be calculated with this formula:
    sink = ⟦ (source − 50) × (volume / 100) ⟧ + 50
  • Square brackets denote truncation — dropping the fractional part of the number
    (equivalent to floor for positive numbers and ceiling for negative numbers).

Author's solution: ¥11 / 1740 / 29

Check out my other puzzles!
4 Comments
cirdec 2 May, 2020 @ 9:37am 
This is a good, hard, tricky puzzle.
csaboka 19 Dec, 2016 @ 12:36pm 
Nice! It was a challenge for me to come up with a 11 Yuan solution. (Of course it's obvious in hindsight, like most of the puzzles.)
ICANTEVENLOVE 9 Dec, 2016 @ 3:22am 
Bad
llango 7 Dec, 2016 @ 3:40am 
Great!!