Random sound script?

How can I randomize a sound (a beep) to sound randomly, indefinitely in script form?

Are you looking for a script that makes random noises in the background, or a script that messes with the system settings and causes other applications and tools to make random noises?   I'll assume the former.
Not a beep, but certainly related is the bash command:
say "Hello"
Here is a longer example, and wraps a version of the above bash in some AppleScript.
$ /usr/bin/osascript << EOS
say "Hello $USER"
EOS
There are other options.   Commands include printf "\a", tput bel, echo with a ^G in the string, bash invoking AppleScript via osascript -e "beep 1", etc.   Even if the audible bell is enabled in Terminal.app, these alert mechanisms can be set to very low levels or disabled entirely, depending on local settings for alert sounds within System Preferences > Sounds > Sound Effects.
Here is a one to ten second random sleep in bash:
sleep $[ ( $RANDOM % 10 )  + 1 ]s
Apple also has a Shell Scripting Primer available, and there are various AppleScript sites around.
Caveat: If the system involved is not your computer, then be very sure you want to proceed with this.
Inferring one of the common reasons for this request and particularly if this isn't your system, then this activity is right on the edge of what may be criminally prosecutable in some jurisdictions under the usual sorts of "unauthorized access" phrasing included in the statutes, even if this is a friend's system and was only intended as a "prank".
If this arrest and prosecution does not occur, you can still easily end up distancing yourself from your friend here.  Computer intrusions can be very personal matters.

