TK-Talkie Configuration Files (V4)

The configuration files are used by TK-Talkie in order to provide the ability to highly customize your setup and profiles. They are stored on a micro-SD card that is used by the TK-Talkie.

YOU ARE FREE TO USE THIS CODE IN YOUR OWN PROJECTS, PROVIDED THEY ARE FOR PERSONAL, NON-COMMERCIAL USE.


Editing Configuration Files

There are 3 ways to edit configuration files:

  1. Via the mobile app - Use the mobile app to manage your configuration profiles.
  2. Edit via serial interface - With this option, you connect your TK-Talkie to your computer via the USB port and use a serial interface to issue commands and edit configuration settings.
  3. Edit files via text editor - With this option, you can edit the files by putting the SD card in your computer and editing the files with a text editor. Please see the Configuration Values section for a list of available options.
You must power down the TK-Talkie when removing or inserting the SD card in order to avoid damage to the card.

Startup Settings File

The file CONFIG.TXT is located in the root directory of the SD card and is the main control file. This file holds global configuration settings for your TK-Talkie including the default user profile to load when starting up. It has the following entries:

{
  "profile": "DEFAULT.TXT",
  "access_code": "1138",
  "profiles": "/profiles/",
  "debug": true,
  "echo": true,
  "input": "mic",
  "buttons": [
    2,
    3,
    4,
    0,
    0,
    0
  ]
}

profile     - The default profile to load on startup
access_code - Alphanumeric access code for the device that is needed to allow mobile app to connect.
profiles    - This is the folder on the SD card that holds the different profiles.
input       - Valid values are "mic" or "linein."  If you are using "linein" be sure you have wired up a line-in jack.
              This tells TK-Talkie which input method (for microphone) you are using.  Set to MIC by default.
debug       - Turns debugging on (1/true) or off (0/false) for the unit. Default is off (0 or false.)
              When on, messages during program operation will be displayed to the serial interface.
              This can be useful when testing configuration settings.
echo        - Turns on BLE debugging.  Values are 0 (off) or 1 (on.)
buttons     - List of physical button pins (This will be set for you if you purchased your TK-Talkie through us.)
              NOTE: There should ALWAYS be 6 pins listed.  Any pins not in use will have a value of 0 (zero.)

PTT and Sleep/Wake Buttons

By default, button 2 is used for PTT (Push-To-Talk) and Sleep/Wake functions. The Sleep/Wake functions will only work with digital pins on the Teensy board (well, sleep will wake on analog pins, but the wake function will not...)

The available digital pins (the audio adaptor takes up some pins...) are 2, 4, 16, 21, 26, 30, and 33.

Configuration (Profile) Files

You can have multiple profile configuration files. These are stored in the /profiles/ folder by default on the SD card (you can change this by editing your CONFIG.TXT file.) The CONFIG.TXT holds the default profile to load at system startup. You can easily swap profiles via the serial interface or mobile app.

Profile files have a .TXT file extension and have the following format for configuration values:

{
    "name": "Sample Profile",
    "volume": {
        "master": "0.5500",
        "microphone": "6",
        "linein": "5",
        "lineout": "29"
    },
    "sounds": {
        "dir": "/sounds/",
        "start": "FSTARTAU.WAV",
        "button": "CLICK3.WAV",
        "buttonOff": "*",
        "voiceOff": "*"
    },
    "loop": {
        "dir": "/loops/",
        "file": "TKLOOP.WAV",
        "gain": "0.1400",
        "mute": 0
    },
    "voice": {
        "volume": "3.1000",
        "dry": 0,
        "start": "0.030",
        "stop": "0.021",
        "wait": "350"
    },
    "effects": {
        "dir": "/effects/",
        "volume": "1",
        "highpass": "0",
        "bitcrusher": {
            "bits": "16",
            "rate": "22050"
        },
        "chorus": {
            "voices": 1,
            "delay": 1,
            "enabled": 0
        },
        "flanger": {
            "delay": 1,
            "offset": 1,
            "depth": 1,
            "freq": 0.0625,
            "enabled": 0
        },
        "shifter": {
            "length": 512,
            "speed": 175,
            "range": 5,
            "enabled": 0
        },
        "noise": "0.1500",
        "mute": 0
    },
    "eq": {
        "active": 1
        "bands": [
            "-0.10",
            "-1.00",
            "-0.10",
            "-1.00",
            "-1.00"
        ],
    },
    "sleep": {
        "timer": "0",
        "file": "FSLEEPAU.WAV"
    },
    "glove": {
        "dir": "/glove/",
        "buttons": [
            [
                "1",
                "0"
            ],
            [
                "0",
                "0"
            ],
            [
                "0",
                "0"
            ],
            [
                "0",
                "0"
            ],
            [
                "0",
                "0"
            ],
            [
                "0",
                "0"
            ]
        ]
    }
}

