Hearing Aid...
Hi folks yet another bizarre piece of code that is Apple OSX 10.12.x to at least 10.14.1 specific.
It requires only a default OSX install, and the internal microphone along with an external headphone assembly.
Pre-amble, 14-02-2019:
For over 3 weeks now I have been suffering a serious head cold and for the last 10 days serious hearing loss due to it.
This is supposedly temporary but it can be permanent, I won't know until March 7th when I am to see the doctor again.
The loss of hearing is so serious that it is around 30dB down in both ears. Sooooo this working idea was the result.
As I am nearly always on the terminal I decided to create a hearing aid using my enclosed, bin style, headphones without a microphone.
It is a simple shell script that calls an AppleScript to start QuickTime Player in standby Audio Recording mode.
Initialisng for the first time:
- 1) Copy the script onto your preferred location, I called it HA.sh.
- 2) Plug in the headphones and set up the audio from System Preferences.
- 3) Open up a terminal and
cd /path/to/your/preferred/location
for 'HA.sh'. - 4) Set its access to
chmod 755 HA.sh
. - 5) Start the script, something like
./HA.sh
- 6) Due to Apple's security you will probably be prompted to allow the terminal to access the microphone, just accept it.
- 7) The Audio Recording window will open and a dialog window will warn you to set the monitor volume to maximum.
- 8) The terminal will be in standby mode and can be exited if necessary.
- 9) Drop/minimise the Audio Recording window onto the 'DOCK' and leave, in standby mode.
- 10) This is super sensitive and you can alter the output from either the main volume or independently with the Recorder's own output level control.
- 11) Other inputs, like youtube still work and don't affect the Recorder at all.
- 12) When no longer needed close down the Recorder and QT in the normal GUI manner.
As I don't have access to hearing aids yet and I am on the computer a lot the this is a godsend.
It does have a slight delay from real time but it took me seconds to get used to it.
#!/bin/sh
# HA.sh
# Simple hearing aid for a default OSX 10.12.x and above install.
echo ""
echo "Starting hearing aid..."
echo "" > /tmp/Untitled.m4a
osascript << AppleSampler
tell application "QuickTime Player"
activate
set savePath to "Macintosh HD:tmp:Untitled.m4a"
set recording to new audio recording
set visible of front window to true
delay 1
display alert "Set the output level to maximum and use the master volume as the output level."
delay 1
end tell
AppleSampler
echo ""
echo "Close down the Terminal at any time; the recorder"
echo "and QT in the usual way when finished with..."
echo ""
exit
Enjoy hearing again...
Bazza.