Skip to content

Sound file triggering question!

Hello! This isn't for a game, but it would be a very similar issue. I'm trying to use my car's RPM to play through an mp3 file. It's basically just for fun to see what can be done as far as tweaking my exhaust sound a tiny bit.

The idea behind it is that if I speed up, the mp3 plays through until I shift, and then it restarts. If I slow down, it should play more slowly in reverse direction.

I originally wrote a proof of concept in Python, but it didn't run fast enough from my Raspberry Pi 3 B+, so I'm switching it to C++. I really just don't know if any game development guys might have done something similar for a car-based game. Thanks!

3 points4 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 100% up
Kind
Text
ID
b53us5

Author

6
posts
2
comments
3
media
View profile

5 comments

Adjust the pitch, a low pitch for low rpm and vice versa. Also adjust the speeds accordingly.

1 points

That’s the right idea, but I don’t know a C++ library that could do that.

1 points

Look into fmod I think it's called. I got some audio working with that. If you're good with Python it should only be a matter of learning the C++ syntax.

I think fmod had options for everything. If not then I'm not sure, maybe SDL has some audio functions? You COULD do it in Unity and build it as an app for your phone.

1 points

Sounds like an interesting project, but what is the actual question you're trying to ask?

1 points

How to play through a different part of a sound file dependent on RPM.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.