Registration Notice

Due to increased spam, forum registration must be manually approved by a moderator! Please see this post for instructions.

Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #90 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.
*
inifile.rar
(164.1 kB ~ Downloads: 57)

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #91 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!
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

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

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

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #94 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 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. 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.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #95 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 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. 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.
20190727134136.png
Open Source Sound using Teensy 3.2 and PJRC Audio Library 20190727134136.png
Views: 256

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #96 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.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

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

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

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #99 on: August 28, 2019, 01:45:48 PM »
Very interesting! I will look forward to hearing more details when you finish the project.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

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

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #101 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!
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

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

*

Offline LukeZ

  • 977
    • View Profile
  • Edinburgh, Scotland
Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #103 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 of the Sound Card firmware. Commands are defined in the SoundCard.h file.

On the TCB side you can see the mapping between TCB functions and Sound Card commands in OP_Sound.h and you can see the very simple functions for sending the sentence over the serial port in OPSoundCard.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.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

Re: Open Source Sound using Teensy 3.2 and PJRC Audio Library
« Reply #104 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 of the Sound Card firmware. Commands are defined in the SoundCard.h file.

On the TCB side you can see the mapping between TCB functions and Sound Card commands in OP_Sound.h and you can see the very simple functions for sending the sentence over the serial port in OPSoundCard.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.