|
|
|
|
Open-source lightsaber software
What you will need:
ChangeLog (since 6.9)
- New code for reading/writing ini files. Should cut down on SD card corruption significantly.
- Better Teensy4 support, including WS281x support.
- Alternate sound files: altNNN/
- Sound file sub-sub directories: hum/001/001.wav
- Updated clash detection
- StylePtr default arguments
- Bendable time in most transitions
- Most "help" command text moved to wiki page to save memory.
- Support for sorted track/font menus.
- OLED error messages
- low-power OLED mode
- Most OLED images can now use the length of the corresponding wav to decide how long to show the image or animation.
- Dynamic mixer bugfix
- New config file section: CONFIG_STYLES
- All config.ini files in the font search path are now read.
- New prop file: saber_caiwyn_buttons.h
- TrConcat can now be used without putting colors between transitions.
- Experimental ESP32-S3 support.
- New font config variables: ProffieOSHumDelay and ProffieOSSmoothSwingHumstart
- New config file defines: BOOT_VOLUME, AUDIO_CLASH_SUPPRESSION_LEVEL, DISABLE_TALKIE, BLADE_ID_SCAN_MILLIS, KILL_OLD_PLAYERS, POV_INCLUDE_FILE, BLADE_ID_TIMES
- New sound effect: altchng
- New OLED images: preon, in, out, pstoff
- SubBladeZZ
- Lots of new EFFECT_* enum values
- New Styles LockupTrL, StylePOV, ContinuousPOV, ChargingStylePtr, TransitionPulseL
- New Functions: ClampFX, Divide, IsBetween, Subtract, TwistAcceleration, AltF, SyncAltToVarianceF, LockupPulseF, ModF, VolumeLevel, HumpFlickerFX
- New Transitions: TrBlink(X), TrDoEffect(X), TrDoEffectAlways(X), TrLoop, TrLoopN(X), TrLoopUntil
- Sound library addition: moffopt.wav
- New style arguments: ALT_COLOR2_ARG, ALT_COLOR3_ARG, STYLE_OPTION2_ARG, STYLE_OPTION3_ARG, IGNITION_OPTION2_ARG, RETRACTION_OPTION2_ARG
- New pairable sound transitions: lock - endlock, armhum - endarm, auto - endauto, lb - endlb, melt - endmelt, drag - enddrag
- Fett263 prop changes: clash and ignition delays removed, force/quote available while off, quick select, gesture sleep control changed, circular volume and dimming menues, disable modes on the fly, "special ability" effects, bc control variations, "spin mode", combine spoken percent/volt readings, "recrement by" controls for time options, support for new style arguments, edit settings menu, quick select on boot, "quiet" track player.
- BC prop changes: combine volt/percent battery levels, sequential/random quote toggle, twist to select presets, battle mode disable, fast off, quick min/max volume
Features
- 100% open-source, you may add any feature you like. (GPLv3)
- Support for WebUSB for configuration through a browser.
- Thermal Detonator support
- Blaster support
- MICOM suit sound prop
- Support for remote control via bluetooth (with external addon)
- Speedy 32-bit processor makes advanced features like sound filters, synthesizing and mp3 playback possible.
- 16-bit digital output (12-bit for TeensySaber V1 and V2)
- S/PDIF or I2S output
- Default sample rate is 44kHz
- 22kHz and 11kHz samples are supported and upsampled to 44kHz automatically.
- Gapless playback, with 2.5ms cross-fade when you interrupt one sample to go to another.
- Polyphonic playback, currently configured for up to 5 simultaneous samples.
- Support for Ws281X, PL9823, SK68** or neopixel strings. (including RGBW)
- Support for APA102 and dotstar strings.
- Support for arbitrary 1/2/3/4/5/6-color stars/strings.
- Supports segmented string blades. (with flash string)
- Multi-blade support for dual and crossguard setups.
- Crystal chamber support.
- Power-level indicator with neopixel blade.
- OLED PLI display
- IR sending and receiving
- RFID support
- MTP support (drag-n-drop files from windows through USB connection)
- POV (persistance of vision) mode.
- Multiple blades. (at the same time)
- Accent LEDs. (also implemented as additional "blades".)
- Spoken error messages.
- Easy software updates.
If you want any other features, contact me on The Rebel Armory or the fx-sabers forum and I'll see what I can do.
Preparations for Proffieboard
- Install latest arduino software.
- Install the Proffieboard Arduino Plugin
- Select Tools->Boards->Proffieboard or Tools->Boards->Proffieboard V2
- (optional) Also in the Tools menu, select USB Type: "Serial + WebUSB + Mass Storage"
- Now you may proceed to "Installing ProffieOS on your board" below.
Preparations for TeensySaber
- Install latest arduino software.
- Install latest teensyduino software (in same directory)
- Go to the Tools menu, select Board: Teensy 3.1/3.2
- (optional) Also in the Tools menu, select: USB Type: "MTP Disk (Experimental)"
- Now you may proceed to "Installing ProffieOS on your board" below.
Note that it's totally ok to install support for both Proffieboard and TeensySabers.
Installing ProffieOS on your board
- Download and unzip the teensysaber software from above.
- Open up the arduino software, go to file->open and select ProffieOS.ino (Note, that on Windows, ProffieOS.ino might just be called "ProffieOS", as windows will hide the ".ino" part by default.)
- Make a config file. Usually, this will be tweaked and re-uploaded many times, but the best way to get started is to go to the Proffieboard V2, Proffieboard or TeensySaber V3 page and use the configuration generator. Go to the config/ directory, make a copy of one of the .h files, then rename the copy to "mysaber_config.h" (or whatever you like), then open up the file in an editor (like notepad) and remove all the lines, then cut-n-paste the stuff from the config generator instead and save it.
- In ProffieOS.ino, go to line ~24, and change it to: #define CONFIG_FILE "config/mysaber_config.h" (make sure the other config files are commented out, there should only be one CONFIG_FILE without //)
- Hook up the board to your computer with an USB cable
- If you have a teensysaber, Power the board with a battery. (You did cut the VIN/VUSB, right?)
- Press the arrow button near the top left in the arduino interface, and it will compile and upload the program.
- Done, now tweak your config file and re-upload as many times as you like.
If you have a problem, you can contact me on The Rebel Armory or the fx-sabers forum, but there is also lots of online informtation about arduinos and teensys, so some googling probably won't hurt.
How to use it
See the Wiki page.
Configuration
While you can obviously change *anything* in the source, the parts you may need to change depending on how you wired
your electronics should all be in the config file. I recommend starting by having the configuration generator on the
board page generate a config file for you, but you will probably need to tweak it as you go. Full documentation for
all the configuration file options can be found here.
LED configuration
ProffieOS already contains definitions for some popular Cree LEDs, so
most of the time, all you need to do is to use the right template and specify
the right number of milliohms in the < > after the template.
If you use a led that doesn't exist in leds.h different LED, copy one of
the led structs into your config file and modify it. You can find more information on the
Wiki page.
LED Color configuration
Most of the time, TeensySaber simply uses RGB colors to run everything,
however, if you're using an LED star, things can get a bit more complicated.
For instance if you have a Blue-Blue-White LED star, you have two choices
for how to configure the driver class. The first choice is something like:
SimpleBladePtr<CreeXPE2Blue, CreeXPE2Blue, CreeXPE2White, NoLED>().
This means that when the Style classes tells the blade to be blue,
the channel one and two turns on, and when the style
class say to make it white, all three channels turn on.
This is usually what you want to make the blade flash on impact.
With this setup, the style setup becomes simple as well, you just do something like: StyleNormalPtr<BLUE, WHITE, 300, 800>(). However, there is one drawback; if you want to actually use the white LED by itself, there no way to do it. The only
way to activate the white LED is for the Style to specify a white color, and that will also activate the blue LEDs.
You can find more information on the Wiki page.
Sound Fonts
Once you have the firmware installed, you'll need at least one sound font.
Sound fonts are stored on the SD card, just create a subdirectory and put the files from the font in there, and it should
work. Most fonts are monophonic, meaning that only one sound is played at a time, but some are polyphonic, meaning that
sound effects are played over the basic humm sound of the saber. The teensy saber os supports both types and should be
able to figure out what kind it is based on the file names. Here are a few places where you can obtain sound fonts:
Button configuration
By default, TeensySaber is configured to use a touch button for power, while the other buttons
use regular momentary switches. There is currently no support for latching switches.
If you want to use a momentary switch for the power button, you'll need to change two things.
- Find the line that says TouchButton power_; and replace it with Button power_;.
- Find the line that says power_(powerButtonPin, 1700, "pow"); and replace it with power_(powerButtonPin, "pow");. (The 1700 is the sensetivity of the touch button, at some point I might calculate the sensetivity automatically, and then this step won't be required anymore.)
Note that you can do the opposite of these two steps to the other buttons if you want to make them into touch buttons.
Sound Effect File Names
A sound font is made up of many sound files, the filename of these files should look something like this:
font1/clash001.wav
The file name is made up of four parts:
- The directory - This can be anything you like. All the files belonging to the same font should be in the same directory though. You can put fonts in sub-directories if you like, so it could be something like: fonts/dark/1/hum.wav if you like. The first entry in the preset[] array specifies the directory.
- The name - One of a set of pre-defined names specified below.
- The number - When playing a sound, TeensySaber will generally pick one of them randomly. The numbers can either be on the form 1,2,3,4,5,6,7,8,9,10,11, etc. or 01, 02, 03, etc. or 001, 002, 003, etc. The number sequence must be consistent and without any gaps. It's also possible to omit the number completely. For looping sounds, TeensySaber will randomly pick one of the numbered files each time it starts over, so it's possible to create a more interesting hum by having "hum.wav", "hum1.waw", "hum2.wav" etc. Note that since we're using an ancient file system, the length of the name and number must not total more than 8 characters. (So you can only have 11 poweron sounds: poweron.wav, poweron0.wav, poweron1.wav....poweron9.wav)
- The extension - I recommend using .wav files, 11, 22 and 44khz mono/stero wav files are supported. .raw and .usl files are also supported, but must be 44khz mono.
Sound Effect Names
The name part of the filename needs to be one that TeensySaber can recognize.
Sound fonts can either be monophonic (Plecter) or polyphonic (Naigon Electronics) style.
In monophonic mode, the following names are recognized:
- boot - Played when TeensySaber boots up.
- swing - Played when you move the saber around.
- hum - Played when you don't move the saber around. (looped)
- poweron - Played when you turn the saber on.
- poweroff / pwroff - Played when you turn the saber off.
- clash - Played when you hit something with the saber.
- force - Force use sound.
- stab - Played when you make a stabbing motion. (Not yet implemented)
- blaster - Played when you press the AUX button.
- lockup - Lockup, activate by hoding power then trigger a clash. (looped)
- bgnlock - played when lockup starts
- endlock - played when lockup ends (if not present, clash is used)
- poweronf - Force power on (not yet implemented)
- font - Played when you switch to this font / preset.
Note that in monophinic mode, the end of all sounds (except poweroff)
smoothly join up with the beginning of the "hum" sound(s).
In polyphonic mode, the following names are recognized:
- boot - Played when TeensySaber boots up.
- swng - Played when you move the saber around.
- hum - Played when you don't move the saber around. (looped)
- out - Played when you turn the saber on.
- in - Played when you turn the saber off.
- clsh - Played when you hit something with the saber.
- force - Force use sound.
- stab - Played when you make a stabbing motion. (Not yet implemented)
- blst - Played when you press the AUX button.
- lock - Lockup, activate by hoding power then trigger a clash.
- bgnlock - played when lockup starts
- endlock - played when lockup ends (if not present, just fades out)
- font - Played when you switch to this font / preset.
TeensySaber will automatically decide if a directory contains a monophonic or polyphonic
font based on the filenames.
In addition, if the sounds "swingl" and "swingh" are present, the SmoothSwing
algorithm will be used to generate swing sounds from these files instead of using
"swing" or "swng" files. See below for more details on SmoothSwing algorithms.
Also, if the "drag" sounds are present, they will replace the "lock" / "lockup" sound
if you drag the saber tip across the ground.
For thermonal detonator, these effects are used:
- bgnarm - when the td is arming
- armhum - when the td is armed (looped)
- endarm - when the td is disarmed
- boom - when the td blows up
SmoothSwing V1/V2 configuration
When one or more set of swingl/swingh files are present, TeensySaber will activate the
SmoothSwing V1 or V2 algorithms. To decide which one to use, it will read a file called
"smoothsw.ini". The full list of variables that can be used in smoothsw.ini can be found on
the wiki page.
SmoothSwing V1 - Demo, Thexter's description
Demo, Algorithm explanation, details of how to use it below. Many thanks to Thexter for his excellent work on this algorithm.
Smoothswing V1 doesn't actually use any of the variables from the configuration
file. The swingl and swingh files are played in a loop. The software will then
place a rotating plane through the blade of your saber, and if the saber swings
in one direction across the plane, we'll play more of swingl and less of the background hum.
If we swing in the other direction, we'll play more of swingh and less of the hum.
The fade will never blend swingl and swingh directly, it will essentially cross-fade
between the regular hum and one of swingl/swingh based on direction and strength of
the swing.
SmoothSwing V2 - Demo, Thexter's description
Smoothswing V2 has some similarties to V1, but is much better at producing natural
swing- and spin-like sounds, and also produces more variety than the V1 algorithm.
To do this, the swinglNN.wav and swinghNN.wav files are paired up. Whenever a swing
is not going on (swing speed < SwingStrengthThreshold) a new pair if selected randomly.
As we start swinging, we keep track of how many degrees the saber has swung so far, and
at a randomly selected threshold, we start a cross-fade to go from swingl to swingh. The
transition lasts for Transition1Degrees, and if the swing continues, we will eventually
cross-fade back from swingh to swingl 180 degrees after the first threshold. The second
transition is generally wider and is controlled by Transition2Degrees. The combined
swing sound is then cross-faded with the regular hum based on the swing strength.
Serial Monitor Commands
You can use the serial monitor to debug and control the software once uploaded, here is an incomplete list of commands:
- help - prints a list of known commands
- on - turns the saber on
- off - turns the saber off
- blade on - turns the blade on (but leaves the sound off)
- blade off - turns the blade off
- clash - trigger a clash effect
- dir [directory] - list files on sd card
- cd [directory] - change directory, and sound font
- play [file] - play wav file
Note that there is a drop-down at the bottom of the serial monitor that defaults to "No Line Feed", you must
change it to "Newline" to use the serial monitor with TeensySaber.
Download Older versions
- 1.8 - pre-alpha version
- 1.10 - alpha version
- 1.11 - beta version
- 1.14 - first recommended version
- 1.18 - preliminary teensy 3.5/3.6 and TeensySaber V2 support
- 1.19 - Fixed BUILTIN_SDCARD
- 1.20 - Fixed hang when reading directories ending in /
- 1.40 - new LED configuration system, PWM over volt protection, audio bugfixes, improved audio buffering, better help system, multiple touch buttons, code cleanup
- 1.43 - looped swing sound support
- 1.45 - MTP, power+clash=previous preset, RAW/USL support
- 1.60 - POV, V2 motion, APA102/Dotstar (Experimental)
- 1.86 - multi-blade support
- 1.89 - blade template system
- 1.93 - fixed short activation
- 1.110 - louder, lockup, flicker
- 1.119 - bugfixes
- 1.144 - GPLv3, speech, separate configuration files, zero-button sabers, mtp support for serialflash
- 1.153 - Display/PLI, crossguard
- 1.157 - TeensySaber V3 support, latching button support
- 1.164 - blast effect, pulsing blade, drag effect, 16-bit color
- 1.167 - Support for bluetooth addon.
- 1.175 - SubBlade, IgnitionDelay, ColorCycle, Makefile, more blades
- 1.191 - Smoothswing V2, better wav reader, Cylon, reduces clash sensetivity when swinging
- 1.224 - loop optimizations, split into many files, blade style functions, bugfixes
- 1.246 - split out more classes, better spoken error messages, serialflash config files
- 1.247 - bugfixes, INVERT_ORIENTATION
- 1.264 - initial proffieboard support, StyleFire<>, any orientation, motion disable, WS2811 fixes
- 1.264 - fixed proffieboard support, bugfixes
- 1.269 - force command, neopixel fix for profffieboard
- 1.284 - N-gradient, new Blast, LocalizedClash, Sparkle, BlastFadeout, InOutHelperX, OriginalBlast, separate color for drag, double-click to mute, bugfixes
- 1.286 - Blinking style, faster motion code, lots of bugfixes
- 1.291 - SD card access, interchangeable clash/blast/force effects, bugfixes and optimizations
- 1.305 - motion fixes, hybrid fonts, blade movies, button clash suppression, RandomBlink, Stripes, i2c reset fix, allowDisable fix, hum keeps playing fix
- 1.312 - WebUSB, presets.ini, RGBW pixels, teensy serial pixels, bugfixes, lower standby power, Sequence<>
- 2.9 - V2 board support, Thermal Detonator support, prop files, new versioning scheme, accent swings, bgnlock/endlock, Trigger, BatteryLevel, Mix, ColorSequence, Bump, NAME/NNNN.wav file pattern support, CH*LED and many many bugfixes.
- 3.9 - Color Change, IR receiving, sensor fusion, blade ID class, shake, stab, slash, oled animations, CFX font support, blade detect, transitions, lockup/clash/stab shapes, better sdtest, ColorChange, RetractionDelay, ByteOrderStyle, RotateColors, TransitionEffect, TransitionLoop, Hue, InOutTr, LengthFinder, DimBlade, SubBladeReverse.
- 4.9 - Font search paths, IR, SPI LED, Layers, presets.ini cleanup on programming, lightning block, melt, responsive styles, lots of new styles and effects.
- 5.9 - MICOM, initial Teensy4 support, RFID, I2S, S/PDIF, WS2811 speedups, FromHumFileStyle, EffectSeqence, CircularSectionF, MarbleF, SliceF, Saw, PullDownButton, SubBladeWIthStride
- 6.9 - ProffieBoard V3 support, audio filters, faster i2c, 1600Hz motion & filters, WS2811 optimizations, AudioLibrary, per-effect volume and pairing, rotary inputs, savi blades, "builtin" style arguments, Aurabesh font, SaberBlasterProp, Accent Swing file selection, display idle image / animation, OLED bullet count, DYNAMIC_BLADE_DIMMING, DYNAMIC_BLADE_LENGTH, DYNAMIC_CLASH_THRESHOLD, SAVE_BLADE_DIMMING, SAVE_CLASH_THRESHOLD, INCLUDE_SSD1306, FILTER_CUTOFF_FREQUENCY, FILTER_ORDER, NO_REPEAT_RANDOM, FEMALE_TALKIE_VOICE, DISABLE_BASIC_PARSER_STYLES, ENABLE_ALL_EDIT_OPTIONS, ColorSelect, StaticFire, Remap, TrCenterWipe, TrCenterWipeIn, TrCenterWipeInSpark, TrColorCycleX, TrExtend, TrSelect, TrSpark, CenterDistF, ClashImpactF, EffectPosition, HoldPeakF, IntSelect, LinearSectionF, RampF, Sum, TimeSinceEffect, WavLen, Wavnum, SwingAcceleration, FETT263 PROP FEATURES: Edit Mode Menu, Battle Mode 2.0, "Real Clash", Track Player, Dual Mode Sounds Ignition, Spoken Battery Level / Colors, Hybrid Force / Quote Player, Rehearsal / Choreography Mode, Gesture Sleep, Preset Menu, Volume Menu update
Troubleshooting
If you're having problems, check out the troubleshooting page.
Problems? Questions? Suggestions? Check out The Crucible.
This page has been accessed 230,395 times since
July
29th,
2018.
Last modified:
February
4th,
2024
- Design by
Monica &
Fredrik
Hübinette
|
|
|
|
|