FX-Sabers.com

Ahch-To: Instructional Section related to constructing your own Lightsaber => Open Source Sound Cards => Topic started by: Thexter on September 27, 2017, 02:30:59 PM

Title: SmoothSwing v2 demonstration
Post by: Thexter on September 27, 2017, 02:30:59 PM
Here is a demo of my latest smoothswing algorithm running on my Seventh Saber. This is an evolution of the method I originally outlined here: smooth swing interpolation with pitch-shifted hums (https://www.fx-sabers.com/forum/index.php?topic=51430.0)

Title: Re: SmoothSwing v2 demonstration
Post by: profezzorn on September 27, 2017, 04:25:07 PM
That is really really nice.
What's the difference between this and the V1 algorithm?
I don't suppose you have source code available somewhere? :)
Title: Re: SmoothSwing v2 demonstration
Post by: TheUnchosenOne on September 28, 2017, 05:52:35 AM
God, this is so cool. No joke, this is absolutely the lightsaber tech I'm watching with the most interest. I hope someday this can be as widely accessible and easy to install as a Plecter board.
Title: Re: SmoothSwing v2 demonstration
Post by: jbkuma on September 28, 2017, 07:22:33 AM
Beautiful work, as always!
Title: Re: SmoothSwing v2 demonstration
Post by: JakeSoft on September 28, 2017, 03:55:18 PM
This is the most spot-on real-world hum interpretation I've ever seen. Very nice!
Title: Re: SmoothSwing v2 demonstration
Post by: Thexter on September 29, 2017, 12:30:17 PM
That is really really nice.
What's the difference between this and the V1 algorithm?
Thanks. There area lot of differences. The main one is that there are many more hums that allow for a lot more variation. This required some massaging of the sound format so that I'm no longer playing straight wav files.

I don't suppose you have source code available somewhere? :)
Not just yet.

God, this is so cool. No joke, this is absolutely the lightsaber tech I'm watching with the most interest. I hope someday this can be as widely accessible and easy to install as a Plecter board.
Thanks, I hope so too.

Beautiful work, as always!
Thank you.

This is the most spot-on real-world hum interpretation I've ever seen. Very nice!
Thanks.
Title: Re: SmoothSwing v2 demonstration
Post by: ShtokyD on October 13, 2017, 12:41:47 PM
Wow, this is truly my favourite motion sound effects! Need!
Title: Re: SmoothSwing v2 demonstration
Post by: dezmodromic on October 16, 2017, 10:48:06 AM
This is outstanding...how a saber should sound!
Title: Re: SmoothSwing v2 demonstration
Post by: Obi_1 on October 20, 2017, 04:10:39 AM
This is a marvel, well done Thexter! Definitely impressive and sounds like a real saber.

When I looked at your first demo video a while back my first though was: heck, this is how native swings/swirls sounds like, which apart from the fact that it sounds insanely authentic has an additional charm that one does not need any special sound files for swings and some other effects which are perfectly substituted by the pitch shifted hum. And - not to underestimate - the sheer amount of code to detect swings and even more complicated gestures like swirls will be reduced as well.

I was in fact so impressed that it gave me just the right kick to embark on a new journey I had been contemplating on starting for a long time. For my boards I wanted to have a more powerful processor, but I kept delaying the project because most saber FX's can be done with an 8-bit AVR. Then I saw this. I spend the last couple of weeks to breadboard a new system, same peripherials, except that instead of a 8-bit AVR now I have a 32-bit processor, and skip the MP3 chip because I can play the sounds from the processor. It's fun!!!
I'm for sure far away from the refined algorithm you must have programmed to make the pitch shift such smooth...at the moment I can play the music, I can even reloop hum gaplessly and interrupt it with clashes. So more or less the ground work is done to thrust into the heart of things. I made a simple sketch to change the playback sample rate simply by the max of the acceleration values from the MPU and I can get pitch shifting... well, sort, but I somehow have the feeling that the acceleration is not the right measurement to base the pitch shift on ... so now I try to base it on velocity instead. Of course any hint to the community is highly welcome. I think I need to find a way to eliminate the gravity...

Thanks a lot and salute to you for driving the open source / programmable saber board solution community!!! Outstanding work!
Title: Re: SmoothSwing v2 demonstration
Post by: JakeSoft on October 21, 2017, 01:50:49 PM
... So more or less the ground work is done to thrust into the heart of things. I made a simple sketch to change the playback sample rate simply by the max of the acceleration values from the MPU and I can get pitch shifting... well, sort, but I somehow have the feeling that the acceleration is not the right measurement to base the pitch shift on ... so now I try to base it on velocity instead. Of course any hint to the community is highly welcome. I think I need to find a way to eliminate the gravity...

I'm not an expert in this particular kind of processing, but it seems like you would want to base the pitch on rotational velocity, which is what the gyro in your boards is already measuring. You'd no doubt have to tune the ratio of the pitch change effect to the magnitude of the sensor readings to get a clean and reasonable effect.
Title: Re: SmoothSwing v2 demonstration
Post by: Obi_1 on October 23, 2017, 03:57:39 AM
Hi Jake, yes, if we consider swirls then the rotation velocity is a good indicator on which to base the offset of the sample rate of the audio playback. If it's about swings, my best guess is that the max velocity needs to be measured. I haven't dealt with the MPU programming since the initial days I programmed my prototype board, so I need to find out if there is a built-in function to provide the velocity values along the axes and the angular velocity. If not, that has to be calculated in code, but with the more powerful CPU I'm currently using it should not be a problem.

@Thexter: did you have any particular reason to abandon pure wav format? Is there an alternate format which lends itself better to pitch shift?
Title: Re: SmoothSwing v2 demonstration
Post by: profezzorn on October 23, 2017, 10:20:40 AM
Hi Jake, yes, if we consider swirls then the rotation velocity is a good indicator on which to base the offset of the sample rate of the audio playback. If it's about swings, my best guess is that the max velocity needs to be measured. I haven't dealt with the MPU programming since the initial days I programmed my prototype board, so I need to find out if there is a built-in function to provide the velocity values along the axes and the angular velocity. If not, that has to be calculated in code, but with the more powerful CPU I'm currently using it should not be a problem.

@Thexter: did you have any particular reason to abandon pure wav format? Is there an alternate format which lends itself better to pitch shift?

I've experimented a little with pitch shift, but I never managed to make it sound good. (Instead it sounded more like revving an engine...)
I suspect that blending multiple sounds with different pitch is going to sound better, because I think that's how the original sounds were made.
Title: Re: SmoothSwing v2 demonstration
Post by: Obi_1 on October 23, 2017, 01:15:38 PM
I've experimented a little with pitch shift, but I never managed to make it sound good. (Instead it sounded more like revving an engine...)
I suspect that blending multiple sounds with different pitch is going to sound better, because I think that's how the original sounds were made.

Mine too, at least if I base the pitch offset purely on acceleration values. Should become better with velocity based shifts. I also suspect that certain hum sounds lend themselves to pitch shift while others do not. For instance I have a sound font which has hum mixed from fire burning and a machine hum. The hum nicely shift its pitch but (do not ask me how) the burning sound refuses to follow suit. So I think it's about finding the right sound font...
Title: Re: SmoothSwing v2 demonstration
Post by: profezzorn on October 23, 2017, 01:52:45 PM
Maybe if you split the hum into two components and pitch-shift them individually.
Having similar sounds at nearby frequencies lead to some interesting effects.
Title: Re: SmoothSwing v2 demonstration
Post by: JakeSoft on October 23, 2017, 05:37:38 PM
Maybe if you split the hum into two components and pitch-shift them individually.
Having similar sounds at nearby frequencies lead to some interesting effects.

That is technically more challenging to implement because you have to handle buffering and playing two sounds simultaneously. However, that is in line with what I have observed about some of my favorite pre-mixed swing sounds. The hum drone seems to continue on in the background while overlayed with the "swoosh" sound.
Title: Re: SmoothSwing v2 demonstration
Post by: profezzorn on October 23, 2017, 08:10:14 PM
Maybe if you split the hum into two components and pitch-shift them individually.
Having similar sounds at nearby frequencies lead to some interesting effects.

That is technically more challenging to implement because you have to handle buffering and playing two sounds simultaneously. However, that is in line with what I have observed about some of my favorite pre-mixed swing sounds. The hum drone seems to continue on in the background while overlayed with the "swoosh" sound.

Just "borrow" my code. :)
Title: Re: SmoothSwing v2 demonstration
Post by: L3monT on November 21, 2017, 05:15:09 PM
Do you sell sabers with this installed? would love to have one of these bad boys!
Title: Re: SmoothSwing v2 demonstration
Post by: Saber Royale on December 29, 2017, 05:39:01 AM
Any update on the availability of this code? Myself, and many others, absolutely love this. It sounds fantastic, and we would love to be able to use it with the teensy board.
Title: Re: SmoothSwing v2 demonstration
Post by: BATMAnakin Skywalker on January 25, 2018, 01:35:38 AM
Any update on the availability of this code? Myself, and many others, absolutely love this. It sounds fantastic, and we would love to be able to use it with the teensy board.

