Hi Spasm,
Yes, you can get it the number of output points down quite low.
But it will increase the complexity of the unit you have to build.
The circuit shown above is very simple and fairly easy to construct.
By using chips you can reduce each side of the matrix to binary form,
so you have two binary numbers, which refer to each side of the
matrixed keyboard.
These two are usually called the 'Rows' and the Columns'
Pressing a button would produce a response from a particular column
and a particular row.
As Bogdanfirst has already mentioned, using two 8 to 3 way
multiplexer chips is probably the best way if you want to use chips.
Use one chip for the columns and another for the rows.
This would give you a three bit output from each chip, plus a bit for
KP which means 'Key pressed' thats seven in all.
If you want to reduce the output points still further, you would be
getting into specialist areas, like chips to make a given voltage
and other chips to give binary output for given voltages, or chips
that respond to values of resistor placed across each button or some
such complex arrangement, or circuits that would give a certain
length of pulse - which is almost like a serial setup.
I will have a bit of a look around to see if i can find a suitable
8way to 3bit multiplexer chip.
That would allow you to expand your keyboard to eight rows & columns
which would cope with 64 buttons, but it would of course be fine
with the 40 you want.
Cheers, John