Profile Name

This is the display name of the profile (not the file name.)

"name": "Sample Profile"

Sounds Files and Locations

Each profile specifies the directories where the sound files to be used for that profile are located. This allows you to either separate or share sounds between profiles. By default, the directories are:

Sounds Directory

"sounds": {
        "dir": "/sounds/",
        ... // rest of settings
}

This directory holds the startup and sleep sounds that can be played. It can be shared across profiles since only a single startup sound is played and you can choose which sound to play in your configuration profile.

Loop Directory

"loop": {
        "dir": "/loops/",
        ... // reset of settings
}

This holds the background loops. Again, this can be shared since only one loop file is played and you can choose which file is used.

Effects Directory

"effects": {
        "dir": "/effects/",
        ... // rest of settings
}

This directory holds the sounds (mic pops and clicks) that are played whenever you stop talking. Although this directory can be shared, if you are using TK-Talkie for other costumes (such as a Clone Trooper, for example, which does not use the mic pops) you can specify a different directory, leave it blank, or use the "Mute Effects" setting to prevent your TK-Talkie from playing sound effects after you stop talking.


Configuration Sections

The configuration file is broken up into sections (where like functionality is grouped together) to make it easier to manage. The sections are explained in more detail below.

Volume

"volume": {
    "master": "0.5500",
    "microphone": "6",
    "linein": "5",
    "lineout": "29"
}

master     - Speaker output volume. Valid range is 0 to 1, but after .7 you may experience distortion.
microphone - This is the microphone gain.  Valid values from 0 to 25.
linein     - (Deprecated)  For older units that have a line-in jack (you can only use microphone or line-in, but not both.)
             Valid values are 0 to 15.
lineout    - Gain for the line-out jack. You can use both the speaker and line-out jacks simultaneously. Valid values are 0 to 18.

Sounds

"sounds": {
    "dir": "/sounds/",
    "start": "FSTARTAU.WAV",
    "button": "CLICK3.WAV",
    "buttonOff": "*",
    "voiceOff": "*"
}

dir       - The location of the sound files on the SD card for this profile.
start     - The startup sound that is played when the profile is loaded.
button    - The sound to make when the PTT button is pressed (* = random or specify a file. Blank for none.)
buttonOff - The sound to make when the PTT button is released (* = random or specify a file. Blank for none.)
voiceOff  - The sound to make when you stop talking in VA (Voice Activation) mode (* = random or specify a file. Blank for none.)

Loop

A background loop can play while the unit is one and will restart once it finishes. You can also set it to mute while you are talking.

"loop": {
    "dir": "/loops/",
    "file": "TKLOOP.WAV",
    "gain": "0.1400",
    "mute": 0
}

dir  - The location of the loop files on the SD card for this profile.
file - The background loop file to play.
gain - The volume level of the loop file.
mute - Mute the background loop while talking (1 = yes, 0, = no)

Voice

TK-Talkie has two voice channels, one with voice effects applied and one without. This allows you to mix the voice signals for desired effect.

"voice": {
    "volume": "3.1000",
    "dry": 0,
    "start": "0.030",
    "stop": "0.021",
    "wait": "350"
}

volume - Voice volume.  This is the voice channel that has the voice effects applied.
         Valid values are any decimal value from 0 to 10.
dry    - Dry voice volume.  This voice channel does not have voice effects applied.
         Valid values are any decimal value from 0 to 10.
start  - The volume level at which the VA (Voice Activation) mode is triggered when you start talking.
         Lower settings are more sensitive, higher settings are less senstive.
         Valid values are any decimal value between 0 and 1.
stop   - The volume level your voice must reach before the microphone is turned off in VA mode.
         Valid values are any decimal value between 0 and 1.
wait   - The number of millisends to wait before playing a sound effect after you stop talking.

Voice Effects

The voice effects section has several sub-sections (one for each voice effect.)

Effects

