Jump to content

TKTalkie V2.0 Released!


Recommended Posts

So cool seeing things people come up with. 

 

 

I have v2 installed and I noticed I can change all the settings. Just need the time. We are slowly moving a mile down the road and should be done by the weekend hopefully! One thing I noticed when I did play with it, is there a way to confirm the teensy is using the text file settings instead of the compiled code? 

 

What I have done in the V2.1 I posted yesterday was remove the background loop default.  That way I know if the file is loading or not....i.e. if my background loop starts I know it's loaded the file.  Also, while you are in serial monitor (if using the Arduino editor) you can enter the word settings and hit enter and it will display the current settings so you can verify them.

  • Like 1
Link to comment
Share on other sites

Very cool!  You should be able to piggyback this in the VoiceOn() and VoiceOff() functions.  Just assign the pin in setup() (you may need to set it to HIGH as well to activate it), then you should be able to send HIGH in VoiceOn() and LOW in VoiceOff().  It "may" cause a pop when you turn it on and off, but that would be a cool effect IMO.

 

 

 

Awesome!  Can't wait to see it!

 

Setting the pin high in VoiceOn() sounds fine, and that is what I have done already, but if I set it low during VoiceOff() it can clip the ending static burst. Is there a way to determine the duration of the .wav file so that I could use millis() to determine in the main loop when to pull the pin low? I could always just cheat and say 2 seconds after the end it will pull it low, but then someone out there will make their own crazy static burst sound that is 4 seconds long and they will complain that it won't play the whole thing.

Link to comment
Share on other sites

Setting the pin high in VoiceOn() sounds fine, and that is what I have done already, but if I set it low during VoiceOff() it can clip the ending static burst. Is there a way to determine the duration of the .wav file so that I could use millis() to determine in the main loop when to pull the pin low? I could always just cheat and say 2 seconds after the end it will pull it low, but then someone out there will make their own crazy static burst sound that is 4 seconds long and they will complain that it won't play the whole thing.

Absolutely! Just check out the playEffect function.

 

Sent from my SAMSUNG-SM-G930A using Tapatalk

Link to comment
Share on other sites

Setting the pin high in VoiceOn() sounds fine, and that is what I have done already, but if I set it low during VoiceOff() it can clip the ending static burst. Is there a way to determine the duration of the .wav file so that I could use millis() to determine in the main loop when to pull the pin low? I could always just cheat and say 2 seconds after the end it will pull it low, but then someone out there will make their own crazy static burst sound that is 4 seconds long and they will complain that it won't play the whole thing.

 

Let me elaborate on that...

 

in the playEffect() function, there is a 10 ms pause to give time to get the length of the WAV file.  You could try using something like this:

/***
* Play the specified sound effect from the SD card
*/
long playEffect(int player, String filename)
{
   long len = 0;
   // Convert string to char array
   char buf[filename.length()+2];
   filename.toCharArray(buf, filename.length()+2);
   // Start playing the file. This sketch continues to
   // run while the file plays.
   switch (player) {
     case LOOP_PLAYER:
     loopPlayer.play(buf);
     delay(10);
     len = loopPlayer.lengthMillis();
     break;
   default:
     effectsPlayer.play(buf);
     delay(10);
     len = effectsPlayer.lengthMillis();
     
     /* NEW CODE */ 
     elapsedMillis effectsMs;

     // Add the speaking check so that it doesn't cut off 
     // if the user starts talking again before this loop is finished
     while (effectsPlayer.isPlaying() && speaking == false) {              
       if (effectMs >= len) {
         // TURN OFF THE AMP HERE
       }
     }

     break;
   }
   debug("PLAYING " + filename + " @ " + String(len) + " ms (" + String(len/1000) + " sec)");
   return len;
}

That loop is asynchronous, so program execution continues while it is looping so I added a speaking check in case the user starts talking again right away...don't want to cut them off lol.  You could also add that check in the function that turns off the amp, ie:

function ampOff() {
     if (speaking == false) {
        // turn it off
     }
}

I haven't tried any of this code, but that should get you started :)  Also, the only thing is, this precludes the use of a background chatter loop as it plays constantly.

 

 I really love this idea, I think it's a great addition.  I wonder if there is a way to do it with the Aker? 

Link to comment
Share on other sites

I have added the low battery function, but I have yet to be able to try the amplifier power function since I am away from home at work. The whole file is at http://www.r2db.me/TIE/TKTalkie.ino

int      OUTPUT_ENABLE_PIN = -1;   // This pin is for the amplifier output enable signal, used by some amplifiers
                                   // to put the amplifier in a low-power state when no audio is being played.
                                   // Set to -1 to disable this feature
