SmoothSwing - LamaDiLuce/polaris-opencore GitHub Wiki
SmoothSwing
The Polaris Anima EVO implements the SmoothSwing V2, based on Thexter's excellent work. For more details, see: http://therebelarmory.com/thread/9138/smoothswing-v2-algorithm-description
To summarize, the smooth swing uses sound pairs to simulate the Doppler effect (the change of the pitch of the sound when it moved toward or away from the listener).
Each sound pair has a high pitch sound and a low pitch sound. At the beginning of a new swing, a sound pair is randomly chosen.
During the swing, the angular speed is integrated over time and the travel angle is computed.
This travel is used to modulate the volume of each sound in the pair. At the beginning of the swing, sound A has a higher volume and sound B is muted. During the movement, the volume of sound A is decreased and the volume and sound B is increased. This creates a crossfade between the high pitch and the low pitch sounds, simulating the Doppler effect.
The total volume of the swing pair is modulated by the "swing strength" (the speed). Thus for a fast swing, this effect is more pronounced.
The normal HUM sound is always reproduced and it's just ducked during the swing.
How to enable Smoothswing
To configure the swing behavior you have to specify the filenames. This can be done via PC software on Win and Mac.
Default sound fonts names
This is the list of the default sound font names used. You can use different file names and update the saber according.
- HUM_0.RAW
- POWEROFF_0.RAW
- POWERON_0.RAW
- SMOOTHSWINGH_1_0.RAW
- SMOOTHSWINGH_2_0.RAW
- SMOOTHSWINGH_3_0.RAW
- SMOOTHSWINGH_4_0.RAW
- SMOOTHSWINGH_5_0.RAW
- SMOOTHSWINGH_6_0.RAW
- SMOOTHSWINGH_7_0.RAW
- SMOOTHSWINGH_8_0.RAW
- SMOOTHSWINGL_1_0.RAW
- SMOOTHSWINGL_2_0.RAW
- SMOOTHSWINGL_3_0.RAW
- SMOOTHSWINGL_4_0.RAW
- SMOOTHSWINGL_5_0.RAW
- SMOOTHSWINGL_6_0.RAW
- SMOOTHSWINGL_7_0.RAW
- SMOOTHSWINGL_8_0.RAW
- CLASH_1_0.RAW
- CLASH_2_0.RAW
- CLASH_3_0.RAW
- CLASH_4_0.RAW
- CLASH_5_0.RAW
- CLASH_6_0.RAW
- CLASH_7_0.RAW
- CLASH_8_0.RAW
- CLASH_9_0.RAW
- CLASH_10_0.RAW
If you don't want to use the SmoothSwing, you can set the legacy swing sounds. The default name of swing files are:
- SWING_1_0.RAW
- SWING_2_0.RAW
- SWING_3_0.RAW
- SWING_4_0.RAW
- SWING_5_0.RAW
- SWING_6_0.RAW
- SWING_7_0.RAW
- SWING_8_0.RAW
Free Smooth Swing fonts
If you want to try some free SmoothSwting font, you can check this link: https://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread
Convert from wav to raw
If you have the sounds in wav format, you have to convert to raw format (44.1kHz, 16bit, mono).
You can download the file SoX_for_Polaris_EVO.zip from the repository and unzip it in the folder where the audio files are located.
You can run the command convert_from_CFX_to_Polaris_EVO.cmd or convert_from_ProffieOS_to_Polaris_EVO.cmd, depending on the source file names.
Create SmoothSwing pairs from the HUM sound
If you like your sound font, you can try to make the smooth swing sound pairs from your hum.
If you are an audio creator you can use the program of your choice and work on the main hum file, producing a set of smooth swing pairs applying high and low pitch transformation (you can also add overdrive, tremolo, and other effects that you like).
If you are not experienced, you can try to use an example developed using SoX (Sound eXchange, a cross-platform audio editing software).
Download the file SoX_for_Polaris_EVO.zip from the repository and unzip it in the folder where the audio files are located.
You can run the command create_smoothswing_from_hum_wav.cmd or create_smoothswing_from_hum_raw.cmd, depending on the input file that you have (wav or raw).
Send sounds to the saber
Download the file SoX_for_Polaris_EVO.zip from the repository and unzip it in the folder where the audio files are located.
Run the command sendtosaber_erase_and_send_all.cmd to erase all the files on the saber and upload the new ones.
If you want only to send the Smooth Swing sounds, you can run sendtosaber_only_smoothswing.cmd.
Tune parameters in the FW
The Smooth Swing uses a few parameters that can be tuned in the FW, check the file CoreAudio.h
- MAX_VOLUME = 1; // 1 is the max volume. Use a - lower number to be more quite e.g. at home
- SWING_SENSITIVITY = 520; // how hard should be a swing to - get the max effect. It's in deg/s (good values are between 360 and 720)
- MAXIMUM_HUM_DUCKING = 0.85; // how much the main hum is - reduced during the swing. Close to 1 means that the main hum is attuanuated a lot - during the swing (good values between 0.7 and 0.9)
- SWING_SHARPNESS = 1.2; // This gives a nice non-linear - swing response. Between 1 and 2
- TRANSITION_1_MIN = 30; // min midpoint angle in - degreese for first transition (it's picked randomly at each swing)
- TRANSITION_1_MAX = 80; // max midpoint angle in - degreese for first transition (it's picked randomly at each swing)
- TRANSITION_1_WIDTH = 45.0; // width angle in degreese of - the first trasition
- TRANSITION_2_WIDTH = 160.0; // width angle in degreese of - the second trasition, which is 180 deg away from the first transition