"effects": {
    "dir": "/effects/",
    "volume": "1",
    "highpass": "0"
    ... // reset of settings
    "noise": "0.1500",
    "mute": 0
}

dir      - The location on the SD card for the sound effects for this profile.
volume   - The volume level for sound effects played after you stop speaking or the PTT button is pressed/released.
           Valid values are 0 to 10.
highpass - (Deprecated) Filters out higher frequencies. 0 = Off, 1 = On
noise    - The white noise level played behind the voice when speaking.
           Valid values are decimals values from 0 to 1.
mute     - Mute effects before and after talking (this prevents the mic pops and clicks, for example.) 0 = Off, 1 = On.

Bitcrusher

The bitcrusher digitizes the voice signal to help achieve that "trooper" voice.

"bitcrusher": {
    "bits": "16",
    "rate": "22050"
}

bits - Valid values are 1 to 16
rate - Valid values are 1 to 44100 (set to 16 bits, rate 44100 to bypass)

Chorus

The chorus adds voice layers and can also help create a tinny robot sounds, or a more "boxy" type of sound.

"chorus": {
    "voices": 1,
    "delay": 1,
    "enabled": 0
}

voices  - The number of voice layers. Valid values are 1 to 10.
delay   - (In blocks) Valid values are 1 to 32 blocks.
enabled - 0 = Off, 1 = On

Flanger

The flanger adds a delay/wave affect to the voice. You can have a long offset to make a longer wave pattern, or smaller values make for faster waves and a more "rippling" effect.

"flanger": {
    "delay": 1,
    "offset": 1,
    "depth": 1,
    "freq": 0.0625,
    "enabled": 0
}

delay   - Valid values are 1 to 32.
offset  - Valid values are 1 to 10.
depth   - Valid values are 1 to 32.
freq    - Valid values are decimal values from 0 to 1.
enabled - 0 = Off, 1 = On

Voice Shifter

The voice shifter changes the pitch of your voice. You can try different combinations of range and speed. The higher the range, the higher the speed will have to be to make a high-pitched voice. The lower the range, the quicker you can reach a high-pitched (and conversely low-pitched) voice.

"shifter": {
    "length": 512,
    "speed": 175,
    "range": 5,
    "enabled": 0
}

length  - Valid values are 0 to 1023
speed   - Valid values are 0 to 1023
range   - Valid values are decimal values from 0 to 10
enabled - 0 = Off, 1 = On

EQ

TK-Talkie comes with a 5-band equalizer to help you dial-in your sound.

"eq": {
    "active": 1
    "bands": [
        "-0.10",
        "-1.00",
        "-0.10",
        "-1.00",
        "-1.00"
    ],
}

active - 0 = Off, 1 = On
bands  - Valid values are -1.00 to 1.00 for each band.

Sleep

You can configure your TK-Talkie to automatically go to sleep after a specified time of no activity.

To wake your TK-Talkie, you'll either need to have a button configured as a Sleep/Wake button or recyle the power.

"sleep": {
    "timer": "0",
    "file": "FSLEEPAU.WAV"
}

timer - Time (in minutes) of no activity before going to sleep.  0 = Off.
file  - File to play before going to sleep.

Glove

You can have up to 6 (six) physical buttons connected to your TK-Talkie, and each button can have up to two funcions.

Press quickly for the first function, and hold the press a little longer for the secondary function.

Some functions, such as PTT/Sleep/Wake take up the whole button.

"glove": {
    "dir": "/glove/",
    "buttons": [
        [
            "1",
            "0"
        ],
        [
            "2,SOUND1.WAV",
            "2,SOUND2.WAV"
        ],
        [
            "0",
            "0"
        ],
        [
            "0",
            "0"
        ],
        [
            "0",
            "0"
        ],
        [
            "0",
            "0"
        ]
    ]
}

dir     - The location of the glove sound files for this profile.
buttons - Holds a list of the configured buttons for the profile.

Serial Interface

As in version 3, this version of the sofware allows you to change configuration settings, save configuration files and load configuration files via a serial interface. The Arduino IDE has a built-in serial monitor that can be used for this, or you can connect via a terminal program at 57600 baud.

Making Configuration Changes via Serial Interface

You can make live, real-time changes via the serial interface. Changes take effect immediately. They will be LOST when the device restarts unless you save them using one of the '*save*' commands. When making live changes, use the following format:

    setting_key=new_value [ENTER]

