Configuring SOund Rig

Hi everyone, I’m new to ProffieOS. I know Python fairly well and whilst different it does help me kinda work some of this stuff out. :slight_smile:

My setup is closely based on MiCom which no longer produces sound rigs for cosplay etc. My friend has one so I know how the hardware is setup (Teensy).
But obviously I can’t see the profile that has been installed on the board. (Recently found there is one included in the OS folders ‘teensy_audio_shield_micom.h’).

I’m just trying to piece everything together.
In the config file above I see some presets which mentions some sound files but these can’t be the only ones that are used. How does this reference what would be on the SD Card?

#ifdef CONFIG_PRESETS
Preset presets[] = {
  { "vadert~1", "tracks/vader.wav", ""},
  { "micom2", "tracks/cantina.wav", ""},
  { "vader", "tracks/vader.wav", ""},
  { "TeensySF", "tracks/title.wav", ""},
};

I then also see this file is referencing another one:
#include “…/props/micom.h”

Is where we are defining what the buttons do? IE Click or Hold.
I see there is stuff in there for moving into a ‘sub category’ of sound files which I know is used on some profiles such as Vader. but not for every button.
The others have different sounds depending on whether the button is clicked or held.

Am sure these wont be my last questions but this will certainly get me started.

Many thanks!

read this page:

If that doesn’t help, let me know and I can try to explain it better.

Yes.
I don’t think this is well documented anywhere, but I can see if I can dig up some discussions with the micom guys which has the actual explanations.

Thanks for this, I’m guess the example I posted is a quite cut down version.
If I was looking to have say 5 buttons that activate a number of sounds each all of the sounds would need to be listed here?
Where is it then defined how these are activated?

Anything you can dig up would be really appreciated to understand that file better.

The config file is not cut down, and it’s already set up for 8 buttons. You don’t have to use all 8 if you don’t want to though.

I found some information about the file naming conventions, hopefully it’s still accurate(ish):

Basically, the pattern is

TNVVV (for basic actions)
or
TNVVVL (for looped sounds)
or
TNVVVAX (for answers)

T=“t”
N=1-8 (the button number)
VVV=“clk”, “hld”, or “dcl”, for click, held or double-click respectively
A=“a”
X=1-9
L=“l” (for looped sounds)

For example, for a click on button 1, the pattern would be “t1clk”. If you want just a single wav file for that action, then you just add “t1clk.wav” to the font directory. If you want multiple, you create make a directory and add files like “t1clk/000.wav”, “t1clk/001.wav”, “t1clk/002.wav”, etc.

If the “t1clkl.wav” or “t1clkl/NNN.wav” exists, then it will be played instead of t1clk.wav, but it will be played in a loop until you click the button again.

If any of answer files exist (t1clkaN files) then the micom will go into “answer mode” after clicking the button. In answer mode pressing any of the buttons will play the corresponding answer instead. Note that all buttons except button 1 will exit answer mode. (button 1 is meant to repeat the question again, possibly in a different way.)

Holding button1 and 8 for 1.5 seconds goes to the next font listed in the “presets” array.

Holding button8 for 2 seconds starts or stops the “track”, which can be used for background sounds or music.

If there is a hum or humm file in the font, then the first click you do will start the hum. This can be used for vader breathing for instance.

Hope this helps.

Thankyou, this is really helpful.
So really this file: #include “…/props/micom.h” doesn’t need to be touched unless I was planning on changing the file naming conventions?

In regards to the Presets. This is basically referring to what is on the SD Card?
I only plan on having one ‘profile’ but just so I’m sure on my understanding how would I configure the config presets section if say I had 2 folders on my SD Card.
Profile 1
Profile 2

I understand each folder would have its own track files. Just understanding how the config section would look.

Finally you mention lastly about a hum or humm file in the font. Is that a particular file type?

Thankyou for your help!

Correct. You might also need to change it if you want to change something about how buttons behave.

In ProffieOS, a Preset is a combination of a track, a font directory and a set of styles which specifies which colors to use for blades and other LEDs. Since micom generally has zero blades/leds, it just contains the font and the associated track.

More about presets here: ProffieOS Documentation: The CONFIG_PRESETS section

Then you would change the presets array in your config file to:

Preset presets[] = {
  { "Profile 1", "Profile 1/track.wav", ""},
  { "Profile 2", "Profile 2/track.wav", ""},
};

With the micom prop, each font currently has one track, and that track can be in the font folder, or anywhere.

All sound files are wav files, and should be 44100 Hz, PCM, Mono.
The hum sounds are carry-over from lightsabers, it just refers to a file that is meant to play in a loop for the entire time that the prop is active.

Right ok, I think I’m getting there. haha
So a font is ultimatetly a folder on the SD card?
My friend has a Micom 2. I’m not sure how old it is so configuration may have changed since his was made.

But it has 3 folders on the SD Card. bank1, bank2, bank3.
So I’m guessing this relates to the presets in the example config to the Profile 1 & Profile 2?

Preset presets[] = {
  { "Profile 1", "Profile 1/track.wav", ""},
  { "Profile 2", "Profile 2/track.wav", ""},
};

Then in those folders are sound files that are named as you mentioned before.
Eg
t1clk1, t1clk2 and so on
t1hld1, t1hld2 and so on

Obviously above you mentioned having a folder called t1clk and then wav files 000.wav etc in each.
I am assuming both ways can work based on my friends units SD setup…

if thats the case what would the preset section look like for that?
Like below…

Preset presets[] = {
  { "bank1", "bank1/", ""},
  { "bank2", "bank2/", ""},
};

Thanks

Yes

Changing “Profile N” to “bank1” makes sense.
Changing “Profile N/track.wav” to “bank1/” does not.
The first string should be the name of a directory, the second should be the name of a file. (or blank if you don’t need/want a track for that preset.)

So you could use:

Preset presets[] = {
  { "bank1", "", ""},
  { "bank2", "", ""},
};

or:

Preset presets[] = {
  { "bank1", "bank1/track.wav", ""},
  { "bank2", "bank2/track.wav", ""},
};

or, you could have tracks in a separate folder, like:

Preset presets[] = {
  { "bank1", "tracks/track1.wav", ""},
  { "bank2", "tracks/track2.wav", ""},
};

or, you could have the same track for all presets, like:

Preset presets[] = {
  { "bank1", "track.wav", ""},
  { "bank2", "track.wav", ""},
};

ok, I think I might be getting a bit confused haha. Apologies.

So (using my friends micom as example).
In the bank1 folder are about 80 different sound files. all using the mentioned file format you outlines before (t1clk1, t2clk1 etc etc).

So for this setup I need to outline ALL of these files under the preset config?

Not sure what you mean by “outline” in this context.

You don’t need 80 files to make a font, a single file would be enough, but a micom that only plays one thing would be pretty boring I suppose. ProffieOS will scan the font directory on startup or when switching font diretctory, and it will remember how many there in each group of files, and if a group is empty, then that particular action just won’t do anything.

Apologies I meant list out all of the sound files in the preset config?
Like:

