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.