The new setting will take effect immediately. This is a great way to allow you to tweak and test settings for your particular application of the TKTalkie system. Please see the **Configuration Values** section for a list of available options.

When done editing settings, you will need to save them:

    save=SAMPLE (where SAMPLE is the name of your profile)

When connected, the following commands are available:

COMMANDS
--------
help                  Show this help screen.
ls                    List contents of SD card.
files                 Show a list of files on SD card.
profiles              Show a list of available profiles on SD card.
effects               Show directory listing of effects folder.
sounds                Show directory listing of sounds folder.
loops                 Show directory listing of sounds folder.
settings              Show current settings.
config                Displays the startup (system) settings
beep=n                Play warning beep sound n times
mute                  Mute all sounds
unmute                Unmute all sounds
reset                 Resets the TKTalkie unit
glove                 List current glove sound files
sleep                 Put TK-Talkie in sleep mode
mem                   Display current memory usage
berp                  Play connect sound
calibrate             Runs microphone calibration wizard

For the following commands, a file extension of .TXT (for settings files) or
.WAV (for sound files) is assumed and will be added if not specified.

FILES
-----
load                  Load settings from specified file
save                  Save current settings to specified file
delete                Delete a settings file
backup                Quick backup of settings file to SETTINGS.BAK
restore               Quick restore from SETTINGS.BAK
show                  Show the specified file

SOUNDS
------
play                  Plays the specified .WAV file (use full path/filename)
play_effect           Play specified file from effects folder
play_sound            Play specified file from sounds folder
play_loop             Play specified file from loops folder
stop_loop             Stop currently playing loop

GLOBAL CONFIG
-------------
default               Set the default profile to load on startup
access_code           Sets BLE access code for mobile app
echo                  Turns BLE data echo on (1) or off (0)
debug                 Turns debugging on (1) or off (0)
baud                  Set the serial baud rate for BLE communication to TK-Talkie
profile_dir           Set the location of the profile files

PROFILE SETTINGS
----------------
name                  Set the name of the current profile
volume                Set the speaker volume
lineout               Set the line-out volume
linein                Set the line-in gain
highpass              Turn highpass on (1) or off (0)
mic                   Set mic gain
button_click          Specify PTT button sound (* = random)
button_off            Specify PTT button release sound (* = random)
voice_off             Specify comm effect sound (* = random)
startup_sound         Set startup sound
loop_file             Set background loop file
noise_gain            Set white noise gain level
voice_gain            Set processed voice channel gain
dry_gain              Set unprocessed voice channel gain
effects_gain          Set sound effects gain
loop_gain             Set background loop gain
silence_time          Specify time (in ms) to wait after talking before playing effect
voice_start           Set VA mode voice-on trigger level
voice_stop            Set VA mode voice-off trigger level
eq                    Turn eq on (1) or off (0)
eq_bands              Set eq bands (5 bands, comma delimited) ex. -1,-.5,0,.1,-.1
bitcrusher            Set bitcrusher bit/rate ex. 10,10240
effects_dir           Specify sound effects folder
sounds_dir            Specify sounds folder
loop_dir              Specify loop files folder
glove_dir             Specify glove sound files folder
mute_loop             Mute background loop when talking (0 = No, 1 = Yes)
mute_effects          0 = Play effects after talkie, 1 = Do not play effects
sleep_time            Time (in minutes) to go to sleep after no activity
sleep_sound           Sound to play when going into sleep mode
chorus                Configure chorus 1 = enable, 0 = disable or voices,delay
                      Ex. chorus=0 or chorus=4,32
shifter               Configure voice shifter 1 = enable, 0 = disable or length,speed,range
                      Ex. shifter=1 or shifter=512,200,
chorus_delay          Set chorus delay
chorus_voices         Set number of chorus voices
flanger_delay         Set flanger delay
flanger_freq          Set flanger frequency
flanger_depth         Set flanger wave depth
flanger_offset        Set flanger delay length
flanger               Enable (1) or disable (0) flanger
button                Configure the specified button (0 - 5)
                      Ex. Set button 1 as PTT button:
                                button=0,1;0
                      Ex. Set button 2 to play sounds:
                                button=1,2,SOUND1.WAV;2,SOUND2.WAV

If you have any further questions regarding your TK-Talkie, please Contact Us or Join us on Facebook.