How to trigger sound from accelerometer output

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mediciportfolio
Posts: 1
Joined: 10 Mar 2011, 02:53

How to trigger sound from accelerometer output

Post by mediciportfolio »

Does anyone have a sample or example (or a pointer to instructions) on how to trigger a sound from accelerometer sensor output? Thanks
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: How to trigger sound from accelerometer output

Post by mattallen37 »

Can you be more specific? What language are you using? Do you know how to get the value to begin with? What circumstance(s) do you want to trigger the "sound"?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: How to trigger sound from accelerometer output

Post by mightor »

The only way to trigger a sound from the accelerometer is by throwing it on the floor or wall (make sure it's concrete or tiles, carpets or not great for making loud sounds). Your sensor may or may not work so well for actual acceleration measurements afterwards.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
loopymech
Posts: 35
Joined: 30 Sep 2010, 15:35

Re: How to trigger sound from accelerometer output

Post by loopymech »

By applying a high voltage to the accelerometer inputs, you can trigger a brief "popping" sound (quite possibly accompanied by white smoke). However, this too is likely to degrade your accelerometer's performance.

:D

-Loopy
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: How to trigger sound from accelerometer output

Post by hassenplug »

Oh, my turn... build a device to fire the sensor faster than the speed of sound. It should (may?) create some sort of noise as it breaks the sound barrier.

Or, connect it to an NXT, and watch the value on the correct axis to see if it's larger than a give threshold. When it is, play a sound.
---> Link to lots of MINDSTORMS stuff under my picture --->
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: How to trigger sound from accelerometer output

Post by mightor »

hassenplug wrote:Or, connect it to an NXT, and watch the value on the correct axis to see if it's larger than a give threshold. When it is, play a sound.
Too easy.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: How to trigger sound from accelerometer output

Post by HaWe »

can the thread title be a Google translate artefact?
haydenstudios
Posts: 252
Joined: 22 Oct 2010, 20:05
Location: The United States of America
Contact:

Re: How to trigger sound from accelerometer output

Post by haydenstudios »

I don't know what programming language you use. A majority of us here prefer NXC. But in case I'm lucky enough for this to be helpful and you do use NXT-G, I'll show you a little demo of how you would do it in NXT-G. So, now getting serious like Matt was TRYING to be,
Sorry Xander, Loopy, and Steve (EDIT: and Vincent,) for being such a party pooper.
I would first drag an infinite loop block onto the workspace, then Drag the acceleration sensor block inside of it, and plug the x axis into a multiplication block which will multiply the value by 10, then drag a sound block into the loop, and configure it to play a tone for 0.1 seconds. Now plug the result into the tone port on the sound block. And that should be it! Here is what it should look like:
Image
Also, if you do not have the HiTechnic Acceleration sensor block, then you may download it here: http://www.hitechnic.com/upload/744-Acc ... Sensor.zip
If you already have the aceleration sensor block, and you don't want to go through all of the hassle of doing this yourself, then just download my sample program at the bottom.
Attachments
Acceleration sound.zip
Please note that this program isn't perfect since I threw it together in a few minutes. For example you could change the multiplication from 10 to 100, or just not have it at all. Or you could change the duration of each tone from 0.1 seconds to 0.01 seconds, or to 1 second. This is really just a demo.
(82.3 KiB) Downloaded 250 times
Last edited by haydenstudios on 15 Mar 2011, 02:40, edited 2 times in total.
-Hayden
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: How to trigger sound from accelerometer output

Post by mattallen37 »

lol, I like the jokes.

@haydenstudios Unless he wants to trigger if greater than a certain level. Then he could use a comparator and a switch (maybe just a switch, I forget exactly how they work in NXT-G).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
haydenstudios
Posts: 252
Joined: 22 Oct 2010, 20:05
Location: The United States of America
Contact:

Re: How to trigger sound from accelerometer output

Post by haydenstudios »

Yes, you're right Matt. I do see that I slightly miss interpereted his words. But even then, we still do not know what language he uses. So my stuff might not be helpful at all. I usually try not to judge people based on such little information, but I commonly get the impression that people with one post this late on in the creation of this forum, and with the same join date as the creation date of the thread they started are relatively new to NXT, and use NXT-G.
-Hayden
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests