*

Offline Springman65

  • 7
    • View Profile
  • Grafton, OH
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #15 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!

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #16 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.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline Springman65

  • 7
    • View Profile
  • Grafton, OH
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #17 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

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #18 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 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).

NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #19 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 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, 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. 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.

*
2017_09_06_OPSound.hex
(149.33 kB ~ Downloads: 60)
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #20 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.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline jhamm

  • 82
  • It´s a hobby no profession!
    • View Profile
  • Germany
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #21 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

*

Offline jhamm

  • 82
  • It´s a hobby no profession!
    • View Profile
  • Germany
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #22 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...


*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #23 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. 
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline jhamm

  • 82
  • It´s a hobby no profession!
    • View Profile
  • Germany
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #24 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

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #25 on: September 13, 2017, 12:43:43 AM »
That's ok! It's a lot to remember I know. :)
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

dannydeleon

Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #26 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

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #27 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.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #28 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/

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.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline LukeZ

  • 577
    • View Profile
  • Kansas, USA
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #29 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...
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

 

bomber-explosion