Audio Recorder / Player and audio settings in the MKT-View

This document describes how to the terminal's optional audio recorder, and how to control the recorder (or 'wave audio player') from your own application.

Note: Only a few terminals support this optional function - see Feature Matrix : "Audio recorder") !
This feature must be unlocked (by the manufacturer, or via password) before using it permanently.
In some devices, the audio in- and output may work in 'demo mode' for a while when not unlocked.

Contents
  1. Audio settings and signal paths in the MKT-View III / IV
  2. The Audio Recorder Control Panel
  3. Controlling the audio recorder through interpreter commands
  4. Audio file format

See also:

Audio settings and signal paths in the MKT-View III / IV

There are several audio control settings in the device's system setup, and a few commands to modify those settings 'on the fly' through the script language shown below in a simplified diagram of the audio signal paths:

The "beeper" / "buzzer" shown in the upper part is a simple transducer that can only be turned on/off via a simple transistor, but with variable frequencies and PWM duty cycles. It is typically used to generate touchscreen "clicks", but can also be controlled via script to generate simple warning tones. See script commands system.beep and system.play_notes. Because for some users of the MKT-View III, the loudness of the "beeper" was insufficient, an optional signal path was added between the internal "beeper" and the more powerful "speaker". Thus, depending on the "beeper to speaker" volume setting, the beeper volume may appear to be controllable via command system.audio_vol in fine increments, but in reality system.audio_vol only controls voltage delivered to the audio PA (power amplifier for the internal loudspeaker).
The signal from the wave audio player always enters a digital/analog converter, before passing through a gain control stage (controlled by system.audio_vol of the 'Speaker Volume' in the system setup).
The signal from the built-in microphone first passes another gain control stage (controlled by system.mic_vol or "Microphone Volume" in the system setup) before it enters an analog/digital converter. The converter's output can be sampled and recorded as a wave file (more on that later in this document), or be fed like an 'analog input' to the Data Acquisition Unit (DAQ) for further processing.


The Audio Recorder Control Panel

The audio recorder control panel shows (from top to bottom, and left to right):


(screenshot of the AR control panel while recording)

The background of the RECORD button turns lightred while recording, the PLAY button is green during playback. As with other windowed controls, the currently focused button is marked with a blue frame (which means, if you press the ENTER key, the button's function will be executed). To select a button, use the rotary encoder, or -if the terminal has a touchscreen- touch it to execute the desired function.

The peak level indicator should be green to yellow while recording. Blue means "audio level too low", red means "audio level too high" .

The audio recorder can be opened through the terminal's system menu, but usually, you will provide an easy access to the recorder in your terminal application. For example, put a programmable button in your application to open the audio recorder (using the command audio.show(1) as explained in the next chapter).

Your application can also open the audio recorder automatically, for example after (or before) writing a CAN logfile, so the operator can save a short note about the test like "strange noise from the gearbox" . Using the same name as the CAN logfile (but a different extension) for the voice audio file makes it easy to associate the voice recording and the CAN signal recording later.

Interpreter commands (and -functions) for the audio recorder

The following interpreter commands can be used to control the audio recorder from your UPT application:

audio.show(1)
opens the audio recorder control panel
audio.show(0)
hides the audio recorder control panel
audio.play("filename.wav")
starts playing the specified audio file. Caution: The maximum length of the filename is 8 characters, and the extension must always be "wav" because this is the only audio format supported by the player.
If no path is specified (as in the above example), the firmware looks for the audio file in the following places (depending on the hardware):
  1. On the memory card, i.e. in the pseudo-folder "memory_card"
  2. In the 'audio FLASH', i.e. in the pseudo-folder "audio_flash",
    which may physically be the same storage medium as the 'FONT'-Flash (!).
This way, the 'audio_flash' (alias 'font_flash' in some cases) can be used as a 'fallback' if there is no memory card is inserted in the card slot.
More details about the pseudo-file system, which is used in most of the programmable displays, can be found here.
Notes:
audio.play
plays the current audio file again (without changing the name).
This command has the same effect as clicking the "PLAY"-button on the audio recorder control panel.
audio.record("filename.wav")
starts recording the specified audio file. The maximum length of the filename is 8 characters, plus three for the extension ("wav"). In fact, the file extension will automagically be replaced by ".wav". For example, this makes it possible to record a wave file matching the currently used CAN-LOGGER-FILENAME : audio.record( logger.file ) .
audio.record
starts recording, using the current name of the audio file .
This command has the same effect as clicking the "REC"-button on the audio recorder control panel.
audio.stop
Stops playing or recording. Same  effect as clicking the "STOP"-button on the control panel.

The following interpreter functions can be used to query the status of the audio recorder in your application:

audio.playing
This flag is 1 (one = TRUE) if the audio recorder is playing something at the moment, otherwise 0 (zero = FALSE).
audio.recording
This flag is 1 (one = TRUE) if the audio recorder is recording something at the moment, otherwise 0 (zero = FALSE).
audio.fname
This string function returns the name of the currently played (or recorded) audio file, for example "test.wav" .
audio.visible
This functions returns 1 (one = TRUE) if the audio recorder control panel is visible, otherwise 0 (zero = FALSE).
audio.vpeak
Returns the momentary peak audio voltage, ranging from 0 (silence) to 100 (clipping level).

Audio File Format and location of the audio files

At the time of this writing (2022), the audio recorder only supported uncompressed wave files with 8 or 16 bits per sample, monophone, and 8000, 11025, or 16000 samples per second. The file header consists of a standard "RIFF WAVE" header, including format chunk and sound data chunk, but nothing else. Only a few devices with a dedicated audio codec (hardware) support recording higher at sampling rates and/or more bits per sample.

While recording, the sampling rate is set to 11025 samples / second . A one-minute wave file will be approximately 645 KByte long . About 6 hours of "voice" can be recorded on a 256 MByte memory card. Writing or reading MP3 audio files impossible for several reasons.  So don't make your recordings longer than necessary.

For replay, sampling rates can be at least 8000, 11025, or 16000 samples / second.

If an audio file shall be played from the memory card in the terminal, it must be located in the memory card's root directory. Alternatively (for some devices), audio files may also be saved in a special onboard FLASH device. You can use the File Transfer Utility to load files into that FLASH area.
If an audio file shall be played in the simulator (i.e. for testing, in the programming tool), the wave file must be located in the 'Audio File' directory, which can be specified on the tool's 'Settings' tab on the panel titled 'Directories'. The simulator will play back recorded audio files using the default soundcard.

The installation package contains a few, small audio samples in the default 'audio' subdirectory, and a simple test application ("audio_t.cvt") which plays these samples when pressing a certain key.


Screenshot from application 'audio_t.cvt'.
Guess what/where to press to play which audio file !


File: ..?..\uptwin1\help\audio_01.htm
Author: W.Büscher, MKT Systemtechnik
Last modified: 2022-04-05 (ISO8601, YYYY-MM-DD)

back to top