Engine Sound

8 views (last 30 days)
Paul
Paul on 18 Oct 2011
I have a laptime race car simulator I've created for my masters project and I'm just "adding the icing to the cake" so to speak.
My simulator shows the cars engine RPM in realtime as it races around the track and I want to add sound to this.
So I need to create or use a pre recoreded engine sound that varies with the engine RPM, mind you the engine RPM can rise and fall at varying rates depending on the values inputted for the simulation (and can also be human controlled)
Any help would be greatly appreciated, thank you.
ps. I've just had an idea, I have an audio file that is just an engine at a single RPM and I can play this at different frequencies which makes it sound like a different RPM. But I can only change the frequency then the whole file needs to be played, if there is a way to change the frequency while the file is being played then I would have solved my problem.

Answers (2)

Daniel Shub
Daniel Shub on 18 Oct 2011
With standard MATLAB sound commands you cannot stream sound. In other words the sound commands need the entire array before they start. There are port audio implementations of sound that allow you to stream sound with variable latencies and likelihoods of dropping frames. In my opinion the best comes from psychtoolbox ( psychtoolbox.org ) but pawavplay and playrec also probably can get the job done.
I would probably recommend just having the cake without icing.

Paul
Paul on 18 Oct 2011
I've used the audiplayer function and I can change the 'SampleRate' during play to give the desired effect but there is a slight pause whenever the samplerate is changed.
I've just started looking into the solutions you've mentioned Daniel, we'll see what I can get from them.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!