Blaster Sounds

I’m using a config if found in the forums for a blaster but I’m not getting any sound when I trigger fire. I think I just don’t understand how the fire action is tied to the wav files. I have BlasterCore v5 fonts copied onto the SD card. How do you configure what files are played for the fire action?

Config:
#ifdef CONFIG_TOP
#include “proffieboard_v2_config.h”
#define NUM_BLADES 2
#define NUM_BUTTONS 2
#define VOLUME 2000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_WS2811
#define ENABLE_SD
#define DELAYED_OFF
#define ENABLE_BLASTER_AUTO
#define INCLUDE_SSD1306 to CONFIG_TOP
#endif

#ifdef CONFIG_PROP
#include “…/props/blaster.h”
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
// Default basic blast color with red audio flicker on blast
{“bank4”,“tracks/march.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},

{“bank1”,“tracks/credits.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},
{“bank2”,“tracks/swars.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},
{“bank3”,“tracks/fates.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},
{“bank5”,“tracks/credits.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},
{“bank6”,“tracks/swars.wav”,
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
},
};
template
struct CreeXPE2DRedTemplate {
static constexpr float MaxAmps = 1.0;
static constexpr float MaxVolts = 2.5;
static constexpr float P2Amps = 0.35;
static constexpr float P2Volts = 2.1;
static constexpr float R = milliohms / 1000.0;
static const int Red = 255;
static const int Green = 0;
static const int Blue = 0;
};
template
struct CreeXPE2DRed2Template {
static constexpr float MaxAmps = 1.0;
static constexpr float MaxVolts = 2.5;
static constexpr float P2Amps = 0.35;
static constexpr float P2Volts = 2.1;
static constexpr float R = milliohms / 1000.0;
static const int Red = 0;
static const int Green = 255;
static const int Blue = 0;
};
template
struct CreeXPE2RBlueTemplate {
static constexpr float MaxAmps = 1.0;
static constexpr float MaxVolts = 3.4;
static constexpr float P2Amps = 0.35;
static constexpr float P2Volts = 3.1;
static constexpr float R = milliohms / 1000.0;
static const int Red = 0;
static const int Green = 0;
static const int Blue = 255;
};
BladeConfig blades[] = {
{ 0, SimpleBladePtr<CreeXPE2DRedTemplate<1200>, CreeXPE2DRed2Template<1200>,CreeXPE2BlueTemplate<300>, NoLED>(),
WS2811BladePtr<14, WS2811_800kHz | WS2811_GRB, blade2Pin, PowerPINS>(),
CONFIGARRAY(presets) },
};
#endif
#ifdef CONFIG_BUTTONS
Button FireButton(BUTTON_FIRE, powerButtonPin, “fire”);
Button ModeButton(BUTTON_MODE_SELECT, auxPin, “modeselect”);
#endif

#ifdef CONFIG_BOTTOM
SSD1306Template<128, uint64_t> display(0x3C);
#endif

Are the blaster wav files in the “bank4” directory?
Is your speaker even working? Do you hear any sounds?
If you use the “effects” command in the serial monitor, what do you see?
Other commands to try: “dir bank4”, “pwd” and “beep”

Yes, speaker is working
Yes, blaster wav files are in the “bank4” director
beep plays the the close encounters tones
dir bank4 lists the files in bank4
pwd lists bank4

Again, I think I just don’t understand what triggers the sounds. This config sets one of the buttons to execute “fire”. Does it matter my files are names blast (blast1.wav, blast2.wav, etc)?

Also, when I had it setup as a lightsaber with motion and the default sound files it worked fine.

It would be helpful if you cut-n-paste what “dir bank4” and “effects” show actually show.

You are using ProffieOS from github right? It’s possible that I broke something in the blaster prop there…

Also, what does the serial monitor say when you press the fire button?

Yes, these are master files I pulled from GitHub

when I type “fire” in serial monitor:
14:22:00.428 → EVENT: Up-Shortclick ON millis=88191
14:22:00.428 → EVENT: Up-Shortclick ON millis=88191

“dir bank4”:
14:23:23.730 → . 0
14:23:23.730 → … 0
14:23:23.730 → auxray.txt 235
14:23:23.730 → blast1.wav 55654
14:23:23.730 → blast2.wav 48420
14:23:23.730 → blast3.wav 56746
14:23:23.730 → blast4.wav 58274
14:23:23.730 → blast5.wav 55654
14:23:23.730 → blast6.wav 48420
14:23:23.730 → blast7.wav 56746
14:23:23.730 → blast8.wav 58274
14:23:23.730 → clipin.wav 78122
14:23:23.730 → clipout.wav 78122
14:23:23.730 → config.txt 390
14:23:23.730 → empty.wav 18800
14:23:23.730 → font.wav 83364
14:23:23.730 → full.wav 51836
14:23:23.730 → jam.wav 24900
14:23:23.730 → leds.txt 686
14:23:23.730 → mode1.wav 18800
14:23:23.730 → mode2.wav 22924
14:23:23.730 → plioff.wav 22924
14:23:23.730 → plion.wav 22924
14:23:23.730 → range1.wav 9030
14:23:23.730 → range2.wav 8722
14:23:23.730 → range3.wav 8722
14:23:23.730 → range4.wav 8722
14:23:23.730 → range5.wav 8722
14:23:23.730 → range6.wav 8722
14:23:23.730 → ray.txt 238
14:23:23.730 → reload.wav 40424
14:23:23.730 → stun.wav 48216
14:23:23.730 → unjam.wav 78122
14:23:23.730 → on.bmp 20544
14:23:23.730 → blast.wav 58274
14:23:23.730 → boot(orig).wav 228884
14:23:23.730 → boot.wav 58274
14:23:23.764 → fire.wav 58274
14:23:23.764 → Done listing files.

When you click the fire button/trigger it will play whatever file is in that style.
There are 3 different styles of firing on your blaster. Kill,Auto,Stun I forget what the default start is but I know I went into the blaster.h prop and changed it to Kill.

Kill is blast1, blast2, etc… . Stun is stun1, stun2, etc… , and Auto is auto1, quto2, etc…

Also adjusted the switch triggers as the mode switch always had conflicts with the functions. I forget who shared these as they made a big difference with the Aux button actions.

I noticed that you added the display template. I assume you don’t have a display and that can be removed.

Thanks. Actually, I do have a display. This is all for a DL-44 blaster build. The screen is working well. I’m just trying to get the sounds configured like a blaster. The sounds don’t play when I trigger fire.

Unfortunately, the “fire” command triggers a “short click” event on the fire button, but the prop file doesn’t do anything with “short click” events, so the “fire” command doesn’t work.
The prop uses the “pressed” and “released” actions instead, which currently means that you have to actually push the button to get it to work.

Ahhhhh…I was starting to wonder about that. Ok, so can’t test this virtually. I’ll wire up some buttons to test with. Thanks!

Or you could add:

  case EVENTID(BUTTON_FIRE, EVENT_CLICK_SHORT, MODE_ON):

here:

Thanks! I’ll try that.

That still didn’t work. Either with the file mod or physically hitting the switch. I’m still tryin to understand. What tells the software which file to play when it registers fire?

There are several layers.

  1. The button mapping specifies what event is sent when you press the button.
  2. The prop takes those events and figures out what to do. It then sends an EFFECT to saberbase which distributes that effect to the system.
  3. blades, hybrid_font and/or other parts of the system then reacts to the event by playing sounds. In this case, the effect-to-sound mapping happens further down in the blaster prop file.

So when you press the switch, what do you see in the serial monitor?

Thanks for the detail. I think I figured out part of the problem. The BlasterCore font calls the files blast.wav instead of blst.wav. Once I changed the name I started to hear sounds when I triggered.

blaster.h has a lot of different effects (stun, reload, etc) how do I know what to name the associated sound font files?

That doesn’t make any sense.
The blaster prop uses the “blast” name for fire effects, not “blst”.

You are right. I had it named both ways in the directory. It’s all working now.

1 Like