Similar Messages

  • After upgrading to yosemite my macbook pro late 2011 does a random sound from time to time.

    After upgrading to yosemite my macbook pro late 2011 does a random sound from time to time. Its completely random and i already checked all apps in use and its not from them.

    Sounds like Notifications app.
    Maybe some other app. In SystemPreferences->Users&Groups->LoginItems tab: remove all entries with the minus sign underneath. This will not uninstall anything, you have to start those apps by hand now. Restart.
    Still there?
    Yes: Restart again while holding the shift key, this will start the mac in SafeMode: only the necessary items are loaded to run.
    Still there?
    Yes: Make an etrecheck list and post it here.
    No: Restart, put the items in the LoginItems back, one by one, restart after each entry, and you will find the "culprit"
    Please report accordingly. I will be back in 24 hours.

  • Random sound clips

    got a pavilion d7-6bus laptop problem is  its playing unwanted random audio clips...everything from auto ads to hard rock and cooking tips ....Norton anti virus people say its not a virus...anyone out there have a solution...getting to the point where this computer gonna become part of a landfill

    Hello autodiddy,
    I see that you are having problems with random sound clips on your HP computer. I have some suggestions that may help with this issue.
    I would first suggest doing a clean boot. This will make sure that there are no software programs causing the clips to play. Here is a link that explains how to do a clean boot.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Playing random sound in array

    Hey guys,
    I'm new to AS3, still learning. I just read a little about arrays in the book I was learning from, and after looking at some online stuff, thought I'd try to do something simple with one.
    What I'm trying to do is save a bunch of sounds (different dog barks) in an array and then when I press the button, it plays a random sound from that array. Here's what I have so far :
    package
              import flash.media.Sound;
              import flash.media.SoundChannel;
              import flash.events.MouseEvent;
              import flash.display.MovieClip;
              public class Sound2 extends MovieClip
                        var bark1:Bark1;
                        var bark2:Bark2;
                        var bark3:Bark3;
                        var bark4:Bark4;
                        var bark5:Bark5;
                        var bark6:Bark6;
                        var soundChannel:SoundChannel;
                        var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                        public function Sound2()
                                  barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                                  bark1 = new Bark1();
                                  bark2 = new Bark2();
                                  bark3 = new Bark3();
                                  bark4 = new Bark4();
                                  bark5 = new Bark5();
                                  bark6 = new Bark6();
                                  soundChannel = new SoundChannel();
                                  function onBarkButtonClick(event:MouseEvent):void
                                            var barkNo = Math.round(Math.random() * 5);
                                            soundChannel = (barkArray[barkNo]).play();
    When I try to press the button, I get this error message :
    TypeError: Error #1006: play is not a function.
              at MethodInfo-22()
    I used trace and saw the numbers from barkNo were fine, I think it's just something about the array. I've also spent a few hours trying to do it different ways, but still nothing. How can I play a random sound from an array? And am I storing the information correctly? I'm not sure what I'm missing, any help would be great.
    Thanks

    First, never use nested and anonymous functions - you position yourself for a lot of trouble.
    Try this (I did not test it though):
    package
              import flash.media.Sound;
              import flash.media.SoundChannel;
              import flash.events.MouseEvent;
              import flash.display.MovieClip;
              public class Sound2 extends MovieClip
                        var sound:Sound;
                        var soundChannel:SoundChannel = new SoundChannel();
                        var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                        public function Sound2()
                                  barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                        private function onBarkButtonClick(event:MouseEvent):void
                                  soundChannel.stop();
                                  sound = new barkArray[int(barkArray.length * Math.random())]();
                                  soundChannel = sound.play();

  • [SOLVED] Where should I put this sound script?

    I found a sound script so that when my tv outputs hdmi sound also does so automatically. Where do I put?
    #!/bin/sh
    if [[ $1 ]]
    then
    xrandr --output HDMI1 --off
    pactl set-card-profile 0 output:analog-stereo
    else
    xrandr --output HDMI1 --mode 1920x1080 --right-of LVDS1
    pactl set-card-profile 0 output:hdmi-stereo
    Last edited by quasifilmie (2012-01-30 00:56:33)

    Yeah, I was afraid of that. 
    How do you start your window manager, and which window manager / desktop environment are you using?
    If you are using startx, you could invoke it from your ~/.xinitrc.  You might create a second scipt, launch it in the background, and put a sleep at the beginning to ensure X is ready.
    KDE, Openbox and Xfce4 allow you to run scripts at start up.  Gnome might, I would not know.

  • Random Sound Array Issue

    Been trying to implement a random sound picker on the main
    timeline. (Keeping in mind it needs to work in AS1)
    All my sounds are correcly identified under the "linkage"
    propreties.
    Somehow, my array value always comes up undefined. And none
    of the sounds would play.
    Help would be greatly appreciated.

    "Detonate 2004" <[email protected]> wrote in
    message news:eaq6n1$pq7$[email protected]..
    > Please forget the last post since my array was still not
    correctly syntaxed.
    >
    > The latest corrective outputs: [object Object],[object
    Object],[object
    > Object],[object Object]
    > And still no sounds.
    >
    > Latest file here:
    >
    http://www.mysharefile.com/v/2899615/1_as1_soundarray.fla.html
    I can't look at the fla because of my old Flash version but I
    looked at your posted code again.
    Do you need all that array stuff for anything? I mean, if all
    you want to do is play a random song every N seconds you can do it
    with just a few lines of code..
    function randomSound()
    stopAllSounds();
    var snd = new Sound();
    var g = random(2) + 1; // 1, 2 or 3
    snd.attachSound("s"+g); // s1, s2 or s3
    snd.start(0, 1);
    randomSound(); // start the first song now
    id = setInterval(randomSound, 10000); // change songs every
    10 seconds
    Make sure you have 'linkage' names for your 3 songs (not
    library names)
    Your original code did play 1 song every 1 second (just makes
    a popping sound when changing that fast) so I suspect that your
    linkage names were missing.
    I wouldn't use a recursive coding like that though. (a
    function that calls itself)
    tralfaz

  • Urgent: iMovie creating movies with random sounds throughout

    When exporting my iMovie project - which I put together clips from various documentaries, muted them, and put my voice over in mp3 files... random sounds appear at various points - these are the sounds from one video that I've muted.
    The sounds do not even appear during the playing of this video - but others way before it.
    None of this shows up in the preview, and I've tried saving it as both as the highest definition - 1080p, as well as the 'tiny' movie (but even this takes 10 minutes to compile).
    The stange sounds appear at exactly the same place in both versions... I even changed a few things before the second 'tiny' export, but it was still the same.
    The original movie files were high quality, of various formats - mp4, avi, .mov, etc.
    The particular file that the audio is coming from is an mp4 file (1920x1080 originally)- it has been muted in the video, and in the Events browser.
    I downloaded this video from YouTube, via www.keepvid.com - it's called: Coral reefs and climate change- A message for Copenhagen, and can be found here: http://www.youtube.com/watch?v=8SdDiHbG1tY&hd=1
    I have restarted my computer, iMovie, everything...
    ...this video is due ASAP, and I'm not sure how to solve this irritating issue.
    I hope to hear from you!!

    There have been numerous posts about audio issues. In almost all cases, the user has used speeds other than the presets. Changing to the presets fixed the problem. It's possibly a bug in iMovie, or a less than stellar design with the slider - maybe a pop-up box would have been better.
    If you don't want to mess with your project, then duplicate it (File>Duplicate Project). Then make the changes in the duplicate.
    John

  • My iPhone was getting hot when used or charging. Went to Apple in Portland, OR.Phone making random sound. Why??? How do I make it stop????

    My iPhone was getting hot when used or charging. Went to Apple in Portland, OR. I did a reset on the phone. My IPhone is now making a random sound. Why??? How do I make it stop???? I have turned off all notifications. I do not have life360 or Skype. I do have Facebook, WordsFree, ScrabbleFree, Pandora.

    I did the reset. I updated the iPhone to 6.0. The alert sound stopped for a while then started again. I had to go to notifications a few times to turn off some of the alerts and now I have peace, plus I learned more about the notifications. Thanks for your help. I did not need to go to the Apple Store.

  • Random sounds playing from Macbook unprompted

    My Macbook Pro is playing random sounds when it is not being asked to.  Computer on right now, with no music playing and very short snippets of sound (2 seconds at most) are playing out the speakers - trying to identify them they are not parts of songs I have (iTunes is not running right now) but sound like the sonic element of a video that is buffering.  The biggest segment I heard just a few minutes ago where an American lady said quite a few words (sounded like an infomercial).  It's happening maybe every few minutes, but not at regularly timed intervals.
    Sounds sort of like trying to tune a radio and only catching snippets of sound (but less regular)
    Currently running - google chrome, finder and messages.
    Also open Dropbox, Copy, Evernote, f.lux, Gdrive and Twitter apps.
    MacBook Pro (Retina, 13-inch, Late 2013) / Running Yosemite 10.10 (I'm not 100% sure but I think this problem started before Yosemite upgrade)

    HI and Welcome to Apple Discussions...
    Random sounds playing.
    Check your Dashboard widgets. You might have something running ...
    Carolyn

  • Suggestions for simple random image script

    Would like to randomly display one of five new JPG banner each time page is loaded.
    Your experience would be appreciated.
    Thanks

    Since no one replied, I am posting solution I found.for future inquiries.
    Simple PHP Random Image Script
    This can be done in one line of text directly in your HTML and a collection of images.
    The first step is to gather together the images you wish to have randomly rotated.
    Change all of their file names to a numerical order, starting with the number 1.
        * 1.jpg
        * 2.jpg
        * 3.jpg
        * 4.jpg
    Be sure each image has the same extension (either all jpg, png, or gif),
    and that there are no gaps in the numbers.
    Also, place these images in their own folder to keep everything organized.
    Write the Code
    In the HTML of your page, insert the following code where you want an image to display:
    <img src="path/<?php echo rand(1,n);?>.jpg" alt="Random Image" />
    The “rand” operator will display a randomly generated number between 1 and ‘n’.
    Change ‘n’ to the total amount of pictures you have arranged numerically
    (or the highest numbered picture you have).
    In the example above I only have 4 pictures, therefor I would change it to: rand(1,4);

  • HEY SMART GUYS-CHECK YOUR LINK TO ARTICLE: Firefox makes random sounds KB article. CAN NOT ACCESS IT UNLESS YOUR ARE REGISTERED USER!!!!

    Title says it all. New article "Firefox makes random sounds KB article" on main page http://support.mozilla.com/en-US/kb/Firefox+Support+Home+Page to help users with the Pac-man and siren sounds can only be accessed by those who are registered users. Not much help to most users here asking questions!!!
    FIX IT!!!!!

    Sorry, we got so much traffic on the site, it was taking a few minutes for the link to go live. I don't think a sticky is needed because most people posting to the forums don't read the forums first so it won't do much good.

  • Random sound ext

    is there an extension that will load random sound files on
    page load?

    Well I have one more suggestion:? I almost hear congestion or crackling in your recording. So here is something else for you to try:
    if you go to device manager and then right click on your hard dri've, and choose properties, and policies, can you try to vary your "cache: settings? if you relax this setting by unchecking it, perhaps your hard dri've will not "read ahead" and then you will have smoother playback.
    Cheers,
    jmacguire

  • Random sound files play

    Recently, when changing tabs on Firefox, random sound files play. They sounded like PCH sound files so I contacted them. Their support team confirmed that this is a known bug and "would be fixed soon". I can find nothing on the web but few people would associate random Firefox sound files playing with a PCH infection anyway. I want to get rid of them now. Any solutions?
    Windows 8.1, HP Pavilion laptop using Firefox.

    PCH installed the file in FlashPlayer.
    Clearing Flash Cache killed the file and the problem.
    Here are the directions for doing that:
    If you are using a Windows machine running Internet Explorer, Firefox, or Safari:
    Click the "Start" button located in the bottom left hand corner of your screen.
    Windows 8 means a treasure hunt, or Cursor to top right corner, Settings, Control Panel
    Click on "Control Panel" (or depending on your system setup, "Settings" and then "Control Panel").
    Click on "Flash Player" (or "System and Security" and then "Flash Player").
    Click on the "Advanced" tab located along the top of the "Flash Player Settings Manager".
    Ensure the latest version of flash player is installed (click "check now" to verify which version you have installed).
    Click the "Delete All..." button located at the top of the "Advanced" section of the "Flash Player Settings Manager".
    Ensure that there is a checkmark beside the "Delete All Site Data And Settings" option.
    (IMPORTANT: leave the "Delete All Audio and Video License Files" option UNCHECKED).
    Next, click the "Delete Data" button located in the bottom right hand corner of this window.
    Close the "Flash Player Settings Manager".
    Close the "Control Panel".
    Restart your browser
    If you are using Google Chrome please follow the below instructions:
    Click on the following link to navigate to Adobe's online Flash Player Settings Manager.
    Click on the "Delete all sites" button.
    Restart your browser.
    To clear the Flash Player cache on a Mac, please follow these steps:
    Close your web browser.
    Click on the Apple logo in the upper, right-hand corner of your screen and choose "System Preferences"
    Click on the "Flash Player" icon near the bottom of the System Preferences window.
    Under the "Storage" tab, click on the "Delete All" button.
    On the next window, make sure the "Delete All Site Data and Settings" option is selected and unselect the "Delete All Audio and Video License Files" option.
    Click the "Delete Data" button.
    Close the System Preferences window.

  • Choose random image script

    I'm creating a small movie with a set of random images that all appear in the same spot (no horizontal or vertical movement). I want each image to appear onscreen for two seconds, then be replaced by another randomly-chosen image. There are 17 images in the set. Here is the script I'm using:
    on enterFrame
      channel=random(17)
      _movie.delay(2*60)
    on exitFrame
      go to the Frame
    end
    This script works well. However, because the population is small - only 17 - what happens when I run the script is that a little too often it randomly chooses the same image once, twice, sometimes up to five times in a row, which gives the effect that the movie is either stuck or not working properly. I would like to find out how to modify the script so that on exitFrame it chooses randomly any of the other 16 images but not the current image. At first I thought if the script read random(16) or random(17-1) that might work, but it doesn't.
    Any thoughts would be welcome.
    Dallas

    Hi Sean,
    This randomizing project of mine is becoming more complex than I first realized and I now have another question that I hope you might be able to help me with.
    The project breaks down into class, category, group and member. There are 9 classes (and perhaps a possibility in the future that further classes could be added). The structure and naming convention within each class is identical down to the member level. For example, Cat. 1 of Class 2 and Cat 1 of Class 7 both have the same names. Group 3 of Cat. 1 of Class 2 and Group 3 of Cat 1 of Class 6 both have the same names. However, the members of these groups do not have the same names.
    In each class there are 4 categories, each with a different name. Each category contains a number of groups (each group has a different name). Each group contains a number of members. Each member in categories 1 and 2 is a bitmap image. The total number of bitmap members in the project is 21.
    To give a fictionalized example (this project is not about clothing, but I'm using it as an example):
    Class 1 = shirts
    Class 2 = hats
    Class 3 = pants
    Class 4 = socks
    Class 5 = shoes
    etc.
    Category 1 = British
    Category 2 = Japanese
    Category 3 = Turkish
    Category 4 = Brazilian
    Group 1 = Cotton
    Group 2 = Synthetic
    Group 3 = Speed
    Group 4 = Sound
    and so forth.
    In Class 1 (shirts) there are British, Japanese, Turkish and Brazilian shirts and these could be made of either cotton or synthetic. In addition, there are a variety of speeds and sounds from which to choose when displaying the shirts.
    In my project:
    Cat. 1 has 7 groups and each group varies in the number of members with either 7, 14 or 21 (but no other alternative to these numbers).
    Cat. 2 has 13 groups and each group has 7 members.
    Cat. 3 does not randomize images but lets me choose any one of 12 different speeds for randomization in half-second increments.
    Cat. 4 does not randomize images but lets me choose any one of 6 different sounds. Whenever the randomized image changes, this triggers the sound. The sound is not randomized but is consistent once the choice for what KIND of sound has been made. In short: tick, tick,tick, or tock, tock, tock but not tick, tock. It is possible that in the future more sounds could be added.
    Navigation should allow me to start with any of the four categories. For randomization to work, I must choose within either Cat. 1 or Cat. 2 (but not both) and I must make a choice of some sort within Cat. 3 (speed of randomization) while Cat. 4 is entirely optional (sound on or off, but not required to be on and, if it's to be on then choice for which kind of sound).
    There are also an additional two buttons for sound on or off than run the length of the score within any class, meaning that while randomization is occuring anywhere within a class, I can choose to turn the sound on if it's currently off or off if it's currently on. Turning it on while randomization is taking place will also probably require a choice of which kind of sound (meaning a floating window I suppose) so as not to exit the frame where randomization is taking place.
    Now for my question: should I create one massive behaviour script for all classes that includes a series of nested if/else statements for each category, group and member, or should I create 4 large behavior scripts, one for each category with if/else instructions for its groups and members, or should I script at the group level, which will result in 180 separate behaviour scripts for image randomization plus additional scripts for speed and sound?
    Further, I understand how to apply at the group level the script you gave me earlier (and it works beautifully), but if you think it would be more efficient now to work at the category or class level, I'm not sure how to script the if/else statements. I'm assuming that in whichever of these solutions turns out to be best, it is applied to a single sprite which will serve to display the randomly-chosen image. Bear in mind that the script you gave me randomizes the image change every two seconds. Now I'm looking to have a choice of it changing within a range of once every half-second to once every 5 seconds (e.g. 0.5 sceonds, 1 second, 1.5 seconds, 2 seconds, etc.).
    An ancillary question: could this be done a different way? A friend suggested using subroutines but wasn't able to tell me how to do this because he doesn't know anything about Lingo. I was wondering whether the if/then syntax structure is Lingo's way of doing subroutines.
    Your thoughts would be most welcome. If you think you can't help me with this, do you have any suggestions as to where I might turn for help (apart from the nuthouse at this point)?
    Cheers,
    Dallas

  • Random Sound Source

    Hi I was wanting to add a script to my "kids radio" which I'm
    attaching to my website. It'll come up as a dreaded popup window
    and what I want to know is when you click on the play button is
    there a way that I can come up with a script to randomly play a
    series of around 10 sound files one after the other?

    This thread regarding sound issues on the MacBook Pro:
    http://discussions.apple.com/thread.jspa?messageID=9530160#9530160
    touches on many of the issues mentioned here. It seems Apple are incapable of a) listening to their customers, b) acknowledging problems with their products and c) rectifying them in later releases.
    To summarise the (lengthy!) thread:
    -Don't expect Apple to magic this away with an update - its a hardware problem caused by issues a), b) and c) mentioned above.
    -High impedence headphones (40-50 ohms or higher) reduce the bleepy nonsense to the point where it may not be noticable. Not GONE. Just not AUDIBLE. This is a medium-expensive workaround (not fix).
    -Some people have eliminated the problem by using a Firewire audio interface. This is an expensive and impractical solution for a laptop. Maybe not so impractical for a desktop.
    -Many users have reported that a cheap-as-chips "Volume control headphone extension" from Radio Shack does the trick. Turn up the volume on your computer and turn down the volume control on the doohickey to the appropriate level. This is a cheap workaround that, like high impedence 'phones, supresses rather than eliminates the problem.
    Now you don't have to plough through 181 messages about this problem which SHOULD HAVE BEEN FIXED IN THE TWO YEARS APPLE HAVE BEEN RECEIVEING COMPLAINTS ABOUT IT!!!
    "Geniuses", my **ing arse.