Preset presets[] = {
  { "bank1", "(t1clk1.wav",t1clk2.wav",t1clk3.wav",t1clk4.wav", ""},
};

and so on…

Or can I just list the first one. for example

Preset presets[] = {
  { "bank1", "(t1clk1.wav", ""},
};

And then when its started and ProffieOS scans the folder it knows the others are in there?

No, you don’t do this at all.
None of the “pattern” files are listed in the config file, only the directory they are in.
The track is a special case. It’s a separate file name and doesn’t actually have to be in the font directory.

A bit of history might be helpful to explain this;

Back when I started making ProffieOS, fonts never came with tracks. However, I wanted to have a preset with a red blade, a vader font and have the “imperial march” as an optional background soundtrack. So I created a folder full of tracks, I put the SW sound track in there, and then I used "tracks/imperial march.wav" in the config file. By holding the second button for two second, the saber would start playing the track (but it would not ignite) and then I could ignite it whenever I wanted to, which can be extra dramatic…

Hope this makes sense.

Ah ok!
I’m thinking I’m getting this now so I do see on my friends unit a wav file in each folder called ‘font’.
This sound announces the character!

So as a guess the config file for his unit could look like this?

#ifdef CONFIG_PRESETS
Preset presets[] = {
  { "bank1", "bank1/font.wav", ""},
  { "bank2", "bank2/font.wav", ""},
};

Oh, I also see a file called ‘boot’
Which plays the same sound. Would that potentially automatically play when the device is turned on?

If so where would that be defined…?

Yes, when you turn the device on, it plays the boot sound instead of the font sound.

Not sure if you are interested in reading the code, or if you’re asking if there is something you need to do to make it use the “boot” file?

If the question is “do I need to do anything?” the answer is no, you don’t need to do anything.

If the question is “where in the code is that, I want to know how it works”, then the answer is:

@Steve77 I think you might be confusing individual font sounds that live in a font folder, and the place in the preset where tracks are listed.

This is the syntax for a preset:

{
  "fontdir", "tracks/track.wav",
  style definition, // NUM_BLADES specifies how many style definitions there are
  "description",
}

The track is really meant for music, and should be organized into a folder named “tracks”.

The font, boot, out, hum, clash, etc… sounds are all in the font folder.
The first argument where you have “bank1” is the font folder, corresponding to a folder on your SD card named exactly that, “bank1”. When you switch to this preset, all of the sounds inside the “bank1” folder will be called upon when needed.
The other thing confusing you a bit maybe is that your boot sound and font sound just happen to use the same sound. That’s fine, but any sound can be anything you want.

Guys, thankyou!
I understand the preset side of things now (finally!)
So we have the directory which relates to whats on the SD Card.
Then the ‘font’ sound that can be played when you switch to that folder.
The boot sound plays when the device is started. I assume this will always be the first folder in the presets list?

Next thing I just want to clarify for myself is this:

Holding button1 and 8 for 1.5 seconds goes to the next font listed in the “presets” array.

Holding button8 for 2 seconds starts or stops the “track”, which can be used for background sounds or music.

The button 1 & 8 is that just part of the ProffieOS code or a ‘micom’ thing?

Same with the hold on button 8. Does that mean 8 should only have ‘click’ sounds and one single ‘hold’ sound that can be used for a loop. IE Vader breathing?
Does this need to be named specifically or in a specific format?

Thankyou

Depends on whether you have the SAVE_PRESET (or SAVE_STATE) define in your config file.
If you do, it will remember what preset you are on and start on that one next time.
If you don’t have either of these defines, it will start from the first one each time.

It’s defined in the micom prop file.
Other props use different button combinations to switch presets.

So, I think in the actual micom vader font, button 8 is only used for starting and stopping the breathing, and for cancelling response mode.

Right ok, I certainly think I have a good understanding to get me going.
Alot of the features I am unlikely to use. But I prefer to try and understand how it all works.

I appreciate your patience!

And…I am back. haha

I was just taking another look through the code and I have a couple of questions.

Firstly I noticed this code:

  bool Event(EVENT event) {
    if (event == EVENT_FIRST_SAVED_CLICK_SHORT) {
      return clk.Activate();
    }
    if (event == EVENT_SECOND_SAVED_CLICK_SHORT) {
      return dcl.Activate();
    }
    if (event == EVENT_HELD_MEDIUM) {
      return hld.Activate();
    }
    return false;
  }
};

I know clk is click and hld is hold. Is dcl Double Click?
If so does that mean I can have an additional list of sounds that can be used when a button is double clicked?

Secondly in regards to this bit of code:

      case EVENTID(BUTTON_TRIGGER_EIGHT, EVENT_HELD_LONG, 0):
        StartOrStopTrack();
	return true;
    }

I know the intent for this is to play music or in a certain case Darth Vader breathing.
Is it possible to allow this activation on other buttons and not just button 8?