Try toggling the F-key functionality in System Prefs > Keyboard > Keyboard
If your generic keyboard has no Mac-compliant Fn key, it may be your only solution. The hardware keys don't transmit in the same way as 'regular' keys.
This script works for Yosemite, but not El Capitan…
set myVolume to get volume settings
if output muted of myVolume is false then
set volume with output muted
set volume without output muted
An additional possibility could be to switch to another Sound output, one that is currently silenced, like, for example, Digital Out.
From Using Apple Script to Manage Sound Output Selection
You could save this as a Service in Automator, then call it with a hot-key
Applescript to toggle between two sound outputs by Line number, ¬
as they appear in the Sound Control Panel. Based on code by ¬
Arthur Hammer https://apple.stackexchange.com/a/209434/85275
set outputA to 3 --change this to the actual 'line number' of your first desired output
set outputB to 4 --change this to the actual 'line number' of your second desired output
--the rest of the script will use these vales as a switch
tell application "System Preferences"
set current pane to pane "com.apple.preference.sound"
tell application "System Events"
tell application process "System Preferences"
repeat until exists tab group 1 of window "Sound"
tell tab group 1 of window "Sound"
click radio button "Output"
if (selected of row outputA of table 1 of scroll area 1) then
set selected of row outputB of table 1 of scroll area 1 to true
set selected of row outputA of table 1 of scroll area 1 to true
--tell application "System Preferences" to quit
--remove the comment '--' tag above to make the control panel quit afterwards, leave for testing.