Make some noise-cancelling headphones I am in desperate need of some ear defenders, so I can program in peace. Unfortunately, I don't have ear defenders. But I do have a pair of headphones, a microphone and a microcontroller, so I thought I'd make some noise-cancelling headphones.
However, there is one tiny problem. I can't program in noisy environments! So you'll need to write the code for me.
Task
Given a constant noisy input, output the input's &quot;complement&quot;; a value that will completely cancel out the input value (0x00 cancels 0xff, 0x7f cancels 0x80). Because the headphones block some noise, also take a value as input that you will divide the &quot;complement&quot; by, using the following algorithm: if (c &lt; 0x80) ceil ( 0x7f - ( (0x7f - c) / n ) ) else floor ( ( (c - 0x80) / n ) + 0x80 ) where c is the &quot;complement&quot; and n is the value to divide by. (If the value exceeds the byte range, it should be clipped to 0 or 255.)
The input will always be a sequence of bytes, via stdin or function parameter (see bonuses) but the modifier can be given via any input method. The output sequence should be output via stdout or as a return value (see bonuses). The output should be a series of bytes (e.g. $.d&lt;±3Ç/ó¢), or a set of numbers representing those bytes (e.g. 217 135 21 43 126 219).
Oh, and your code will have to be short, because there isn't much flash memory on the microcontroller (4096 bytes; and I need to fit on drivers too!).
Examples
In these examples, I have used hexadecimal codes to represent bytes, because DEL and NULL are somewhat hard to read. The actual input and output should be done as a string of bytes or as a byte-stream.
Modifier: 2
Input: 0x00 0x10 0xe0 ...
Output: 0xbf 0xb7 0x4f ...
Modifier: 128
Input: 0x00 0x10 0xe0 ...
Output: 0x80 0x80 0x7f ...
Modifier: 0.5
Input: 0x00 0x10 0xe0 ...
Output: 0xff 0xff 0x00 ...
Your code should cope with much longer inputs than this; these are just examples.
Bonuses
To add a bonus to a score, use the following formula: s * (100% - b) where s is the current score and b is the bonus as a percentage.

1% If you output as raw bytes.
5% If there's no stdin pipe (or byte input), get the bytes straight from the microphone, such as with parec.
5% If you output to the speakers as well as returning / outputting to stdout.
Pyth, 54 51 bytes
J128m.MZ,0h.mb,255?&lt;dJ.E-tJc-tJdQs+c-dJQJm-255id16E

Try it here!
Explanation

J128m.MZ,0h.mb,255?&lt;dJ.E-tJc-tJdQs+c-dJQJm-255id16E   # Q = modifier, E = input list

J128                                                  # set J to 128
                                         m        E   # map each input d
                                              id16    # convert to decimal
                                          -255        # get the complement
    m                                                 # map each complement d
                  ?&lt;dj                                # if d &lt; 128
                      .E-tJc-tJdQ                     # use the ceil-formula
                                 s+c-dJQJ             # otherwise use the floor-formular
          .mb,255                                     # minimum of the result and 255
    .MZ,0h                                            # maximum of the result and 0