decreasing keypad pins

it's pretty much what the title says, i've like 5 pins left and i need 7 for 4x3 keypad

i know how it works with scanning that's why an encoder won't really work here, i've seen a solution where they use variable resistances on the columns with common cathode and the rows are common anode (or rows are cathode and columns are anode won't matter) but the noise and diodes sometimes lead to unexpected/unwanted/random outputs

so please lemme know other methods i may use for this to work thanks in-advance, sorry if it's wrong section but im still not familiar yet with the forums

Maybe there is a way you could use a ring counter for the rows, synchronizing the counter with the Arduino so when you see a change of state on a column, you could determine which row was being activated by the ring counter. Sounds difficult, but maybe doable if you're desperate.

Can you add a shift out register and a shift in register to your project?

Or you could use a decade counter for the rows, using only one output pin to advance the count. Lots of possibilities, using some type of shift register or counter.

Research shift register and counter ICs. Take your pick.

Here is info on a promising decade counter. Easy to use: http://www.doctronics.co.uk/4017.htm

Lots of keys (100 or more) using 3 pins http://forum.arduino.cc/index.php?topic=235438.0

This is the probably same or similar as the 4017 mentioned above.

Since you seem to understand multiplexing keys on a keypad, it looks like you are on your way. Good Luck.

Here’s my suggested way using 2 shift registers & 5 IO pins.
Replace SPI IO names with shiftOut() & shiftIn() names if you prefer slower scanning.
I’d also control SSO & SSI with direct port manipulation.
2 code choices shown; for loop will scan slower than in-line coding.

Do you have free analog pins ? You might be able to use 1 analog pin to register 12 keys, but you'll certainly be fine if you have 2 analog pins left. That means another approach and no matrix. It also means you can only press 2 buttons simultaneously (one of each analog pin), but you can't press multiple keys with a matrix either (well, you can press those buttons of course, but you can't read them correctly in that case).