Open Panzer

Developer's Forum => Open Source Sound Dev => Topic started by: LukeZ on January 15, 2017, 03:09:42 PM

Title: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 15, 2017, 03:09:42 PM
This thread will follow my attempts to create an open source sound card based on a Teensy 3.2 (https://www.pjrc.com/store/teensy32.html) microcontroller featuring a 32 bit ARM processor (72 MHz Cortex-M4). It costs about $20 so represents a lot of power for very little money, and it's also very small.

All Teensy devices (there are several versions) are Arduino compatible and can be programmed using the Arduino IDE if you install the free Teensyduino add-on (https://www.pjrc.com/teensy/teensyduino.html). Development can proceed rapidly because all the standard Arduino libraries can be used, and there are lots of Teensy-specific libraries available as well.

The greatest thing about this board is that it runs the Teensy Audio Library (https://www.pjrc.com/teensy/td_libs_Audio.html). This is an entire toolkit for building audio projects using a Teensy processor. They have a workshop you can go through (https://www.pjrc.com/store/audio_tutorial_kit.html) that will probably blow your mind. I attended one of these in person last year for the express purpose of learning how we could leverage these resources for an Open Panzer sound card.

The workshop examples use a Teensy 3.2 mated to the PJRC Audio Adapter board (https://www.pjrc.com/store/teensy3_audio.html). This board outputs CD quality stereo sound (16 bits, 44.1 kHz) and basically just consists of an SD card slot and an SGTL5000 codec chip. This chip takes I2S audio data from the Teensy (not to be confused with I2C) and with the onboard DAC converts it to analog audio. It has a built in headphone amp so you can listen on headphones without any extra hardware. But if you want to drive a speaker you have to add an amplifier circuit to the line-outputs. The SGTL5000 also has a lot of audio processing and signal conditioning features that can be manipulated through convenient functions in the Audio Library.

The Audio Adapter board is a bit overkill for our purposes. We don't need headphone outputs, we don't need stereo sound, and we probably don't need the majority of the signal processing capabilities. We do need however to drive a speaker and that requires yet another chip. However it would not be hard to create our own board with the SGTL5000, SD card, and a small Class D IC.

We do however have other options...

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 15, 2017, 03:33:28 PM
Let's take a step back and look at our options. The Audio Library enables the Teensy to stream sound data from two possible sources - an SD card or flash memory. It can then perform various tasks with the sound (mixing, adjusting, etc) and output to one of two outputs - mono analog using its single onboard DAC, or digital I2S data out.

If we use the onboard DAC, all we need to add to the Teensy (on the output side) is an amplifier IC. This is easy to do and there are lots to choose from. PJRC sells what they call a Prop Shield (https://www.pjrc.com/store/prop_shield.html) (not for propellers, for props) that uses a Texas Instrument LM48310; I have been using this for experimentation. Adafruit has an inexpensive breakout (https://www.adafruit.com/products/2130) using a Diodes Inc PAM8302A. I'm sure there are a million other options as well. Both these listed operate at up 2.5 watts on a 4-ohm speaker which is probably more than enough for most 1/16 scale models and is equivalent to the Benedini TBS Mini.

In other words, in terms of hardware using the Teensy's DAC out is about as simple as it gets.

We could also use I2S out into a codec chip like the afore-mentioned SGTL5000 and then into an amp. This adds another IC but gives us some audio processing abilities we may not need.

I also recently discovered this fascinating combination I2S-DAC/Class-D amp chip that Adafruit sells a breakout for: MAX98357A (https://www.adafruit.com/products/3006). Feed it I2S digital audio and it will convert to analog and give you a hefty 3.2 watt amplified mono output you can connect directly to a speaker. I have ordered one to experiment with but don't have it yet.

All these options involve relatively inexpensive chips we can easily incorporate into our own board design. The final result I am shooting for is a small carrier board with a socket to plug in a Teensy 3.2. The carrier board will "carry" all the extra audio components we need such as the amplifier, plus the SD card slot, standard headers to attach HengLong/Taigen speakers and volume control knobs, and serial and power connections for hookup to the TCB.

So the question at this point is what hardware route to take. But we have some more things to consider first.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 15, 2017, 04:07:10 PM
Now we need to think about the audio source, SD card or flash memory. From an end-user perspective, an SD card is to be preferred by far. Put your files on it, stick it in your sound card, bam, you're done. SD cards are cheap and can provide gigabytes more storage space than we'd ever need.

Here is the big downside to SD cards - they are optimized for reading serial data, not parallel. This means you can stream a song off it no problem, but try to stream two sounds, or three, or more simultaneously and the card quickly croaks. The processor on the Teensy is more than capable of managing probably even a dozen simultaneous audio streams, but the SD card will not be able to keep up.

This is why the RC Tanks Australia Asp2 (http://rctanksaustralia.com/guides/index.php?title=Asp2) board uses two SD cards to play two sounds simultaneously. There is nothing special about the sound cards, they are off-the-shelf Chinese mini MP3 modules (http://www.ebay.com/sch/i.html?_odkw=fn-m16p&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR10.TRC1.A0.H0.Xmini+mp3+module.TRS0&_nkw=mini+mp3+module&_sacat=0) that are awash on eBay. On the first MP3 player he has engine sounds running, on the second auxiliary sounds like cannon fire. This works (if you don't need more than 2 sounds) but is bulky, inflexible, unsophisticated and not the way I want to go.

Putting sounds on flash memory solves the polyphony problem, but creates many more. Small flash chips don't have great capacity, in 8-SOIC packages I think the limit now is about 16 Mbytes. Considering the Audio Library only plays 16 bit, 44.1 kHz WAV files, this isn't much. Getting flies on to the flash chip is also a royal pain. The user can't simply drag and drop files the way they can with an SD card. We need to add functionality to a PC application (OP Config) to convert and load them, and bother with a bunch of extra hassle on the controller as well.

When you realize the complexity of this approach you really start to appreciate the genius of the Benedini TBS which runs on a ridiculously humble 8-bit ATmega168 processor with only 3/4 MB of flash memory to store sounds!! This is the extreme opposite approach to the Asp2 board. Thomas makes up completely what he lacks in hardware with pure brain power and sophistication typical of the Germanic race.

However I am no Thomas. It would be great to have him design a board for us but then he'd put himself out of business. So we shall have to muddle ahead ourselves (or myself).

In the end I think there is no avoiding the use of an SD card, the benefits are just too great. We actually can play more than one sound at a time from SD, but we have to be careful how we do it. And there is no guarantee I won't run into some pitfalls that make all this effort a waste of time eventually.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 15, 2017, 04:16:15 PM
What I need to do next is determine if using the Teensy's onboard DAC in any way causes more problems with simultaneous SD card reads than outputting I2S only. I don't think it will but I have not gotten far enough in my experiments to be sure. If there is no real difference, then I think I will design a board that uses the Teensy's onboard DAC fed into a Class D amp and that should be all we need for hardware. If I find I2S somehow appears to give us a bit more wiggle room, then the hardware will probably use the MAX98357A listed before.

One thing I need is a quality set of sound files for testing. The Benedini comes with good sounds but they are in proprietary format. I've assembled a small set of my own for playing around with but I put no effort into them and they sound awful to begin with, so they will continue to sound awful no matter how wonderful this sound card may or may not become. I know there are a couple guys on RCU who have have really gone all in creating quality sets for their models, I may ask over there if anyone wants to share.

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: vonTirpitz on January 15, 2017, 07:32:58 PM
The Audio Adapter board is a bit overkill for our purposes. We don't need headphone outputs, we don't need stereo sound, and we probably don't need the majority of the signal processing capabilities. We do need however to drive a speaker and that requires yet another chip. However it would not be hard to create our own board with the SGTL5000, SD card, and a small Class D IC.

While I am still very "green" and a long way from catching up to you on this project in terms of overall understanding a thought does occur to me.  Given the flexibility that you are striving for with the project I might suggest not discarding the stereo option out of hand.

For instance, you can actually use a stereo system to play "split tracks" that could be used to play two different sounds (in terms of a left and right speaker).  So, in the case of our tanks, I could perceive one speaker playing an engine sound channel (with everything from idle to acceleration/deceleration) and the other channel playing overlap audio for brakes, gun fire, track sounds, etc.

One thing I notice with my tanks is that each sound plays exclusive of the other sounds (so the engine sounds are suspended when the gun fires, etc).  Using the Stereo channels to seamlessly interlace audio would allow for a much richer sound experience.  From a hardware standpoint, unless looking to use bridged mono, this approach would also require the second speaker and enough energy to drive both.  However even this it isn't a zero sum option.  The stereo logic circuitry provide some interesting capabilities whether using one or more speakers (as long as we know what the capabilities of the speakers are).

Of course, less elegant options are out there but they would require much more sound data (thus more memory) to provide a "smoothness" to overlapped audio. 

Once again, it has been a very long time since I did any serious work in audio so forgive me if anyone finds myself rambling.  If such is the case all I can do is apologize.  I've discovered that many of my thoughts end up being casualties of a tired mind.   :P

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 16, 2017, 02:26:31 PM
Those are some good thoughts vonT and no suggestion is a dumb one! At least if it gets us thinking. It may have been a long time since you did work in audio, but for me it is all completely new. So I know very little but have learned enough to realize this is an extremely complicated subject, which probably explains why a good sound system for models is so hard to find.

But my design philosophy generally is not to add a feature that would be useful for the 10 percent if it inconveniences the 90 percent. If it can be added without inconvenience to those who don't use, then ok. But in the case of a sound card with stereo outputs, users would then have to use two speakers or a special stereo speaker, which I imagine is hard to find in the small sizes we typically require (at least in 1/16 scale). It may be possible to design the board with two amps, each fed stereo but one that converts to mono and one to stereo. This increases board size and cost. I suppose another option would be to proceed with an amplified mono output but have stereo line-outs available for those who want it, and they would need to supply their own amplifier.

Using each individual channel for overlapping sounds is a good idea, but so far as I can think ahead, doesn't solve any technical issues regarding read limitations on SD cards. We can't start or stop reading the left and right channels of a given audio file at different times, they have to be streamed simultaneously - but we don't know for example when the user is going to want to fire the cannon relative to the position of any engine sound, so pre-mixing overlaid tracks is not going to help us much.

Maybe there are some other benefits I'm not seeing or comprehending...

I think with the correct SD card we should be able to play three sounds simultaneously - or at the very least two. This is not as great as it seems since we will need at least two just for engine sounds (the engine being dynamic we will constantly be fading from one sound to the next, which requires two tracks to overlap each other for at least a portion of time). But if we can reliably get three I think we are out of the woods.

It may also be possible to put short sounds like cannon and machine gun fire, squeaks, etc... in flash memory. If there is space to pre-load all the variants likely to be required, these could be static and therefore wouldn't require the complicated end-user hassle needed to get those files onto the flash, but would still let us stream more sounds simultaneously.

Anyway, these are my random thoughts for now...
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on January 18, 2017, 11:29:44 PM
I was able to do some testing. Using the optimized Teensyduino SD library for reading SD cards instead of the Arduino library, and using a SanDisk Ultra card which has "higher non sequential speed" according to PJRC (https://www.pjrc.com/store/teensy3_audio.html), I was able to stream 4 stereo WAV files simultaneously without problem. Perhaps I could do even more but that's as far as I tried, and it should be plenty for what we need.

Using a slower card (Kingston brand) I could only reliably get 2 stereo sounds simultaneously, so the card definitely makes a difference. However even the Kingston was able to stream 4 mono files.

I could detect no difference in performance between audio out via I2S or DAC, which is what I expected. To keep the hardware simple I'm going to proceed with DAC out to a mono amp for now. We can always change the hardware later if we need a stereo version, the firmware is going to be the valuable part, not the board.

I've attached a picture of the hardware I'm using now: on the bottom is a simple carrier board, followed by a Prop Shield (https://www.pjrc.com/store/prop_shield.html), then a Teensy 3.2 (https://www.pjrc.com/store/teensy32.html), then an SD card shield (https://www.pjrc.com/store/wiz820_sd_adaptor.html). It's kind of a hot mess.

Feeling comfortable this setup will give us the technical capabilities we need, I will next design a better carrier board to eliminate everything but the Teensy. It will consist of the SD card slot, amplifier, speaker and volume connections, RC and TCB connections, etc...  I might throw on a small flash chip as well.

Of course the firmware is the most important part. I'll try to have some code in good enough shape to start a GitHub repo within a few weeks. Perhaps ninety percent of the functionality will not be difficult other than putting in the time. The challenging part will be realistic engine speed routines. That is the part I expect the more people involved, the better the outcome.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: vonTirpitz on January 19, 2017, 09:48:07 PM
The challenging part will be realistic engine speed routines. That is the part I expect the more people involved, the better the outcome.

I will try to remember to spend some time looking through code examples of dynamic sound manipulation.  I like the idea of dynamically manipulating baseline audio to produce desired output.  It greatly expands the uses of recordings and I would not expect the additional program logic to overwhelm the hardware so it might be a good path to pursue. 

An example can be found here (https://gamedevelopment.tutsplus.com/tutorials/creating-dynamic-sound-with-the-web-audio-api--cms-24564) (In the Flight Sounds section).
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 08, 2017, 03:14:35 PM
Been a while since I posted an update on this project but development has been on-going. Using the Teensy 3.2 as a processor works great and I can play 5 sounds simultaneously no problem straight from the SD. In fact it could do more but I haven't found a need and anyway when you have five things going at once it already starts to sound like cacophony.

Right now the firmware assigns two sound slots to the engine - this is so that as engine speed increases, or any other engine sound transition occurs, we can fade from one file to the next (which requires two sounds to play at once), rather than to cut abruptly from one file to the next.

The other three sounds are for effects, so for example you could have the MG firing, the turret moving, and music playing - all while the engine is going. I think this should be plenty.

I've simplified the ridiculous 4-stack test model shown earlier. There is now a single "carrier" board into which an off-the-shelf Teensy plugs in to. The carrier board provides connections for the speaker, volume pot (HL/Taigen pots are plug-n-play), as well as connections to the TCB and optional RC inputs if used without the TCB in a standard RC model.

There isn't much to it hardware-wise so the cost is relatively low. Even in single quantities you can build one for less than $40, including the Teensy. If you do decide to build one, note that OSH Park sells Teensy 3.2s at checkout when you get your boards.

I've created a project page on GitHub with firmware source code as well as instructions, see it here (https://github.com/OpenPanzerProject/OP-Sound).

When used with the TCB there isn't much setup. You assemble your sound files, give them the correct names as shown in the instructions, and put them on the Micro-SD card. That's pretty much it. Sound files must be 16 bit 44,100 Hz WAV files (this is CD quality).

SD cards up to 32 Gb in size are supported. That equates to about 100 hours of sound. As mentioned before though, a high quality memory card must be used or else it will have problems playing multiple sounds at once. SanDisk Ultra are recommended.

The sound card can also be used with standard RC gear and has 5 channels of input. However flexibility is really limited in this mode. Right now RC mode works like this:
Channel 1 - Engine on/off
Channel 2 - Throttle
Channel 3 - Cannon/MG
Channel 4 - Two user sounds
Channel 5 - Volume control

But much more could be accomplished for the RC mode if a configuration program were created (similar to Benedini's TBS Flash), or if we just used some kind of "Settings.txt" file placed on the SD card. Since none of this is really relevant for use with the TCB, I'm not planning to spend a lot of time developing the RC aspect right now. However I can see it might be very popular, and maybe more people would want this device for general RC usage than for use in tanks, because there is definitely no other good option available today that doesn't cost an arm and a leg.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 08, 2017, 03:19:29 PM
The sound card has pass-through plugs on both ends so it can be used with the TCB alone or it can go in-between the TCB and the Scout ESC.

The photo below shows a prototype version of the TCB with slightly different connectors than on the final version you will buy. The final version has a 3-pin communication plug to the sound card instead of the 2-pin shown here (the sound card and Scout both use 3-pin), and the final version of the TCB also has a standard JST plug for power instead of the screw terminals shown here.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 08, 2017, 03:27:01 PM
Here is a brief video showing that basically it works. The card has many more sounds than are played here, stuff like receiving hits from cannons or machine guns, repair, braking, etc... plus of course you can always add your own custom sounds.

Two somewhat special things are illustrated:

The sound files I'm using in this demo are very simple, in fact there is only 1 engine running speed (but you can have up to 10). It doesn't sound half bad due to the interesting acceleration and deceleration sounds. But of course someone with more ingenuity with sound file manipulation could make something even better.

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 08, 2017, 03:51:53 PM
You can download the sound set I'm using in this test:
   Click here (https://github.com/OpenPanzerProject/Sound-Files/tree/master/SoundSets/OpenPanzerSoundCard),
      select the file named OPSound_TestSet_2017_07_08.zip,
         then download.
Title: What's Next?
Post by: LukeZ on July 08, 2017, 04:00:21 PM
Ok, this is all very interesting, but before anyone gets too excited, please remember this thing only exists in prototype form and there is no way to buy it right now.

Right now the board needs two important things before it is ready for production: testing by end users, and quality sound sets. Testing will certainly uncover firmware improvements that need to be made, and it may even lead to a further hardware revisions as well.

That's where we're at now. This next stage is going to take time, so again, please don't expect to obtain one of these yourself anytime soon (unless you want to build your own, but note, the amplifier IC requires reflow soldering).

Even when the testing/development stage is complete, then we still have to find some company who wants to make these at their own expense. That has proven difficult (no luck with the Scout), and it will no doubt prove difficult here again as well.

Bottom line, please don't ask me every other day if you can buy one! Don't expect to see one in the wild for the next very long time! As I have updates I will post them here and in the FAQ (http://openpanzer.org/forum/index.php?topic=43.0).
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: johnnyvd on July 13, 2017, 04:48:20 AM
I will try solder one together and start testing.. I really like the way the Scout, Sound and TCB are connected.. What type of volume control are you using in the pictures Luke?
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 13, 2017, 11:31:25 AM
You can use any standard potentiometer, the ones that come with Taigen / Heng-Long boards will plug in directly.

The pot you see in the photo is one I got from eBay from Keyestudio, you can find it here (http://www.ebay.com/itm/Keyestudio-Adjustable-Potentiometer-Mod-for-Arduino-Compatible-Video-/261937844913). It's the same thing, just a little nicer. You'll have to make a cable for it. You'll also have to get the knob separately, anything that fits the common 6mm shaft will work well, such as these (http://www.ebay.com/itm/10X-Aluminum-Knobs-Rotary-Switch-Potentiometer-Volume-Control-Pointer-Hole-6mm-B-/191783620503) or these (http://www.ebay.com/itm/10-Volume-Control-Rotary-Knobs-Black-for-6mm-Dia-Knurled-Shaft-Potentiometer-WB-/301916698128).

Keyestudio has all kinds of goodies. Some of their items (like that same pot, or their relays) will work on the General Purpose I/O ports (http://openpanzer.org/wiki/doku.php?id=wiki:tcb:tcbinstall:io_ports_ab) on the TCB. Worth browsing around their store.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Springman65 on August 16, 2017, 12:49:19 PM
Luke,

To quote from above:

"But much more could be accomplished for the RC mode if a configuration program were created (similar to Benedini's TBS Flash), or if we just used some kind of "Settings.txt" file placed on the SD card."

A "Settings.txt" file......are you talking about a text formatted INI file....say "SETTINGS.INI"  that is called an Initialization file????

The IBU sound cards use that type of file.  So, many would be familiar with that type of parameter file.

So, that would be my vote.....

Springman

PS - I like the new board Design!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on August 16, 2017, 01:24:34 PM
Yes, same thing, INI/text file that would be the idea.

However - there is no need for any such configuration file when the sound card is used with the TCB. All configuration would be done through OP Config or handled automatically.

The only reason we might consider a settings file are for those cases where the sound card is used alone in some kind of RC model without the TCB. Obviously this is not our focus so development along those lines is not a priority.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Springman65 on August 18, 2017, 07:55:24 AM
Yes, same thing, INI/text file that would be the idea.

However - there is no need for any such configuration file when the sound card is used with the TCB. All configuration would be done through OP Config or handled automatically.

The only reason we might consider a settings file are for those cases where the sound card is used alone in some kind of RC model without the TCB. Obviously this is not our focus so development along those lines is not a priority.

Understood.  But, the INI file is already used by RC Tankers for the IBU and others, so the concept of it use and format is known......

I like that familiarity......

Springman
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 05, 2017, 08:44:22 PM
User jhamm has one of the prototype sound boards for testing and he sent me the following questions. We'll try to continue our further discussion here for others to see:

Quote from: jhamm
Hey luke,
I did the first tests today.
The influence of slider for relative Volume for Engine is not so much.
When two or three Sounds like Cannon and MG play together, the whole sound becomes quieter... this ins´nt good.
When i hold the stick on MG longer as 3 seconds it sounds like the sound double on.
Can you write something about the structure of soundfiles?
How many acceleration and decelleration stages are necessary?

My comments:

Slider: The function of the volume sliders in OP Config are perhaps not very clear. They only adjust relative volumes, absolute volume is always 0-100. If you set all three to 20-20-20 that is no different from setting all three to 50-50-50 or 86-86-86. Likewise I suspect if you set them to 20-40-50 it would be no noticeable change from 40-60-70. If you want the relative volume of the Engine to be high, set it's number high, but also set the numbers for track overlay and effects low. That way there is a large relative difference, and now you should notice the engine sound being much louder.

Auto volume adjustment for simultaneous sounds: First let me explain the reason for this. If volume is at 100% and you play 2 or 3 sounds simultaneously with no volume adjustment, now volume is 200% or 300%. This will result in distortion and cracking of the speaker. I experimented earlier with assigning fixed 33% volume each to engine, track overlay, and effects. This works well but the big drawback is that volume for any single sound can never exceed 33% which is not very loud. So that led to experiments which you see now, volume can be set to max but as soon as multiple sounds are played they are each reduced so that the total does not exceed 100%.

But I admit it can sound not very good.

Perhaps what I need to do is go back to the simple case - keep the volume for each individual sound at whatever level the user has specified. If the total of all simultaneous sounds exceeds 100% the user will hear unpleasant distortion, and they will simply have to live with it or turn down the volume.


Machine Gun repeating over itself: I believe I know what the problem is, and I will fix this in next code update.

Sound file info: See the Open Panzer Sound page (http://openpanzer.org/wiki/doku.php?id=wiki:tcb:tcbinstall:sound_op_v1) in the Wiki for more information. But in general, there are many sounds for which multiples can be specified. In these cases you are free to include as many or as few as you want (or only 1).

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 06, 2017, 10:21:45 PM
Jürgen I've posted some updated code for the sound card. The sound card firmware can not be updated through OP Config. In fact the process is not entirely straightforward, I will describe it here briefly.

1. Download and install the Arduino IDE (https://www.arduino.cc/en/Main/Software) if you don't have it already (you need the full version, not the web version).

2. That would usually be enough, but since the processor we are using is actually not an Arduino but a Teensy, you must also install the Teensyduino plugin (https://www.pjrc.com/teensy/td_download.html), this permits the Arduino IDE to communicate with Teensy devices. During install allow it to include all extra libraries.

Now you have two options for loading the sketch:

3. If you are interested in the code, download the source from GitHub (https://github.com/OpenPanzerProject/OP-Sound). Click the green button at the top right labelled "Clone or Download" and select "Download ZIP." Unzip the file on your computer and put the contents into your Arduino sketches folder. If you don't know where your Arduino sketches folder is, open the Arduino IDE and look in File -> Preferences, you will see the location specified there.

If you go this route it is also recommended to turn on the optimized SD option by editing the following file (replace "C:\Arduino" with your Arduino install directory):
C:\Arduino\hardware\teensy\avr\libraries\SD\SD_t3.h

Un-comment this line at the top of that file (remove the two "//" at the beginning of the line):
#define USE_TEENSY3_OPTIMIZED_CODE

Save that file and close. Now open the sketch (either through the Arduino IDE or just double-click the OpenPanzerSound.ino file). In the IDE under the Tools menu select Board = "Teensy 3.2/3.1"

Now you can plug in your Teensy and upload the sketch as you normally would in Arduino. You will see the Teensy Loader application automatically open in the background, and the first time you load the sketch you may have to push the button on your Teensy.

Or:

4. If you don't care to view the code, there is an easier way. Complete steps 1 & 2 above. Plug your sound card into your computer via USB. Go to your Arduino installation directory (wherever you chose to install it). Look in the "hardware\tools\" subfolder for a file named "teensy.exe" You may want to put a shortcut to this on your desktop. Open that program, it is the Teensy Loader program. You don't need to open the Arduino IDE at all or modify any files. From the Teensy Loader program select Open Hex and select the Hex file I have attached below. You might have to push the button on your sound card for the Teensy Loader to recognize it. Then click Operation -> Program (or just push the button with the green down arrow). That's it, new firmware loaded.

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 06, 2017, 10:28:23 PM
I made two changes to the firmware. First, the machine gun sound problem should be fixed.

Second, I disabled the automatic volume calibration. Now it is more simple. Volume is whatever you set it. If two sounds are playing, it is possible for total gain to exceed 1 and you may get distortion. But that is the same behavior as all other products available today.

I have also made a change to the way the relative volume sliders work in OP Config (you don't have to download new version of OP Config or TCB, change only happens on sound card). Now the sliders represent absolute volume levels for each category. If you set engine to 80% then engine volume can never exceed 80%. Basically these are now absolute adjustments, no longer strictly relative (I will update documentation later after more testing). If you want all volumes to reach max, just set all three to 100%.

Hopefully this makes more sense.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on September 06, 2017, 11:59:56 PM
Hi Luke,
I will try update firmware carefully at the weekend with my new Workstation. 
Switching the workstation is a huge job and takes a lot of time.  :o
I think we have time enough bevore new TCB reach the market
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on September 12, 2017, 02:22:38 AM
Hi Luke,
Firmware is now up to date.
With teensy.exe is absolute easy... :)
The simultaneous sounds now sound much better.

Is the general Volume of the Sound card adjustable by Transmitter?
The Function "Set Volume" is greyed out...

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 12, 2017, 11:21:52 AM
Is the general Volume of the Sound card adjustable by Transmitter?
The Function "Set Volume" is greyed out...
Yes! This function should not be greyed out. Either it will be missing from the Function list altogether (if you have selected Benedini or Taigen sound card), or it will be present. But you can only assign it to an "analog" Trigger Source (such as a pot or lever on your transmitter). If you do not have an analog trigger source defined then you won't be able to use it.

There should never be a greyed out item in the Function List, if you see one please send me a screenshot.

If you still can't get it to work post your OPZ file for me to look at. 
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on September 13, 2017, 12:06:43 AM
Hey Luke,
youré right!  ;D
I do not have defined an analog trigger source..... 8)
Sometimes i am so stupid! :o
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 13, 2017, 12:43:43 AM
That's ok! It's a lot to remember I know. :)
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: dannydeleon on September 25, 2017, 09:11:09 PM
Hi Luke,

 I also have your prototype open panzer sound card and have been doing some testing. I've updated the sound card firmware using teensy.exe and have set the 3 Sound sliders in OP Config to about 90%. I am using a Visaton FRS-7 8ohm speaker. I am getting really bad distortion when the engine and MG sounds play simultaneously. Individually, they soung great. I am just using your test soundset for now. Any suggestion on resolving this? Will a 4ohm impedance speaker help or using an amp? I can upload a video if you want to hear it.

Thanks, Danny
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 26, 2017, 12:00:20 AM
This is not a fault, but rather the consequences of the trade-off we were discussing earlier. If we need the maximum possible volume from any given sound at any given moment, we must accept distortion when multiple sounds are played simultaneously at full gain. But if we want to eliminate the possibility of distortion we have to limit individual sound volumes during synchronous playback at high overall volumes.

There is nothing you can do about it other than to adjust the volumes to 50/50 (or some other ratio lower than 90/90) or else only play multiple sounds when total volume is something less than 100% (you can adjust the overall volume from the transmitter using a function mapped to an analog channel). My original code took care of this automatically but as Jurgen pointed out the dynamic adjustments were definitely noticeable.

Using a 4-ohm speaker is a good idea. It won't directly address the issue discussed here but it will give you a louder sound for any given volume setting, so you could perhaps operate at less than 100% and thereby avoid distortion.

Ultimately we can re-design the board for a more powerful amplifier, with the same strategy as just described - if we make the total volume potential greater than actually required, the user can operate below 100%, leaving unused volume capacity available for distortion-free synchronous sound.

These limitations are common to any audio project. We perhaps do not notice them on other products because they pre-restrict the volume to begin with in order to avoid distortion, but here we give the user perhaps too much control such that the inner workings are more observable.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 01, 2017, 08:09:37 PM
Jürgen has provided the first user-submitted sound set, for the "Panther G with Flammvernichter." I presume this would be appropriate for probably any Panther G?

I've posted it to GitHub here: OpenPanzerProject/Sound-Files/SoundSets/OpenPanzerSoundCard/ (https://github.com/OpenPanzerProject/Sound-Files/tree/master/SoundSets/OpenPanzerSoundCard)

Click on the Zip file then click on the Download button. Unzip the file and copy the sounds to your Micro SD card, stick the card into your sound board and off you go.

You will notice a "README.txt" file included with the sounds. This will include some recommended settings for your TCB. For example, we want to set the length of the "Transmission Engage Delay" to the length of time of the engine startup sound (this prevents you from driving the tank while the engine startup sound is still playing). This information and other similar settings will be in that readme file.

Thank you Jürgen!

Any other sound sets I receive I will post to the same location.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 01, 2017, 08:15:58 PM
Jürgen I'm curious, what is your thought about the volume level of the sound card? Do you think it is loud enough for 1/16 scale operations?

I am using a Visaton FRS7-4 which is a 2.5" diameter, 4-ohm speaker. I don't have it in an enclosure, which would probably help. It seems pretty loud to me but I do all my testing on my desk rather than outside in an actual model, so that is not a good test in real conditions.

I am going to order the FRS8-4 (3.3" diameter) to see if the larger size makes any difference or not...
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on October 06, 2017, 06:44:50 AM
Hi Luke,
I test with a Tamiya Tiger Speaker and with a Visaton FR8.
Both are very loud and I have reduce the volume to 50%.
The next File come this Weekend...
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 06, 2017, 03:01:33 PM
Thanks for the feedback. I have contemplated a re-design using a higher wattage amplifier but I'm not convinced it's necessary. It would seem you do not think so. I will do some more testing with different speakers and leave the option open, but not pursue it for now.

I appreciate the sound files that you are creating. I thought the Panther G sounded good, and you did not even begin to exhaust the capabilities of the sound card. I assume you have seen this video, and perhaps it is even what you used for your source:

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 07, 2017, 09:04:01 PM
I have released an update to the OP Config software that will allow you to update the firmware on all Open Panzer devices, including the Scout and this Sound Card. There is a drop-down box on the Firmware tab that lets you select your device, and then you can download the latest firmware (or use your own hex, for example if I provide a test firmware here on the forum).

You do not need to install any special drivers for the sound card, Windows will already have them. The first time you connect your card to your computer let Windows install the drivers automatically.

The flash procedure for the sound card is a little different than the TCB. Connect your sound card to the computer using a standard USB cable. You don't need to worry about the COM port in OP Config, it will find the sound card automatically.

After you click the Flash button in OP Config, you must then press the small physical button on the top of your sound card. Once you press the button OP Config will detect the device and complete the firmware update.

I don't think the firmware for the Sound Card (or the Scout) will change very often. But if it does, this will make it easier for you to update, you no longer need to use the Arduino IDE or install any other software besides OP Config.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on November 08, 2017, 12:45:19 AM
Jürgen I'm curious, what is your thought about the volume level of the sound card? Do you think it is loud enough for 1/16 scale operations?

I am using a Visaton FRS7-4 which is a 2.5" diameter, 4-ohm speaker. I don't have it in an enclosure, which would probably help. It seems pretty loud to me but I do all my testing on my desk rather than outside in an actual model, so that is not a good test in real conditions.

I am going to order the FRS8-4 (3.3" diameter) to see if the larger size makes any difference or not...

Hi Luke,
now i did a step forward....
I have not compared the Open Source Sound Device (OSSD) with other Sound Devices yet

Last weekend i fit the OSSD in the Aeromate Panther II, the FR8JS 8Ohm Speaker is located in under the "Motordeck":
(http://www.hyperstation.de/BBP2/P2-31.jpg)

Volume is full up - right next to the panther it is loud enough
5 m further away, it is already quiet ..... an 10m away it is very quiet.
The Benedini TBS is much loder......
I a Amplifier a Solution?
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 08, 2017, 01:15:36 AM
It would be better if you used a 4-ohm speaker, you would achieve twice the wattage. However yes, you can also add an external amplifier (connect it to the LINE OUT header). Then you can have as much power as you want but of course it is not an ideal solution.

I have considered designing a new board with a more powerful amplifier. I don't know when I will have time, but if volume will be a limit then it would be better to make a new design now rather than to promote a product that will be disappointing.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on November 08, 2017, 08:13:24 AM
It would be better if you used a 4-ohm speaker, you would achieve twice the wattage. However yes, you can also add an external amplifier (connect it to the LINE OUT header). Then you can have as much power as you want but of course it is not an ideal solution.

an external amplifier is now the easiest way to fix the loudness...

I have considered designing a new board with a more powerful amplifier. I don't know when I will have time, but if volume will be a limit then it would be better to make a new design now rather than to promote a product that will be disappointing.

on the desk it was really loud .... 50% volume was enough.
But built into the model, it is too quiet ...
that may be because of it the sound goes upwards out of the tank
and the hull is build of Aluminium....
there come some causes together
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 09, 2017, 07:16:39 PM
I will start working on a new design with a larger amp. We can still continue testing this card because nothing will change but the volume.

Although if anyone has other hardware change suggestions, now is the time to mention it!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on November 10, 2017, 12:32:04 AM
Hi Luke,
if possible
- all connectors at one side
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 11, 2017, 05:38:25 PM
Thanks for the suggestion. I will consider that, but may not be practical.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on November 21, 2017, 01:11:43 PM
Good afternoon. I'll ask you a question.
Luke, I looked at the table of possible sounds and didn't see the recharge of the gun. I think he'd be useful.
Do not calculate a second to understand whether your tank weapon has been charged or not, but to hear the sound of the recharge and then gently press the gunshot button.
I hope I'm sure of the idea.
Respectfully, Denis
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 21, 2017, 07:01:43 PM
Deny, I understand some of your post but part of it is not translated in a way that makes sense to me.

If the re-loading sound is to occur immediately after cannon fire, you can simply include it in the cannon fire sound.

If the re-loading sound is to occur prior to the cannon fire as you suggest, I think this will be impractical because it will lose synchronization with the physical effects on the TCB (recoil, flash, IR, etc.)

Perhaps the best solution is to assign the re-loading sound to a "user sound" (user1.wav for example) and then control it manually whenever you want.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: johnnyvd on November 22, 2017, 05:05:53 AM
I think that what Deny means is that he cannot hear an audible cue that he can fire the cannon again.

A solution for him would be to match the sound length and the "loader" shouting "cannon loaded" or something else like "plug your ears" or "Deny you can now push the fire button" etc..
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: johnnyvd on November 22, 2017, 05:07:30 AM
Although if anyone has other hardware change suggestions, now is the time to mention it!

Err, dual channel/amp with seperate sound channel for engine and cannon fire?

*edit* is it possible to connect two open sound cards to one TCB?
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on November 22, 2017, 05:37:00 AM
Hi, John! You're right, I'm talking about it.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 22, 2017, 02:00:54 PM
I think that what Deny means is that he cannot hear an audible cue that he can fire the cannon again.

A solution for him would be to match the sound length and the "loader" shouting "cannon loaded" or something else like "plug your ears" or "Deny you can now push the fire button" etc..
Aha! Yes I understand now. In fact that is a very good idea and yes it is certainly possible. I will add this feature soon and let you know when it is available. Thank you for the suggestion.

Err, dual channel/amp with seperate sound channel for engine and cannon fire?

*edit* is it possible to connect two open sound cards to one TCB?
I have not tested it but yes there should be no problem attaching two (or more) sound cards to the TCB. And since the sound card already has dual connectors it will be no problem to daisy-chain them without making any weird Y-cables. Of course it might not sound very good if both are playing the same sound at the same time, but I understand your intent to be - put all engine sounds on one card and all effects on the other. I see no problem with this.

As for the other option - dual channel amplifier with different sounds out different channels - I will consider it. My hesitation would be the size increase but I will explore the idea and see what I come up with. I have not had much time to work on the new design lately, so I guess the good news I haven't gotten very far into it...
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on November 25, 2017, 11:42:29 AM
I think that what Deny means is that he cannot hear an audible cue that he can fire the cannon again.

A solution for him would be to match the sound length and the "loader" shouting "cannon loaded" or something else like "plug your ears" or "Deny you can now push the fire button" etc..
Aha! Yes I understand now. In fact that is a very good idea and yes it is certainly possible. I will add this feature soon and let you know when it is available. Thank you for the suggestion.

Hi Deny, just to let you know I have added a sound to notify the user that the cannon is ready. The sound name should be "reloaded.wav"

You will need to update the firmware on both your TCB and your sound card. You can do this easily through OP Config.

Then just place the "reloaded.wav" sound on your SD card and it will play when the Cannon Reload Time has expired after firing the cannon. This time is determined by your tank's weight class - you can use one of the standard Tamiya weight classes, or define a custom weight class. See the Battle tab in OP Config (http://openpanzer.org/wiki/doku.php?id=wiki:opconfig:tabs:battle) for weight class settings. The active weight class is then selected by using the dipswitches on your TCB.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on November 25, 2017, 01:59:50 PM
Hi, Luke.
This is great news.
Will try to test.
Thanks for the quick feedback on the idea.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 15, 2017, 07:22:44 PM
Jürgen recently created another sound set, this time for the Panzer III. It is posted to the GitHub page (https://github.com/OpenPanzerProject/Sound-Files/tree/master/SoundSets/OpenPanzerSoundCard).

Thanks Jürgen!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on December 22, 2017, 09:21:34 AM
Hi, Luke!
After the next update TCB V. 0.92.15 stopped playing on the sound module of the file reloaded. wav, all other files are working properly.
Sincerely, Denis
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on December 22, 2017, 10:15:02 AM
Do you have enough ammunition on board?  ;)  :o :P
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on December 22, 2017, 11:07:26 AM
Full ammunition )))
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 22, 2017, 01:22:50 PM
Deny, nothing in the code has change with regards to the reload sound in the last three releases. Please check anything else that might be causing issues:
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 22, 2017, 08:01:52 PM
Deny I just did a physical test with my TCB running 0.92.15 and the cannon reload sound works fine for me.

Light and Medium weight classes reload so quickly (1 and 5 seconds) that the sound is most likely going to be covered up by the cannon fire sound, if your cannon fire sound lasts 5 seconds which it easily could. For testing set the weight class to Heavy (dipswitch 1 and 2 to Off position). This gives a 9 second reload time.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on December 23, 2017, 02:56:20 AM
Hi, Luke.
 the problem was in the dipswitch. when switching to different modes (easy, medium, hard) the tank remained the custom mode. should have been stronger to move the switches to the edge. Now it is ok.
Regards,  Denis
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on December 23, 2017, 03:46:08 AM
The problem is in most cases outside the tank....  ;)

Merry Christmas @ all!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Deny on December 23, 2017, 07:18:53 AM
The problem is in most cases outside the tank....  ;)

Merry Christmas @ all!

straight to the point.

Merry Christmas @ all!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 23, 2017, 11:32:07 AM
the problem was in the dipswitch. when switching to different modes (easy, medium, hard) the tank remained the custom mode. should have been stronger to move the switches to the edge. Now it is ok.

Glad to hear it! My favorite kinds of problems are the ones with easy solutions. :D

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on February 04, 2018, 10:16:57 PM
Just an update on the sound card hardware. After several more rounds of prototyping I now have working version with a 10 watt amplifier (Maxim 9768 chip (https://datasheets.maximintegrated.com/en/ds/MAX9768.pdf)) driven directly by battery voltage. This is compared to the prior version with a 2.6 watt amp running at 5 volts. Believe me when I say the volume on this new one is plenty loud unless your tank has a gas engine.

The only other changes to the design are the removal of the line-out header (I needed the extra space and people probably won't use it anyway), and the addition of reverse-polarity protection. Firmware and functionality are the same.

Some of the other suggestions I received such as moving the headers around or multi-channel audio were ultimately not incorporated into this version.

All the design files are posted to the Downloads page (http://www.openpanzer.org/downloads) for anyone that wants to build one. Attempt at your own risk, and only if you know what you're doing. An inexperienced hobbyist trying to learn reflow soldering can blow through a lot of money before they get a usable result.

Obviously what we really need is for this to be produced. I have a few places in mind that I will approach now the hardware is basically finalized. I wouldn't hold your breath.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on February 18, 2018, 08:20:57 PM
Hi Luke
thanks for the final release of the sound board.
I have concerns about my ability to do re-flow soldering for the board and I was wondering if you think it would be possible to use a soldering iron to do the job as there are a lot of  large items that would be ok for a soldering iron. I have many years experience  soldering as I'm a Comms Tech.
What I was thinking, I would leave some components off the board that I wouldn't use i.e the RF ch connectors and I was thinking of leaving the 10 watt off the board and use flying leads to connect to a ready made 10watt amp board like the  PAM 8610 class D unit you can buy on Ebay for less than $5. 
So the the number of SMD components to solder is only the power supply and a few resistors for the leds.

thanks again
rockchuck
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on February 18, 2018, 11:39:19 PM
Hi Rock, I have no doubt you can hand-solder the resistors and other passive components. But even if you leave off the amp the SD card holder still has to be reflowed, it can't be done by hand.

The real challenge with making this work will not be soldering, but comprehending the circuit design sufficiently that you can competently modify it to interface with other amplifiers. If you understand the schematic then frankly you can probably dispense with the sound board entirely and just use jumper wires directly to a Teensy (which has its own voltage regulator already). Then use something like an SD breakout board (https://www.adafruit.com/product/254).

However I don't want to spend a lot of time troubleshooting that kind of setup for others, so I recommend you only try it if you know what you're doing, like to experiment and tinker, and don't mind blowing money.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on February 19, 2018, 06:04:47 PM
Hi Luke
thanks for your comments. Could I use a Hot Air Rework Station gun to solder the smd parts to the sound board including the Micro SD unit?  Then I could use a soldering iron to solder the connectors and other items that have plastic parts.
thanks
rockchuck
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on February 19, 2018, 06:46:06 PM
You could try, it's up to you. Anything is possible with enough skill, but honestly what you're contemplating doesn't sound any easier than just doing re-flow. You're still going to have to get a stencil and paste the board, after which you can stick it on a hot plate or you can blow it with a hot air gun and risk moving the parts around.

I mean no offense at all, but in my past experience when I receive questions like these it usually means the result you're going to get is probably not the result you're hoping for. Experimenting is good and it's how I learned everything I know, so I'm not discouraging it, but I take no responsibility for the outcome and you need to be prepared to waste money until you get a process down. Ask me how I know...
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 17, 2018, 09:42:33 PM
Been a while, and it's time for an update on the sound card development.

The first hardware version, which is what most of the beta-testers have, featured a 2.6 watt amplifier. Version 2 of the hardware upgraded the onboard amp to a 10 watt version but otherwise remained the same.

Version 3, of which the files are now available (http://openpanzer.org/downloads#sound), adds 3 light outputs and 1 servo output. Presently these outputs are used only in RC mode (when the sound card is controlled directly with RC signals rather than from the TCB). The TCB already has its own light and servo outputs so it doesn't really need the ones on the sound card, but I may add some ability to utilize them anyway at some point in the future.

The firmware has also been worked on extensively. Before now the options for RC control were very limited, and the five RC inputs had fixed function assignments. That has now changed, the sound card now has a wide variety of settings that can be manipulated by the user when used in RC mode, these settings must be put into an ".ini" file (a specially formatted text file), and this file placed on the Micro SD memory stick along with your sound files (when used with the TCB, settings can just be communicated directly from the TCB to the sound card so the ini file is not needed).

I have released a Windows application that I call "INI Creator" which is just a convenient tool to generate the .ini file. You can download it from the Downloads page (http://openpanzer.org/downloads#sound). Again, this application is only needed if you plan to use the sound card in RC mode. If you are using it with the TCB, you can do all your setup in OP Config as usual.

In RC mode, each of the five input channels can now be configured as switch inputs (with up to 6 positions each) with user-selectable functions for each position, but two of the channels can also be assigned as your throttle input (in parallel with your ESC) or optionally as a volume control from your radio (you can always still use the physical volume control). With the servo and light outputs, the Sound Card could now give basic RC models a complete set of engine and user sounds, as well as a cannon effect (with sound, servo recoil, and flash), machine gun effect (with sound and blinking light), and a third light to be used as headlights/second machine gun/whatever.

Hopefully these changes will make the Sound Card a useful product on its own right apart from the TCB. Primarily I am thinking it should be a useful addition to stock Taigen / Heng Long models and the like.

The instructions for using the sound card are slightly different depending on whether you are controlling it via hobby RC or with the TCB, and some of the sound files are different. There are two pages in the Wiki now, one for each application.

Wiki page > Open Panzer Sound Card with TCB (http://openpanzer.org/wiki/doku.php?id=wiki:tcb:tcbinstall:sound_op)

Wiki page > Open Panzer Sound Card in RC Mode (http://openpanzer.org/wiki/doku.php?id=wiki:sound:start)


PS: For those beta-testers with V1 or V2 hardware, you can still use the RC functions and INI Creator, the only thing is you won't have any light or servo outputs.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 17, 2018, 09:48:32 PM
One other feature that has been requested and which I've finally added are "sound banks," which are basically like playlists on your MP3 player (note the sound card requires WAV files, not MP3s).

With the latest firmware update the Sound Card features two banks (A & B) of up to 20 sounds each. Unlike the user sounds which you select directly (for example, "play user sound #7"), with the sound banks you control the list with options like "play next," "play previous," or "play random."

As always there is a specific nomenclature required for your file names, you can read about that in the Wiki at the links I provided above. Sound banks are available both in RC mode and when used with the TCB (when you select the Open Panzer Sound Card in OP Config you will see new sound bank functions added to the function list, and then you just assign triggers to them as usual).

With all the changes that have been made recently I wouldn't be surprised if some bugs have crept in, so if anyone notices odd behavior please let me know here in this thread.

I'd like to do some more testing of these changes but hopefully I am nearing the end of physical development on this device, and then we can turn our attention to possibly finding someone willing to manufacture it.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: KeesK on December 23, 2018, 04:50:48 AM
Hallo LukeZ
Having not the possibility to make my own Open panzer sound card I had to stick to the Teensy 3.2 and the PJRC audio library and card.
This was great for learning, with help from all the information from the previous discussions.
To me it had the advantage that I could build a simple sound system with the information available, I use the standard sounds available on your site.
One thing however stroke my mind for the following reason, building the Panther I realized that you cannot use the standerd sound of the engine in relation to the throttle only for the following reasons:
- the panther was seriosly underpowerd and had a 7 stage transmission
- This meant for instance if it had to crawl a 30 % gradient it had to work full throttle with a speed of 5 - 6 km/h
- So the relation between the stick of your transmitter and the sound of the engine is not proportional.
I can solve this with the PJRC audio board and an measurement of the amps usign a pololu Amp measurement board, meaning high current high volume low current low volume. Here comes in the stereo handy while I can use one channel for the motor sound only and the other channel for the other sounds, a cannon blast can now always have the rigth volume
There is only one thing which is not clear to me and I'll appreciate it if you can help me with that, what is the signal from the TCB going into the teensy 3.2, port 0 and 1?
For other purposes I use the signal coming straigth from the reiver as integers, so no post processing over there.
Please inform, thanks. In case of questions or remarks  please inform
Regards Kees
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 23, 2018, 02:42:06 PM
There is only one thing which is not clear to me and I'll appreciate it if you can help me with that, what is the signal from the TCB going into the teensy 3.2, port 0 and 1?
This is the Serial1 port on the Teensy. All commands from the TCB to the Teensy are transmitted over serial. Without that connection, the TCB can't tell the Open Panzer Sound Card to do anything.

Of course the Open Panzer Sound Card also has inputs for use directly with an RC receiver, perhaps that is what you are testing. In that mode, the TCB is not used at all. It is an option for those wanting to use the sound card in other models that do not have a TCB. Functions and features will differ between the two modes.

You can not use RC input with the TCB, you must use serial.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on February 28, 2019, 12:52:40 PM
Hi everyone!

I'm new in electronics and the only thing that I can recognize on a schematic is DC+ and - :D
Leaving the joke, can I replace SMD parts to THT parts somehow? Did you make or can you send me a THT EAGLE board?
Or is it possible somehow? I van make PCB for the amplifier and I can solder the MicroSD car but little SMD-s are hard to soldering for me :(

Thank you for your help

Adam
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on February 28, 2019, 01:56:45 PM
hallo,
take a look above...
there is a button called Downloads
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on March 02, 2019, 12:07:12 AM
I'm new in electronics and the only thing that I can recognize on a schematic is DC+ and - :D
Leaving the joke, can I replace SMD parts to THT parts somehow? Did you make or can you send me a THT EAGLE board?
Or is it possible somehow? I van make PCB for the amplifier and I can solder the MicroSD car but little SMD-s are hard to soldering for me :(
Hi Adam,

Even the SD card holder is difficult to hand solder, I really wouldn't do it myself even, not because it is so small, but because of the design the pins are inaccessible and you really need to do reflow to secure it well.

It is an interesting question if a simplified version of the sound card could be made with off-the-shelf parts that would involve more or less minimal soldering and no SMD components. As always there are complications to everything, the SD card is one complication as already mentioned. There is one SD card shield for the Teensy (https://www.pjrc.com/store/wiz820_sd_adaptor.html) but the design of it hides the reset button on the Teensy which you actually need to flash firmware. Nothing is ever easy. On the other hand, cheap amplifier breakout boards are widely available on eBay and Chinese sites so that part is convenient.

I am giving this some thought and I plan to test a few components. The short answer is that right now there is no good way, but if I come up with something I will post here again with my findings.

At the same time I am pursuing some possibilities of production for the existing design (not through Hobby King). I hesitate to mention it because there is no guarantee any of these efforts will bear fruit, but I am trying.

Nothing is going to happen quickly, but the project has not been abandoned completely.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on March 16, 2019, 11:48:49 AM
On the other hand, cheap amplifier breakout boards are widely available on eBay and Chinese sites so that part is convenient.

Hey Luke, thanks for your reply!

I was thinking about those kind of cheap amps because I used them in similar HL and other electronics, but -as I mentioned before - was afraid of ruining something because maxim amp has a lot of soldering pads (and not legs for making soldering harder :D )

I ordered a lot of spare smd resistors and diodes so I can practice soldering them.

Should I buy hot air soldering base?

At the same time I am pursuing some possibilities of production for the existing design (not through Hobby King).

interested :)
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on March 22, 2019, 10:42:24 PM
Should I buy hot air soldering base?
I have never needed to use a hot air station, though it might have come in convenient at times. I would invest in a good soldering iron over a hot air station, I use the Weller WLC100 (https://www.amazon.com/Weller-WLC100-40-Watt-Soldering-Station/dp/B000AS28UC) and an ST7 fine tip (https://www.amazon.com/Weller-ST7-Conical-Solder-Hobbyist/dp/B0002BSP4K). But there are some things an iron simply can't do. For reflow soldering I use a cheap electric hot plate (like what you get for cooking).

I have no progress to report on the DIY sound card idea. I'm still waiting on some parts from China to do more testing with.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on April 23, 2019, 12:41:03 AM
Hi Luke
I have built a prototype  sound card on a breadboard with a teensy and the add-on SD card board that stacks on top of it.  I am using a 10 watt amp module bought from ebay cheap and I have the 5 volt supply etc on the board and the activity leds.
I can't get the OP software to recognize the teensy although the led is lite on the teensy but the activity leds are dark.

How do I get the OP Sound card firmware into the Teensey I assume this is required. The installation details for the sound card are a bit vague. I have loaded the test sound files with the correct file names etc on the sd card and inserted that into the Teensy.   Does the Teensy firmware get uploaded over the serial port from the TCB?? If so how do you initiate that??
Access to the reset button on the Teensy with the SD board stacked on top is not a problem provided you use suitable height riser pins to solder the two boards together.

Thanks
rockchuck
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on April 23, 2019, 01:17:40 AM
To get the firmware on the Teensy just plug it into your computer using a USB cable. Then open OP Config, go the Firmware tab, select "Sound Card" in the Hex file drop-down list, then click the "Get Latest Release" button which will download the latest firmware. Now click the "Flash" button, OP Config will then wait until you press the button on the Teensy and when it detects that it will load the firmware.

After that the Sound Card is ready to go, you can control it either with RC or with a cable to the TCB. To adjust sounds all you have to do is change the sounds on your SD card, and any other adjustments are made with INI Creator or OP Config. You shouldn't need to load the firmware again unless new features are added later.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on April 23, 2019, 05:16:44 AM
Thanks Luke.
I tried that but the Teensy won't connect. My pc came up with "failed to load driver file for Teensy".  Where do i find the drivers I need for this as my pc won't recognize the Teensy so the OP software can't make a connection.

thanks
rockchuck
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on April 23, 2019, 06:18:47 AM
OK I got the Teensy loaded. My pc keeps telling me it can't load the driver but just ignore that, The issue was a sequence problem. When you go to Firmware in OP config and click on the Sound card tab, then click "get latest fw" there is no further prompt until you click the Flash" button then a warning pops up telling you to push the reset button on the teensy. Only it is too late!!! and the flash upload fails.

So when all else fails read the instructions!!! So went to Teensy site and for you to flash the Teensy you must push the reset button first !!  you will notice that the flashing led on the Teensy goes out (the flashing led is the default program) THEN you click on the Flash button in OP Config and then the bastard loads!!

OK so now I have the blue led on the Teensy sound card slowly blinking-- it turn hard on when I send command ie fire gun etc then when command is completed it goes back to slow blink. So something is working but no sound--so will do further investigation--stay tuned
cheers
rc
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on April 23, 2019, 01:17:30 PM
OP Config gives you 10 seconds to push the button on the Teensy, the flash operation doesn't actually start until it detects the button press. But anyway, you have figured it out.

I deduce that you are using the Sound card with the TCB rather than in RC mode. If you get no sound, it could be a wiring issue with your amp, or you might also want to double-check that your sound files are named correctly and saved in the right format (16 bit and 44,100 Hz WAV).

Some users have developed some sound sets for the OP Sound Card which you can download here (https://github.com/OpenPanzerProject/Sound-Files/tree/master/SoundSets/OpenPanzerSoundCard), if that helps with testing. At least then you know the sound files are not the problem.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: rockchuck on April 26, 2019, 06:10:40 AM
Thanks Luke.
I got it going, there was a few mishaps-- I was sure I had loaded the sd card with the sound files--  anyhow I checked again and " no sound Files"!!  Anyhow I used the files you listed and tried again. The Teensy activity leds were showing all the right responses just no sound so rechecked all my connections and found the problem in a wiring issue. So once fixed I had sound!  Very happy chappy!! :D

I am using a PAM8610 amp module that I bought online for a few dollars. They are rated at 15 watt into 4 ohm  at 12 volts supply (but at about 10% distortion.).
 So can't have the input to amp up too much as it distorts. I am using a chan on the radio with a pot to control the volume.
Using the 2s supply in a tank which is 7.2volts the amp output is a lot lower around about 6 watts.  It is still quite loud as I'm testing with a Visation FSR7 speaker that has a sensitivity rating of about 88db --not bad for a small speaker.

There is quite a lot of background hiss/noise which I think is due to poor power supply coupling on the amp board as I move the cabling around and the noise levels change.
So my next stage is make a pcb for it which I can hand solder and work out how to fix the amp module to the board as I think you need to keep all the wires as short as possible.
I looked at building the OP Sound card but was a bit unsure about how I would cope with the smd components and with a complete kit with all the parts and a lot of postage charges each board would cost me $120 Aud to make so stuffing a board would be expensive-- I have 15 TCB units that I want to make sound cards for so it is too expensive to go this way.

I can make this stripped down bare bones board for about $50 Aud and I think the sound quality will be good enough. I may have to look at a mute cct that can disconnect the speaker when the TCB/ Sound card boots up as there is a lot of pops and cracks getting into the speaker before the unit is ready. I assume some of this is from the cheap amp board so some more investigation is required.

cheers
rockchuck
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on April 26, 2019, 03:58:31 PM
Glad to see you making progress. Noise issues are definitely a challenge on these circuits and it gets worse the higher the amplification, 15 watts is a lot.

The PAM8610 does have a MUTE pin, but I don't know if it is broken out on the board you bought or not. If you can access it, connect it to Pin 14 of the Teensy. The mute pin on your PAM operates in the same manner as the amp we are using on the official OP design (V2 and later hardware), which is to say, a logic level HIGH on the pin mutes the amp and a logic level LOW enables sound. The firmware is already written to keep the amp muted during boot-up for the reasons you mentioned, and it also automatically mutes the amp anytime a sound is not playing which eliminates noise during static moments. You may want to also add a resistor to that mute line pulling it up to VDD (+5V) so that even before the microprocessor has time to get started the MUTE line will be held high (see the schematic (http://www.openpanzer.org/downloads/soundcard/eagle/OP_Sound_v3_r1_Schematic.pdf) for the OP sound card for how I've done it).

That will help, but as for the rest you are right, you need to keep the wires/traces as short as possible and away from wires/traces that carry other signals. One thing I noticed a big problem with was two-way receivers like the FrSky and others, in those cases you want to keep the RC antenna as far away from the amp as possible.

I have 15 TCB units that I want to make sound cards for. . .
Good heavens! I think you set the record. I should have been so forward thinking.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: johnnyvd on April 29, 2019, 06:35:30 AM
I finally got to reflowing the Open Sound Cards.. Quite easy actually with a stencil and reflow oven!
The biggest challenge is orienting the led's in the right way!

But even with my old eyes (without glasses  ;D) i managed to position all parts in the right way! (i know, some ar upside-down)..
I will take care with the next ones in the series! Still 10 to go!

Next up is the Scout!

*edit: pictures as attachments..



Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: jhamm on April 30, 2019, 04:02:26 AM
No Pictures... :-\
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on April 30, 2019, 02:37:38 PM
Glad to hear someone having success with reflow, it's fun when it works.

Feel free to upload your images to the forum rather than link them to an external site, although I know the one drawback of that is that the forum doesn't do inline attachments.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on May 13, 2019, 04:00:37 PM
It is an interesting question if a simplified version of the sound card could be made with off-the-shelf parts that would involve more or less minimal soldering and no SMD components. As always there are complications to everything, the SD card is one complication as already mentioned. There is one SD card shield for the Teensy (https://www.pjrc.com/store/wiz820_sd_adaptor.html) but the design of it hides the reset button on the Teensy which you actually need to flash firmware. Nothing is ever easy. On the other hand, cheap amplifier breakout boards are widely available on eBay and Chinese sites so that part is convenient.

I am giving this some thought and I plan to test a few components. The short answer is that right now there is no good way, but if I come up with something I will post here again with my findings.
Just a brief update, I tried experimenting with various cheap off-the-shelf amplifiers that you can get on eBay, AliExpress and elsewhere and the results have not been good. The sound quality is very poor and/or the volume level is far too low. Most of these only run on 5 volts or less and are rated under 3 watts. Clean audio circuits are tricky enough with a well-designed PCB, but as soon as you start hacking and wiring in a DIY fashion the AC circuits are that much more prone to interference which translates to noise out the speaker.

As Rock has shown it's possible for the tinkerers out there to make something work but from my end I've decided not to invest time in a separate DIY/or through-hole version because I think the end result would attract limited interest and also ultimately not meet standards.
Title: The sound card can't work in RC mode
Post by: luckowner on July 21, 2019, 08:19:00 AM
I'm very interested in your Open Panzer Sound Card,and I have made one myself.I use it in RC mode,but the Mute pin is always high even in the test mode.I don't know why . I donwload you source code and always put the Mute pin to low , it works in test mode, so I think there is no problem in the hardware.There is many noise, because the Mute pin is always low.Any suggestion?
Here is a video of my system
The yellow Led is bling, so the audio is playing ,but no sound.When I foced Mute pin to low ,it works.What is the mistake?
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 21, 2019, 01:25:08 PM
Hi Luckowner. There might be a bug in the sound card firmware, I have posted an update (v0.93.50). Please re-flash your soundcard with this update and let me know if that fixes it.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 21, 2019, 09:08:03 PM
Hi Luckowner. There might be a bug in the sound card firmware, I have posted an update (v0.93.50). Please re-flash your soundcard with this update and let me know if that fixes it.
It realy works! Thank you. I use this card on my 1/14 Scania truck,it's too big for me. So my next step is to make a little one base on your hardware.In fact,design has been completed but production has not yet started. I am not sure if I can make one without teensy, so all the components can be placed on one board. It is very important to me because I want to make it as small as possible.
The attach picture show my first design with teensy.  I'm trying to avoid using it.This board is 23*52mm I think I can make it more small.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 21, 2019, 09:21:51 PM
Very good! Thank you for bringing this to my attention as it is important to fix any bugs or errors in the code.

I do not think it will be very easy to eliminate the Teensy, but you can try. In addition to the main MK20DX256VLH7 processor which you can obtain anywhere, you can purchase from PJRC a pre-loaded bootloader chip that will give you compatibility with Teensyduino, see this link (https://www.pjrc.com/store/ic_mkl02.html). There are two options, both have the same functionality, but the MKL02 is smaller in size. You can then follow the Teensy 3.2 schematic  (https://www.pjrc.com/teensy/schematic.html)to match up the MK20DX256 pins with "Teensy pins."

The designer of the Teensy, Paul Stoffregen, has said before that routing for the Teensy 3.2 was a difficult job and I believe him. However you will not need to use very many pins so that will be some help to you. If you are good at board design and routing I am sure it is possible, but it may not be worth the effort. Already your board design is considerably smaller than mine.

Regardless, keep us updated on your progress!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 22, 2019, 12:34:59 AM
Very good! Thank you for bringing this to my attention as it is important to fix any bugs or errors in the code.

I do not think it will be very easy to eliminate the Teensy, but you can try. In addition to the main MK20DX256VLH7 processor which you can obtain anywhere, you can purchase from PJRC a pre-loaded bootloader chip that will give you compatibility with Teensyduino, see this link (https://www.pjrc.com/store/ic_mkl02.html). There are two options, both have the same functionality, but the MKL02 is smaller in size. You can then follow the Teensy 3.2 schematic  (https://www.pjrc.com/teensy/schematic.html)to match up the MK20DX256 pins with "Teensy pins."

The designer of the Teensy, Paul Stoffregen, has said before that routing for the Teensy 3.2 was a difficult job and I believe him. However you will not need to use very many pins so that will be some help to you. If you are good at board design and routing I am sure it is possible, but it may not be worth the effort. Already your board design is considerably smaller than mine.

Regardless, keep us updated on your progress!
I think Paul Stoffregen is right too, but I will try. I'm following the schematic. The mirco usb part is not necessary for this card,and I can put all the pin at one side.Two side board is enough and difficulty will be greatly reduced.
Just a suggestion, why don't you use stm32? Of couse ,Freescale is more powerfulIt, but stm32 is more cheap and more popular.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 22, 2019, 11:36:13 AM
STM32 might also be a good choice, but I already had experience with ARM and the work PJRC has done, especially with the Audio library (https://www.pjrc.com/teensy/td_libs_Audio.html), has saved us hundreds and probably thousands of hours of work. Because I don't have a lot of free time and no one is paying me to do this I try to use what will be the most direct route to the goal!

If anyone wants to port my code (either the sound card or the TCB) to STM32 that would be an interesting project and they are welcome to do so.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 23, 2019, 08:43:38 AM
STM32 might also be a good choice, but I already had experience with ARM and the work PJRC has done, especially with the Audio library (https://www.pjrc.com/teensy/td_libs_Audio.html), has saved us hundreds and probably thousands of hours of work. Because I don't have a lot of free time and no one is paying me to do this I try to use what will be the most direct route to the goal!

If anyone wants to port my code (either the sound card or the TCB) to STM32 that would be an interesting project and they are welcome to do so.
I want to try but I think the first thing is to design a little board. Another bug .When I set RC 5 to switch mode there is no use. I'm following your code but I think it will take some time. And a suggestion, can your make some sound at a specific  speed? For example, when the truck is backing up ,there is always a Beep. I am trying to followyour code and make some changes. The big logic is basically understood.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 23, 2019, 01:23:37 PM
Can  you describe in more detail the issue with Switch 5? Is it a problem specifying the switch function in INI Creator? Or does that part work but the function doesn't trigger correctly on the sound card itself?

Can you also post your INI file?

I will think about the engine speed request. All that sort of thing is possible with the TCB but the configuration framework on this device is much more simple as you can see (no dynamic allocation of functions with triggers). In the meantime, if you are using a programmable transmitter you can accomplish what you propose with a transmitter mix. But it depends on your transmitter, it is true that most pistol-grip car radios do not have that level of programmability.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 23, 2019, 10:23:43 PM
Can  you describe in more detail the issue with Switch 5? It is a problem specifying the switch function in INI Creator? Or does that part work but the function doesn't trigger correctly on the sound card itself?

Can you also post your INI file?

I will think about the engine speed request. All that sort of thing is possible with the TCB but the configuration framework on this device is much more simple as you can see (no dynamic allocation of functions with triggers). In the meantime, if you are using a programmable transmitter you can accomplish what you propose with a transmitter mix. But it depends on your transmitter, it is true that most pistol-grip car radios do not have that level of programmability.
I think I have made a right INI file, and I will post it in the attachment. RC3 make sound when turn left or turn right. RC4 is two kind of horn. RC5 is a beep sound during backing. I'm using a programmable transmitter graupner mc 20. And RC1-RC4 have the right output,but rc5 don't work.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 23, 2019, 11:12:33 PM
Thanks. I see now the forum would not allow posting .ini files, I have changed that for anyone in the future who needs to attach one.

Anyway, here again we have another bug which I have fixed, and you will need to flash new firmware (v0.93.51).

Very few people in the world have even tested one of these sound cards, and I think even of those few people they are all using it with with the TCB - in other words, not in RC mode as you are. Therefore I am not surprised you are finding some bugs. I do appreciate your testing which is helping me perfect the firmware.

Let me know if you notice anything else strange!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 24, 2019, 07:54:58 AM
Thanks. I see now the forum would not allow posting .ini files, I have changed that for anyone in the future who needs to attach one.

Anyway, here again we have another bug which I have fixed, and you will need to flash new firmware (v0.93.51).

Very few people in the world have even tested one of these sound cards, and I think even of those few people they are all using it with with the TCB - in other words, not in RC mode as you are. Therefore I am not surprised you are finding some bugs. I do appreciate your testing which is helping me perfect the firmware.

Let me know if you notice anything else strange!
It works and I think I will use TCB, but I want a small one. So I need to design another hardware base on yours.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 26, 2019, 08:30:06 PM
Thanks. I see now the forum would not allow posting .ini files, I have changed that for anyone in the future who needs to attach one.

Anyway, here again we have another bug which I have fixed, and you will need to flash new firmware (v0.93.51).

Very few people in the world have even tested one of these sound cards, and I think even of those few people they are all using it with with the TCB - in other words, not in RC mode as you are. Therefore I am not surprised you are finding some bugs. I do appreciate your testing which is helping me perfect the firmware.

Let me know if you notice anything else strange!
Hi LukeZ,I have a question in design a diy teensy. Teensy mainly based on MK20DX256VLH7. And the pre-loaded bootloader chip make it possible for teesny to load arduino code.So if a want to design a teensy based boad.I can just make two board. One is pre-loaded bootloader board with a small bootloader chip and Micro usb on it. The other have MK20DX256VLH7 and the left.Is that right? Do you have any experience if the bootloader chip must be attached to the main board anytime?You know it is impoartant for me,because I want to design a very small board. And I have more than 20 models,so I think it’s worth making a new design. Any suggestion?
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 26, 2019, 10:56:43 PM
I have not personally designed a DIY Teensy board myself, so I can't speak from experience. But looking at the schematic (https://www.pjrc.com/teensy/schematic.html) I see no reason why separating the bootloader chip onto its own board wouldn't work (in other words, I think it should work fine).

The only way to know will be to test. Of course you can also get some very good advice at the PJRC forum (https://forum.pjrc.com/). They have a whole section called "Project Guidance" where you can describe your project and ask for input. There have been several threads in the past about people designing their own Teensy-compatible boards and the usual response is that it's not worth the effort especially for low production numbers. But everyone has their own idea about what efforts are worth making. If you have the time and the ability, as it seems you do, then it could be a rewarding experience.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 27, 2019, 12:43:24 AM
I have not personally designed a DIY Teensy board myself, so I can't speak from experience. But looking at the schematic (https://www.pjrc.com/teensy/schematic.html) I see no reason why separating the bootloader chip onto its own board wouldn't work (in other words, I think it should work fine).

The only way to know will be to test. Of course you can also get some very good advice at the PJRC forum (https://forum.pjrc.com/). They have a whole section called "Project Guidance" where you can describe your project and ask for input. There have been several threads in the past about people designing their own Teensy-compatible boards and the usual response is that it's not worth the effort especially for low production numbers. But everyone has their own idea about what efforts are worth making. If you have the time and the ability, as it seems you do, then it could be a rewarding experience.
Unfortunately,my IP is banned.This is my first time to visit PJRC forum and I don't know the problem. I have just send a email , and waiting for replay. Anyway my design is going on, and I will make you know if it works.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 27, 2019, 12:59:51 AM
There is a lot of forum spam going on (as I know from here), but hopefully they will respond to your message and allow you in.

May I ask what country are you located in? I am interested to know all the countries that Open Panzer users are from.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 27, 2019, 03:53:44 AM
There is a lot of forum spam going on (as I know from here), but hopefully they will respond to your message and allow you in.

May I ask what country are you located in? I am interested to know all the countries that Open Panzer users are from.
I am from China. And I have to use a VPN to visit the website in other country.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on August 28, 2019, 03:11:03 AM
There is a lot of forum spam going on (as I know from here), but hopefully they will respond to your message and allow you in.

May I ask what country are you located in? I am interested to know all the countries that Open Panzer users are from.
hi LukeZ
Good news
my DIY teensy works. And I have made the bootloader outside the board. So I have a very small board now.
Next step , I will make the MK1 more small. I find it is wonderful for 1/14 truck model. But it is a little big too. In the same way. I want to make the usb part out of the board. And delate some function. The smoke, light ,and something else .
Thank you again for your wonderful work. I will post all the design when all my work finished.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on August 28, 2019, 01:45:48 PM
Very interesting! I will look forward to hearing more details when you finish the project.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 16, 2020, 09:20:00 PM
Hi LukeZ
   Long time no see. After a long busy day, I finally have time to do something I like. I want to discuss with you some of the problems of engine sound simulation. In fact, I asked you about this issue last year.  For the truck model, or the moving tank model. Keeping the engine sound synchronized with speed and acceleration is important. So I think resampling the sound will be more effective than simply playing another sound. I have found some topics on this issue, and after verification they really work.
There is a discussion about this issue here.  https://forum.pjrc.com/threads/44377-SD-Audio-playback-speed?highlight=Speed+playback
Here is its github.  https://github.com/newdigate/Audio/commit/fe2f8dace558614d8a48cb00fc47aecc0c7a1960
   I'm trying to integrate your content about engine sound simulation.I will delete acceleration and deceleration and so on.The idle sound will be left.  The rest of the engine sound will be resampled to the idling sound. This avoids non-smooth transitions. Can you give me some advice?
   At the same time, in order to make the engine sound more real, some random explosion sounds can be added.
   https://forum.pjrc.com/threads/52942-The-sound-of-a-motor-humming-on-a-teensy-3-2?highlight=Speed+playback
   Best wishes.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 17, 2020, 08:50:03 AM
Hi Luckowner, thanks for bringing those threads to my attention. It seems some progress has been made on the PJRC forums with sound sampling, although I see for now it only works with RAW files. It would be ideal if Paul from PJRC can include this feature into his official Audio library, and maybe he will be able to do so eventually.

Unfortunately I have no time at all for development right now, so I can not be of much help to you. You seem to have come quite far already, I think if you stare at the code long enough you can see what I have done and probably figure out how to make the changes you need. Start small, make one change at at time and test, and through slow experimentation my experience is that you can eventually go quite far. I'm sorry I can't be of more assistance, but I wish you good luck and please let us know if you have success!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 18, 2020, 11:19:35 PM
Hi Luckowner, thanks for bringing those threads to my attention. It seems some progress has been made on the PJRC forums with sound sampling, although I see for now it only works with RAW files. It would be ideal if Paul from PJRC can include this feature into his official Audio library, and maybe he will be able to do so eventually.

Unfortunately I have no time at all for development right now, so I can not be of much help to you. You seem to have come quite far already, I think if you stare at the code long enough you can see what I have done and probably figure out how to make the changes you need. Start small, make one change at at time and test, and through slow experimentation my experience is that you can eventually go quite far. I'm sorry I can't be of more assistance, but I wish you good luck and please let us know if you have success!
I also noticed that Paul said that he plans to update the audio library this summer. Changing the playback speed is one of the important content. So I am going to wait for a while, so that I have more time to do other things.I want to develop a more complete light card based on your serial communication protocol. The purpose is to control many lights on the truck and realize many complex functions. For example, the headlights and taillights of the Scania truck have a flowing water effect.
You have finished controlling the sound and ESC through the serial port in your program, and the serial port protocol is complete. So I think it will be much easier. I am currently reading about the communication between the sound card and TCB. It would be great if you can tell the standard of the protocol, it will save a lot of time.
Best wishes.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 19, 2020, 07:31:44 AM
The protocol is quite simple, for the sound card each "sentence" consists of 5 bytes:

Code: [Select]
        struct DataSentence {                                   
            uint8_t    Address =            0;                 
            uint8_t    Command =            0;
            uint8_t    Value =              0;
            uint8_t    Modifier =           0;                   
            uint8_t    Checksum =           0;
        };

You can see how the bytes are unpacked on the Serial tab (https://github.com/OpenPanzerProject/OP-Sound/blob/master/OpenPanzerSound/Serial.ino) of the Sound Card firmware. Commands are defined in the SoundCard.h file (https://github.com/OpenPanzerProject/OP-Sound/blob/master/OpenPanzerSound/SoundCard.h).

On the TCB side you can see the mapping between TCB functions and Sound Card commands in OP_Sound.h (https://github.com/OpenPanzerProject/TCB/blob/master/OpenPanzerTCB/src/OP_Sound/OP_Sound.h) and you can see the very simple functions for sending the sentence over the serial port in OPSoundCard.cpp (https://github.com/OpenPanzerProject/TCB/blob/master/OpenPanzerTCB/src/OP_Sound/OP_SoundCard.cpp).

The process is basically the same for communicating with the Scout and Sabertooth serial controllers, except those use 4 byte sentences (Address, Command, Value, Checksum) - they don't have the "Modifier" byte.

The Address is unique to each device and prevents the Sabertooth from responding to commands for the sound card, or the sound card responding to commands for the Scout, etc... The addresses are hardcoded, here is the current list:
Pololu Drive - 10 (0x0A)
Pololu Turret - 13 (0x0D)
Sabertooth Drive - 128 (0x80)
Scout Drive - 131 (0x83)
Scout Turret - 132 (0x84)
Sabertooth Turret - 135 (0x87)
OP Sound Card - 218 (0xDA)

If you are just re-creating the sound card where the only difference is the way acceleration/deceleration is handled, just give your device the same address as the OP Sound Card (218). In other words, this is simply an exercise in modifying the existing OP Sound Card firmware, as you have already discussed.

If you are creating a device with all kinds of new features, you will have to give it a different address and then define your commands to do whatever you want (value and modifier are optional). However, I think the problem you will quickly run into is that you will want to issue commands that the TCB doesn't have and doesn't know about (in other words, new Functions). Adding new functions to the TCB requires not only changes to TCB firmware but also changes to OP Config, changes to the wiki, etc, etc...  So that I am probably not going to do.

You may find yourself creating a whole new TCB, or maybe a whole new product entirely. Even so, I hope looking at the code from this project will be useful to you.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: luckowner on July 19, 2020, 09:25:23 AM
The protocol is quite simple, for the sound card each "sentence" consists of 5 bytes:

Code: [Select]
        struct DataSentence {                                   
            uint8_t    Address =            0;                 
            uint8_t    Command =            0;
            uint8_t    Value =              0;
            uint8_t    Modifier =           0;                   
            uint8_t    Checksum =           0;
        };

You can see how the bytes are unpacked on the Serial tab (https://github.com/OpenPanzerProject/OP-Sound/blob/master/OpenPanzerSound/Serial.ino) of the Sound Card firmware. Commands are defined in the SoundCard.h file (https://github.com/OpenPanzerProject/OP-Sound/blob/master/OpenPanzerSound/SoundCard.h).

On the TCB side you can see the mapping between TCB functions and Sound Card commands in OP_Sound.h (https://github.com/OpenPanzerProject/TCB/blob/master/OpenPanzerTCB/src/OP_Sound/OP_Sound.h) and you can see the very simple functions for sending the sentence over the serial port in OPSoundCard.cpp (https://github.com/OpenPanzerProject/TCB/blob/master/OpenPanzerTCB/src/OP_Sound/OP_SoundCard.cpp).

The process is basically the same for communicating with the Scout and Sabertooth serial controllers, except those use 4 byte sentences (Address, Command, Value, Checksum) - they don't have the "Modifier" byte.

The Address is unique to each device and prevents the Sabertooth from responding to commands for the sound card, or the sound card responding to commands for the Scout, etc... The addresses are hardcoded, here is the current list:
Pololu Drive - 10 (0x0A)
Pololu Turret - 13 (0x0D)
Sabertooth Drive - 128 (0x80)
Scout Drive - 131 (0x83)
Scout Turret - 132 (0x84)
Sabertooth Turret - 135 (0x87)
OP Sound Card - 218 (0xDA)

If you are just re-creating the sound card where the only difference is the way acceleration/deceleration is handled, just give your device the same address as the OP Sound Card (218). In other words, this is simply an exercise in modifying the existing OP Sound Card firmware, as you have already discussed.

If you are creating a device with all kinds of new features, you will have to give it a different address and then define your commands to do whatever you want (value and modifier are optional). However, I think the problem you will quickly run into is that you will want to issue commands that the TCB doesn't have and doesn't know about (in other words, new Functions). Adding new functions to the TCB requires not only changes to TCB firmware but also changes to OP Config, changes to the wiki, etc, etc...  So that I am probably not going to do.

You may find yourself creating a whole new TCB, or maybe a whole new product entirely. Even so, I hope looking at the code from this project will be useful to you.
Thank you for your answer, it is really useful. I think the light card will be a new product,  the sound card is just a branch. As your trigger source and actions are already perfect, so I don't think I need to develop some new commands. What I have to do is to focus on developing a new light card hardware.
Model hardware development is a hobby I like very much.  I am very happy to make friends like you through the Internet. Your work makes my truck model more realistic. After the project is completed, I will share all the code and hardware with you. You can decide whether to integrate it into TCB.
Thanks again for your excellent work and best wishes.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on July 21, 2020, 04:02:26 PM
I am looking forward to seeing what you create!
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on September 05, 2022, 04:07:38 AM
Hi Tankers!

Very easy but confusing question. Connecting PCB and sound card serial should be like:
TCB RX  - SOUND TX
TCB TX - SOUND RX
GND - GND

Am I right? I attached a picture but I connect it to the wrong connector just for reference.

Regards
Rongyos
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on September 05, 2022, 08:22:10 AM
Hi Rongyos, your connections are correct!

It is easy to get confused with the labels, but another way to be sure is simply to connect ground (GND) to ground, the middle connector from one is connected to the middle connector of the other, and that only leaves one connector on each board which by default will be connected to each other. This is true for the TCB, the sound card, and the Scout ESC.

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on October 16, 2022, 08:20:41 AM
Hello LukeZ!

Finally I managed to try the sound card. I have a problem: on cold start (first start from tcb startup) there is an unecessary cannon fire before is starting ignition.
I have no cannon fire in the sound file. Soundfiles seems good and other sounds (warmstart too) are working fine.

Can you please help me out in this? I just refreshed the firmware on teensy.

Thanks
Rongyos

Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 17, 2022, 01:09:31 PM
Hi Rongyos, that is a strange problem. What I can say is that the sound card will only play the sound that it is being commanded to play. So there are two basic possibilities:
1. You have a sound file on your SD card that plays the cannon sound, but you gave it the file name for something else (in other words, something other than "cannonf.wav")
2. Or for some reason the TCB is sending the signal to fire the cannon at the same time it sends the signal to start the engine.

For #1, I would put the SD card into your computer and listen to all your sound files once again, just to verify that the cannon sound didn't somehow get named to something else.

For #2, examine all your function triggers in OP Config. Did you maybe link the "Cannon Fire" function to the "Engine Start" trigger by mistake? Did you maybe assign the "Cannon Fire" function to the same switch on your transmitter you are using to start the engine?

You can post your OPZ file if you want me to look at it.

There is something else I noticed in your video, which may or may not be related to your problem. I notice there is a delay of several seconds from the time you flip the switch on your transmitter, to the time when the engine starts. Do you know why that is?

By any chance do you have an engine "Preheat time" specified? (In OP Config on the Motors tab, under the Smoker section, when Type is set to "Separate Heat & Fan").

On your SD card do you have a sound file called "preheat.wav"?

If so, you may want to do a test where you delete "preheat.wav" or set "Preheat time" to 0, and see if that makes any difference.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on October 18, 2022, 03:26:12 PM

1. You have a sound file on your SD card that plays the cannon sound, but you gave it the file name for something else (in other words, something other than "cannonf.wav")
2. Or for some reason the TCB is sending the signal to fire the cannon at the same time it sends the signal to start the engine.

For #1, I would put the SD card into your computer and listen to all your sound files once again, just to verify that the cannon sound didn't somehow get named to something else.

For #2, examine all your function triggers in OP Config. Did you maybe link the "Cannon Fire" function to the "Engine Start" trigger by mistake? Did you maybe assign the "Cannon Fire" function to the same switch on your transmitter you are using to start the engine?

I checked all that options but did not see any suspicious user error (I also checked the radio switch reading on Opconfig everything works fine)


You can post your OPZ file if you want me to look at it.

Yes sir attached

There is something else I noticed in your video, which may or may not be related to your problem. I notice there is a delay of several seconds from the time you flip the switch on your transmitter, to the time when the engine starts. Do you know why that is?

Well I dont know what it is but realized I dont have to use the ignition switch teensy plays it anyway, its like a "startup" sound or IDK... Before that it doesnt play any sound.

By any chance do you have an engine "Preheat time" specified? (In OP Config on the Motors tab, under the Smoker section, when Type is set to "Separate Heat & Fan").
Dont have this LOV, maybe my OPConfig outdated? V.093.51 version installed. Please see the pic attached

On your SD card do you have a sound file called "preheat.wav"?
no sound file

EDITEDIT: no its not a soundfile. The tcb shoots after first startup (it uses the servo once and next action is cannon fire with sound and recoil)... :) strange.
EDIT2: similar with the latest OP app and latest TCB firmware
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 19, 2022, 04:52:58 PM
Hi Rongyos, if I understand you correctly, the cannon fire happens when the TCB first starts. And this involves not only the sound, but also the recoil servo. If that is the case, then we can eliminate the sound card as being related to your problem, it is clear that the TCB is the one firing the cannon.

Plug your TCB in to your computer with a USB cable and connect to it with Snoop (on the Firmware tab of OP Config) to see what is happening. Does the TCB report a "Cannon Fire" event when it first starts?

I wonder if maybe you have Aux Channel 6 in Position 2 when the TCB starts?

I see you have Aux Channel 6 set to "Reversed" in OP Config. Maybe un-reverse it in OP Config, and reverse it in your radio's settings. You can also try changing the cannon fire function to a different aux channel.

I can't say what the problem is, but I am confident it is not an error in the code. Somehow the TCB thinks that the cannon should be fired, which implies that your radio is telling it to. You will have to do some more troubleshooting yourself. Even if you don't solve the problem right away, hopefully you can discover a piece of information that will help us solve the problem.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on October 20, 2022, 04:50:17 AM
Hi Rongyos, if I understand you correctly, the cannon fire happens when the TCB first starts. And this involves not only the sound, but also the recoil servo. If that is the case, then we can eliminate the sound card as being related to your problem, it is clear that the TCB is the one firing the cannon.

Yes, thats the case. Maybe posts related to this issue should be replaced somewhere else, sorry. I didnt put servo on the first try and only heard the cannon fire so I assumed that the sound card is failed somehow.

Plug your TCB in to your computer with a USB cable and connect to it with Snoop (on the Firmware tab of OP Config) to see what is happening. Does the TCB report a "Cannon Fire" event when it first starts?

snoop results attached (on the second try I put the cannon fire switch to channel 16 on radio and there is no cannon fire function triggered anymore) please search for #####First try  and #####Second try keywords

I wonder if maybe you have Aux Channel 6 in Position 2 when the TCB starts?

I see you have Aux Channel 6 set to "Reversed" in OP Config. Maybe un-reverse it in OP Config, and reverse it in your radio's settings. You can also try changing the cannon fire function to a different aux channel.

I can't say what the problem is, but I am confident it is not an error in the code. Somehow the TCB thinks that the cannon should be fired, which implies that your radio is telling it to. You will have to do some more troubleshooting yourself. Even if you don't solve the problem right away, hopefully you can discover a piece of information that will help us solve the problem.

Yes this might be my radio. I recently updated the firmware on this because with the old firmware I could not manage to bind new sbus receiver I use for another TCB. I tried several receivers (Original is  Flysky i8a i-bus, others Radiomaster R191 Sbus and Radiomaster R168 sbus) whit get the same results. Its not related to radio protocols, I think its some failsafe or precheck stuff in the radio but I cannot figure it out myself (disabled preflight and so on but nothing helps). Regarding reverse / not reverse channel I could set this and except this startup issue everything works fine.

Regards
Rongyos

EDIT: I reload the min/max values and stick centers, not helping
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 23, 2022, 02:07:20 PM
Hi Rongyos. I looked at your snoop file. You're right, it is definitely something that is happening at the very beginning, when the TCB first makes a connection with the receiver. There are several functions it runs right away (MG Stop, turn the light off, set the volume) and these are what we would expect to see as it starts reading the channel values and applying the functions that you have set for your switches based on the position they are in (it is easy to see that you have your MG and light switches in the middle position). So everything is working as we would expect, but it also fires the cannon which means that it believes your cannon switch is in position 2.

I know you believe the cannon switch is in position 1. You can try this experiment: instead of starting the TCB with the cannon switch in the "off" position, put it in the "on" position and start the TCB. If the cannon doesn't fire, then it was just a confusion that can be fixed by reversing the channel.

If it fires no matter what, then it might be as you say some kind of failsafe setting. Maybe the TCB boots up faster than your receiver can create a connection to the transmitter. If that is the case, the first signals the TCB reads from the receiver are actually failsafe positions rather than the actual positions of the switches on your transmitter.

You could see what happens if you press the "Reset" button on the TCB. This will cause the TCB to reboot, but it will not interrupt power to the receiver. So your receiver will already be connected to the transmitter when the TCB starts. Does the cannon behave correctly then?

What software are you running on your TX16? If it is OpenTx, here is a video on how to set the failsafe values (https://www.youtube.com/watch?v=wk3eXNFFXHM&ab_channel=RCVideoReviews). I don't know if that is your problem or not, but you could experiment with it anyway. You will want to set the failsafe position of Aux Channel 6 to position 1, so that if the connection between the receiver and transmitter is lost, or hasn't been established yet, the cannon will not fire.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on October 23, 2022, 02:24:03 PM
What software are you running on your TX16? If it is OpenTx, here is a video on how to set the failsafe values (https://www.youtube.com/watch?v=wk3eXNFFXHM&ab_channel=RCVideoReviews). I don't know if that is your problem or not, but you could experiment with it anyway. You will want to set the failsafe position of Aux Channel 6 to position 1, so that if the connection between the receiver and transmitter is lost, or hasn't been established yet, the cannon will not fire.

 Hi Luke! I get connected to OpenTX developers for TX16S and tried several tips. I think the new firmware on radio is messed up something or makes a "preflight" test.

Anyway I managed to solve the problem with raising the offset of the cannon fire channel (it is a toggle switch) to the middle (like a middle position of a 3pos switch) and no cannon fire on startup but when I activate it it works fine.

regards
Rongyos
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on October 23, 2022, 02:34:01 PM
That is a clever solution! I'm glad you succeeded, even if you had to do something unorthodox.  ;)
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on December 12, 2022, 11:02:25 AM
Hi Luke!

I made a soundset for KV-1 (only engine). How can I share with the community?

regards
Rongyos
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on December 13, 2022, 08:36:23 AM
Thanks Rongyos, it sounds really good! I posted them to the GitHub (https://github.com/OpenPanzerProject/Sound-Files/tree/master/SoundSets/OpenPanzerSoundCard) where anyone can download them.
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: Rongyos on May 25, 2023, 08:59:32 AM
Hi Everybody!

Can you recommend a cheap RFI/EMI filter for my homebuilt sound card? In lower volumes I hear annoying buzz or high pitch noise and if I put my tx closer to the device a buzz going crazy. Maybe I need shielded cable for the speaker? Can I make it better with shielded cable?

Thanks
Rongyos
Title: Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
Post by: LukeZ on May 25, 2023, 10:10:19 AM
I'm afraid I don't have a suggestion, the fact is I am not too experienced with sound circuits even though I designed one. Hopefully someone else will have a suggestion. I think this is definitely an application where it helps to have the components on a board and a DIY one with lots of wires will certainly be susceptible to interference.