I'm working on a prototype for a lightsaber that changes the pitch and volume of its hum sound as it moves. The current solution only changes the volume (easy), and it doesn't sound realistic enough. I know I need to use .wav or .aiff (not lossy like mp3) to accomplish this. Ideally I'm looking for a lightweight solution, as I plan on running the final iteration of this on an Arduino Nano extra. So, the question is, how can I alter the pitch of a sound being played from a file in real time with limited computing power? Barring that, does anyone know ANY approaches that could accomplish this, regardless of complexity and power.
I would not use files, but generate the sound mathematically. It's probably a very basic sinewave.
Unfortunately, It's actually a rather complicated sound I modeled using Logic's Alchemy, Sculpt, and ES2 digital synth modules--The nano simply doesn't have the computing power to both model and play these sounds, and even the simple saber hums are more complicated than a sine wave. if I was on the Portenta (the only Arduino product powerful enough to do this in a workable form factor), It would be feasible, but this is going to be a for a commercial product, and I need to keep the costs low. I've been doing research and think this might be possible by using the Arduino wire library and writing a custom wave file player, but I haven't worked it out completely yet. I also have to play multiple files on top of one another (a swing sound or a clash sound over the hum, and if I use a generated sound for the hum, I loose the ease of simply being about to sum the wav files to play them together.
Have you tried the tone library Tone();
tone() only supports one tone at a time, and it's just a square wave, so unfortunately that's not going to work either.
There are a number of issues here.
Firstly I am not sure if your prototype method can be implemented on your target hardware.
Secondly the accuracy of your simulation will determine the capability of your target hardware.
Thirdly the output interface will need to be supported by the target.
There are a lot of posts on simulating light sabres on youtube
Pitch-shifting, as mentioned in the first post, requires some serious DSP power, especially when the sound is complex and rich in harmonics (like a light sabre).
Of course, if you simulate the sound (as, to be fair, you did mention) or use a WAV file as the base sound, then you have techniques for altering the pitch by clocking in the WAV samples at different rates.
By the way, I don't recall the light sabres in the films changing their pitch. Are you sure that's a requirement?
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.