I am curious about this too. Would love to implement this in my teensy build I put on hold. This compels me to complete it!
Title: Re: SmoothSwing v2 demonstration
Post by: Thexter on January 25, 2018, 06:23:21 AM
Any update on the availability of this code? Myself, and many others, absolutely love this. It sounds fantastic, and we would love to be able to use it with the teensy board.

I am curious about this too. Would love to implement this in my teensy build I put on hold. This compels me to complete it!

This has been implemented in the latest teensysaber software: Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)

Algorithm details are here:  SmoothSwing V2 Algorithm description | The Rebel Armory (http://therebelarmory.com/thread/9138/smoothswing-v2-algorithm-description)
Title: Re: SmoothSwing v2 demonstration
Post by: KanyonKris on January 25, 2018, 08:15:36 AM
Thexter, would you share with us how you made your audio files? They sound so good.
Title: Re: SmoothSwing v2 demonstration
Post by: Thexter on January 25, 2018, 09:45:52 AM
Thexter, would you share with us how you made your audio files? They sound so good.

I mostly use Sox (Sound eXchange) SoX - Sound eXchange | HomePage (http://sox.sourceforge.net/)

There's a thread SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread) around font making, but since smoothswing is in its infancy, so is the art of making fonts for it.

One of the key takeaways is that a hum sound that makes a good main hum may not be a good candidate for a good swing hum.

Here's an example of the processing I do for one of my light-side fonts. inputhum.wav is the main hum, and lighthum.wav is a completely different hum that I feel has more "punch".

main hum:
sox.exe inputhum.wav hum01.wav lowpass 2025

8 pairs split into two parts, a and b:
sox.exe lighthum.wav pair01_a.wav pitch 120 overdrive 10
sox.exe lighthum.wav pair01_b.wav pitch 0 overdrive 10

sox.exe lighthum.wav pair02_a.wav pitch -60 overdrive 10
sox.exe lighthum.wav pair02_b.wav pitch 0 overdrive 10

sox.exe lighthum.wav pair03_a.wav pitch 200 overdrive 10
sox.exe lighthum.wav pair03_b.wav pitch 20 overdrive 10

sox.exe lighthum.wav pair04_a.wav pitch -100 overdrive 10
sox.exe lighthum.wav pair04_b.wav pitch -30 overdrive 10

sox.exe lighthum.wav pair05_a.wav pitch 180 overdrive 10
sox.exe lighthum.wav pair05_b.wav pitch 50 overdrive 10

sox.exe lighthum.wav pair06_a.wav pitch -50 overdrive 10
sox.exe lighthum.wav pair06_b.wav pitch 50 overdrive 10

sox.exe lighthum.wav pair07_a.wav pitch 140 overdrive 10
sox.exe lighthum.wav pair07_b.wav pitch 100 overdrive 10

sox.exe lighthum.wav pair08_a.wav pitch -70 overdrive 10
sox.exe lighthum.wav pair08_b.wav pitch -70 overdrive 10

Read more: SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread#ixzz55Df9nDlm)
Title: Re: SmoothSwing v2 demonstration
Post by: KanyonKris on January 25, 2018, 11:57:14 AM
Thanks, Thexter, that is very helpful.