Maybe you are looking for

  • Unable to access a specific website

    Hello- I am trying to access a website that has my security camera DNS.  I continue to receive a server not found error message, yet when I contact the company www.nightowldvr.com, they say they are up and running.  They seem to think that AT&T has b

  • ALV downloaded to EXCEL -using standard button-how to modify the EXCEL ???

    hey guys,   i have developed an ALV (with dynamic itnernal table,with HTML top of page,using FMs) Now ,i ahd problems with downlaod to excel(which i partly overcame by using &XXL fcode button instead of other 'donwload to excel button' ).. now the da

  • All these problems with 3GS update of iSO4...IS IT WORTH IT YET? or wait?

    Hi all, So there are tons of issues going on with the 3gS updated with iSO4.. is it worth it or should I just wait until next update? I dont want to lose anything on my phone or anything... Also, if its really frustrating if things dont work after th

  • Can Someone help with SQL for update ?

    Hi, can someone help me with this code 2 tables. table 1 = User_master table 2 = update_users I need to update user_master like so... update user_master set status = 'I' where user_id IN () problem is I have to over 10k user_id to update. So created

  • Generating reports for events

    All, We are looking to generate some reports on RM'd document events. For example, number of documents viewed in a week or month etc. Has anyone done something like this? Suggestions as to where to begin? Thanks, Andrew