int      LOW_BATTERY_PIN = -1;     // This pin is a digital input, used if your power supply has a low power warning.
                                   // This is assumed to be a high = adequate battery voltage, low = low battery
                                   // voltage. Set to -1 to disable this feature.
bool     BATTERY_GOOD = true;                                   
String   LOW_BATTERY_WAV = "LOWBATT.wav";
String   GOOD_BATTERY_WAV = "GOODBATT.wav";
Bounce LBP = Bounce();             // Used to read low battery pin (if feature is enabled)

/*** 
 * Check if the low battery signal has gone low 
 */
boolean checkBattery() 
{
  if (LBP.update()) {                   // If there was a change in the battery state since the last update then:
    if (!LBP.read()) {                  // If the battery was previously good and now is low, play .wav file.
      playEffect(EFFECTS_PLAYER, LOW_BATTERY_WAV);
      return false;                     // sample: "Critical failure in power bus. Expect comm system failure."     
    } else {                            // The battery was previously low but is now good.
      playEffect(EFFECTS_PLAYER, GOOD_BATTERY_WAV);
      return true;                      // sample: "Power bus reconfiguration successful."
    }
  } else {
    return BATTERY_GOOD;                // Return the same value currently in the variable, the state hasn't changed.
  }
}
Edited by r2db
  • Like 1
Link to comment
Share on other sites

OK, I was able to get everything working.

 

Helmet_mic.jpg

 

TI_speaker.jpg

 

I used two lithium round cell 2200 mAh batteries, the Adafruit 5V 1000 mA power board, the Adafruit 2.5 W mono amplifier board, 4 ohm 3W speaker. The amplifier was modified as follows:

 

1) Remove the pull-up resistor for the "shutdown" pin and if you feel adventurous rotate it 90 degrees right, solder one end to the capacitor ground terminal and the other end to the shutdown pad to make it a pull-down resistor. On the photo above I already soldered a 10k pull-down resistor into the wiring because as I was soldering the chip resistor back on it disappeared on the floor somewhere.

2) Remove the potentiometer on the amplifier board and shunt the positive input to the potentiometer output terminal. The external potentiometer shown above substitutes for that.

 

Amplifier.jpg

 

I can put up a more detailed wiring diagram later.

 

The program was modified and the .wav files for the battery conditions and a JRS startup file are at http://www.r2db.me/TIE/TKTalkie.zip

 

For the program, I needed to move the shutdown signal to the main loop and add another timer for that. It shuts down the amp 1 second after the sound effect terminates if you are not talking again. This does not work if you have background chatter going on.

 

After trooping update: I need a noise-cancelling microphone or some feedback prevention. If I turn up the amplifier all the way even with the amplifier in the pocket just above my knee I get feedback. The amplifier shutdown function worked great, and no low battery during the troop.

Edited by r2db
  • Like 2
Link to comment
Share on other sites

Just tried upgrading to 2.0. Pretty sure I copied everything correctly. Now, I have what sounds like white noise constantly running and no mic input working at all. Any suggestions?

 

# sound to play when TKTalkie is started
[startup=STARTUP.WAV]
 
# chatter loop settings
[loop=CHATTER.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[loop_gain=7]
 
# VOICE ACTIVATION SETTINGS
[silence_time=350]
[voice_start=0.05]
[voice_stop=0.02]
 
# PTT (Push-To-Talk) SETTINGS
[button_pin=2]
[button_click=BUTTON.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[button_gain=1]
 
# MICROPHONE/LINE-IN SETTINGS
# input settings (0 = microphone, 1 = line-in)
[input=0]
# 0 to 63
[mic_gain=20] 
 
# SOUND EFFECTS (STATIC BURSTS, ETC.)
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[effects_gain=5]
 
# EQUALIZER SETTINGS
# 0 = flat (none, 1 = parametric, 2 = bass/treble, 3 = graphic
[eq=3]
# for parametric/graphic = 5 bands, for bass/treble = 3 bands
# bands are low to high: -1 (-11.75dB to 1 +12dB)
[eq_bands=-1,0,1,0,-1]
 
# VOICE SETTINGS
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[voice_gain=1]
 
# BITCRUSHER SETTINGS - VOCAL EFFECTS
# Format = bits1,rate1,bits2,rate2
# Set to 16,41000,16,41000 to just pass-thru (disable)
[bitcrushers=12,16384,10,10240]
 
# PINK NOISE GENERATOR
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[noise_gain=0.1]
 
# Turn debug messages on/off (1/0)
[debug=0]
Edited by Darkpain714
Link to comment
Share on other sites

 

Just tried upgrading to 2.0. Pretty sure I copied everything correctly. Now, I have what sounds like white noise constantly running and no mic input working at all. Any suggestions?

 

# MICROPHONE/LINE-IN SETTINGS
# input settings (0 = microphone, 1 = line-in)
[input=0]
 

 

 

Ugh, the microphone/line-in values are backwards ;)   I've corrected them on github.  Should be 1 for microphone.

 

Also, I noticed the mic_gain was set to 20.  I actually have mine cranked all the way down to 3 and just added more to the voice gain, and I can crank my amp up almost all the way without any type of feedback.  This is my current settings file.  It worked really well last night at the Rogue One premier  :smiley-sw013:

TKTalkie v2.0 www.tktalkie.com
[volume=0.5500]
# sound to play when TKTalkie is started
[startup=STARTUP.WAV]
# chatter loop settings
[loop=CHATTER.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[loop_gain=0.040]
# VOICE SETTINGS
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[voice_gain=1.5000]
[voice_start=0.040]
[voice_stop=0.021]
[silence_time=350]
# PTT (Push-To-Talk) SETTINGS
[button_pin=0]
[button_click=TKT_CLK3.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[button_gain=1.0000]
# MICROPHONE/LINE-IN SETTINGS
# input settings (0 = microphone, 1 = line-in)
[input=1]
# 0 to 63
[mic_gain=3]
# SOUND EFFECTS (STATIC BURSTS, ETC.)
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[effects_gain=0.4500]
# EQUALIZER SETTINGS
# 0 = flat (none, 1 = parametric, 2 = bass/treble, 3 = graphic
[eq=3]
# for parametric/graphic = 5 bands, for bass/treble = 3 bands
# bands are low to high: -1 (-11.75dB to 1 +12dB)
[eq_bands=1.00,0.50,-0.50,-0.50,-1.00]
# BITCRUSHER SETTINGS - VOCAL EFFECTS
# Format = bits1,rate1,bits2,rate2
# Set to 16,41000,16,41000 to just pass-thru (disable)
[bitcrushers=12,16384,10,10240]
# PINK NOISE GENERATOR
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[noise_gain=0.1500]
[debug=0]
Link to comment
Share on other sites

OK, I was able to get everything working.

 

...

 

I used two lithium round cell 2200 mAh batteries, the Adafruit 5V 1000 mA power board, the Adafruit 2.5 W mono amplifier board, 4 ohm 3W speaker. The amplifier was modified as follows:

 

... 

 

 

This is very cool!  You should post some video of it working ;)

Link to comment
Share on other sites

 

Ugh, the microphone/line-in values are backwards ;)   I've corrected them on github.  Should be 1 for microphone.

 

Also, I noticed the mic_gain was set to 20.  I actually have mine cranked all the way down to 3 and just added more to the voice gain, and I can crank my amp up almost all the way without any type of feedback.  This is my current settings file.  It worked really well last night at the Rogue One premier  :smiley-sw013:

Thank you. That did the trick. v2 is MUCH louder than before. That was my biggest issue at my Rouge One troop last night. It was too quiet still. I took the mic gain down to 5 and upped the voice gain to 1.5 as you have it. It's much better now. I'm thinking I can probably push a lot more out of these hovi speakers still without feedback with a bit more tinkering. 

  • Like 1
Link to comment
Share on other sites

This is very cool!  You should post some video of it working ;)

 

I will, but I am already working on a more streamlined unit. This one is a mess of spaghetti as I didn't know where I was putting everything until it wound up where it is. This new one will have just the microphone and a bluetooth transceiver in the helmet. Right now I have an 8-conductor UTP network cable connecting the speaker and the Teensy/ audio board since I need 1 pair for power, 1 pair for audio, and 1 pair for the low battery warning and amplifier shutdown. If I put everything in the speaker unit by extending it about 1.5 inches I can tidy up the helmet don/ doff routine. I also need to figure out why the potentiometer is not working as expected. I wound up putting two pots in, one immediately after the Teensy output (10k linear taper) and one in the speaker box (10k audio taper). The 10k audio taper by itself just wasn't working in practice even after confirming multiple times that it was doing what it was supposed to on the bench. I am thinking of a digital potentiometer in the future build. I could store the volume in the eeprom and use two more debounced inputs for volume up and down.

  • Like 1
Link to comment
Share on other sites

I can't figure it out. I increased the effects gain up to 100 and play the startup wave file and it's a tad louder but sounds really grainy and no where near the levels my iCOMM produce. It can't be my amp because it pushes volume plenty loud thru my hovi speakers. I haven't even bothered messing with speaking thru my mic yet until I figure this out you won't be able to hear me. Hoping someone else using Tony's hovi speakers and Amp2 option attempts this so we can get this working.

Link to comment
Share on other sites

Disregard previous post.... I read back and did mostly what lerxstrulz did in the TKCONFIG file except changed a few lines for my setup. I think my volume knob is not connected to the board well enough so I had to bypass it using the volume command in the text file. Here's my current config:

TKTalkie v2.0 www.tktalkie.com
[volume=0.5500]
# sound to play when TKTalkie is started
[startup=STARTUP.WAV]
# chatter loop settings
[loop=CHATTER.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[loop_gain=7.0000]
# VOICE SETTINGS
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[voice_gain=2.0000]
[voice_start=0.1868]
[voice_stop=0.020]
[silence_time=350]
# PTT (Push-To-Talk) SETTINGS
[button_pin=2]
[button_click=BUTTON.WAV]
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[button_gain=1.0000]
# MICROPHONE/LINE-IN SETTINGS
# input settings (1 = microphone, 0 = line-in)
[input=1]
# 0 to 63
[mic_gain=5]
# SOUND EFFECTS (STATIC BURSTS, ETC.)
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[effects_gain=7.0000]
# EQUALIZER SETTINGS
# 0 = flat (none, 1 = parametric, 2 = bass/treble, 3 = graphic
[eq=3]
# for parametric/graphic = 5 bands, for bass/treble = 3 bands
# bands are low to high: -1 (-11.75dB to 1 +12dB)
[eq_bands=-1.00,0.00,1.00,0.00,-1.00]
# BITCRUSHER SETTINGS - VOCAL EFFECTS
# Format = bits1,rate1,bits2,rate2
# Set to 16,41000,16,41000 to just pass-thru (disable)
[bitcrushers=12,16384,10,10240]
# PINK NOISE GENERATOR
# 0 to 32767, 1 is pass-thru, below 1 attenuates signal
[noise_gain=0.5000]
[debug=1]

 

Demo time:

 

  • Like 2
Link to comment
Share on other sites

Disregard previous post.... I read back and did mostly what lerxstrulz did in the TKCONFIG file except changed a few lines for my setup. I think my volume knob is not connected to the board well enough so I had to bypass it using the volume command in the text file. Here's my current config:

 

Sounds great!

 

The headphone out is an amplified signal, so it becomes a balancing act of sending that signal to an amplifier and avoiding feedback.  I ordered some more boards but haven't had a chance to play with them over the holidays but wanting to see just how loud the Teensy can get without an amp (instead connecting speaker directly to Teensy) and am also going to experiment with the line out connections running through my Aker. I'm able to get my setup pretty loud without feedback, but wanting to see just how far I can realistically push it ;)

Link to comment
Share on other sites

Now my issue is trying to figure out how to provide power to it externally. What I want to do is use a JST connector spliced into a 5v external source into a micro usb cable. I want to be able to unplug that usb cable and use a regular one to still hook it up to my computer if needed for updates/changes. If it's better to run the leads straight to the teensy board, I'm fine with that too just not sure where it goes. 

 

08A41800-A692-4A86-97D3-314CD07533FD.jpg

Something like this but I'll add a switch too. I can get it to power on usb to my computer but not the spliced usb to my external power. The reason why I'm not going straight to a tube usb supply is because I already have everything else wired up like ukswrath does. 

Link to comment
Share on other sites

I figured it out after some difficulty. Red to red, black to black. Wired in another switch into the 5v power supply per ukswrath's Gen 4 electronics schematics. Everything turns on but I'm pretty sure I managed to fry the audio shield. I am able to read the teensy and compile when connected to my laptop but nothing is coming out the speaker. Just ordered a replacement audio shield with hopes that's all it is. 

Link to comment
Share on other sites

I figured it out after some difficulty. Red to red, black to black. Wired in another switch into the 5v power supply per ukswrath's Gen 4 electronics schematics. Everything turns on but I'm pretty sure I managed to fry the audio shield. I am able to read the teensy and compile when connected to my laptop but nothing is coming out the speaker. Just ordered a replacement audio shield with hopes that's all it is. 

 

I respectfully disagree. You should use diodes to protect from pushing voltage backwards where it shouldn't be. I apologize in advance if I am getting too elementary here.

 

1N4001 diodes should be more than sufficient to isolate the power. You can pick them up at Radio Shack.

 

1) Cut the trace from the USB 5V (VUSB) to the 5V pin (VIN) as noted on the diagram:

 

card9b_rev1.png

 

2) Put one diode from the VUSB to VIN. Just seat it in the hole for VUSB, bend the cathode lead (the wire next to the silver stripe) to the VIN pin. This DOES NOT need to go through to the audio board. The audio board only uses 3.3v.

 

3) Solder your 5V supply directly to VIN after the diode.

 

Doing this allows you to both power the board externally and connect the USB to program or debug it.

 

However, is you are going to use the cut USB to power it, I recommend heat shrink tubing to cover the splice and splicing the wires a bit cleaner (NASA Lineman's splice http://makezine.com/2012/02/28/how-to-splice-wire-to-nasa-standards/).

 

I will post later about the minimum pins needed for the audio board.

Edited by r2db
Link to comment
Share on other sites

I've used heat shrink wrap on all solder parts. That one picture was me testing (and failing) before figuring it out. The reason I haven't gone the diode route is when I update or modify the teensy I don't want to rely on my USB power supply and just be able to plug it into my computer.

Link to comment
Share on other sites

The diodes allow you to use the USB to power it or another power supply. Mine can be powered from the speaker box or the computer, or plugged into the computer while powered from the speaker box.

 

The diode only drops the voltage slightly, and the on-board regulator takes that down to 3.3V. In my current build I have a diode from the speaker box to the Teensy and a diode from the USB power to the Teensy. That way I don't try to power the speaker off of USB power and I don't try to feed power back to the USB bus from the Teensy.

Link to comment
Share on other sites

I'll have to look at some photos since I'm much more of a visual person. I guess I'm lucky enough to still have a radio shack nearby. I just saw the part about scrapping the connectors a part on the teensy that seemed like I would screw up

Link to comment
Share on other sites

  • 2 weeks later...

I'm just starting this project and I had an idea. Instead of having another battery, could you not tap into the Aker speaker battery? That battery is rated at 7.5 volts, but if you add a small voltage regulator to dump it down, it should work. Especially since the current draw is so low on the Teensy. That would save space and it would be one less battery to worry about. I just ordered everything I need and I should hopefully have this built in the next few weeks.

 

Also lerxstrulz thanks for putting these tutorials and code together. I was looking for a way of doing this for a while, until I stumbled upon your thread.

Link to comment
Share on other sites

I got my wiring working but since it's on the same power as the 5v fans, there's a ton of noise. Will have to get a 12v step down and move it. I'll keep this updated in case  someone else is/plans on doing things the same way I am. 

  • Like 1
Link to comment
Share on other sites

I'm just starting this project and I had an idea. Instead of having another battery, could you not tap into the Aker speaker battery? That battery is rated at 7.5 volts, but if you add a small voltage regulator to dump it down, it should work. Especially since the current draw is so low on the Teensy. That would save space and it would be one less battery to worry about. I just ordered everything I need and I should hopefully have this built in the next few weeks.

 

Also lerxstrulz thanks for putting these tutorials and code together. I was looking for a way of doing this for a while, until I stumbled upon your thread.

 

That's great!  The great thing about this project is you can do pretty much whatever you want ;) Welcome! 

Link to comment
Share on other sites

I got my wiring working but since it's on the same power as the 5v fans, there's a ton of noise. Will have to get a 12v step down and move it. I'll keep this updated in case  someone else is/plans on doing things the same way I am. 

 

I'm getting close to needing a single power supply for all my stuff as well.

 

I have a couple more kits that I'm going to try to get to this weekend.  Going to try wiring them up in different ways.  Also wanting to update the tutorial.  I ordered a 50W PylePro speaker that will be here tomorrow to maybe replace my Aker 1506, since it's only 10W.  I'm finding more and more in noisy situations the Aker is not loud enough.

 

I'm essentially going to wire up the first of the two kits to use the Line-In/Line-Outs to run to the speaker.  I'm finding that by using the headphones out (which is powered) and plugging that to the mic input on the speaker, it will only get so loud before feedback because the signal is pretty hot at that point.  Having to adjust the equalizer and pull a lot of the treble out to avoid feedback.  It's still pretty loud, but like I said, I've been in a couple situations where it wasn't quite loud enough.

 

Lastly, I found at one troop it would be really nice if I was able to change some settings on then fly, like turning off the background chatter, so I found a BlueTooth transceiver in a box of parts for Arduino and thinking of maybe writing an app that would connect via bluetooth to the TKT to allow real-time updates ;)  Would also be great for initial setup I think. 

 

Anyway, that's on my wish list for the weekend.  I have a troop and then some normal life stuff, so hopefully I have time to get started ;)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...