Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

High frequency sound generator?

Hi - I am developing an app which has a function a bit like the ultra sonic sound anti mosquito app - can anyone give me a steer as how to best accomplish this? I'm developing with JQ mobile and Xcode..

Thanks in hope!

cheers
Jim
Post edited by Jimbly2 on

Replies

  • BobarinoBobarino Posts: 167Registered Users
    Get the sound and make a button that triggers it. Was that what you were asking, or do you want code or something? Code wise, all you will need is too make an IBAction for when the button is pressed and use this code in it
     NSString *path = [[NSBundle mainBundle] pathForResource:@\"Whatever sound is called\" ofType:@\"mp3 or whatever it is\"];
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath: path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];


    Thats pretty much all the code you'll need...
    [IMG]http://img163.imageshack.us/img163/2342/57icon.png[/IMG]



    <a href="http://itunes.apple.com/us/app/island-hop/id454816972?ls=1&mt=8" t
  • Jimbly2Jimbly2 Posts: 8New Users
    Bobarino;398578 said:
    Get the sound and make a button that triggers it. Was that what you were asking, or do you want code or something? Code wise, all you will need is too make an IBAction for when the button is pressed and use this code in it
     NSString *path = [[NSBundle mainBundle] pathForResource:@\"Whatever sound is called\" ofType:@\"mp3 or whatever it is\"];
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath: path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];


    Thats pretty much all the code you'll need...
    Hi Bobarino,

    .. thanks for that - much appreciated, I was guessing that the ultra high frequency would be generated by some sort of tone generator - I hadn't thought of it as being a sound file but that makes more sense.

    Now to find the sounds... :-)

    Thanks again, and a happy new year to you and yours,
    Jim
  • Duncan CDuncan C Posts: 8,033Tutorial Authors, Registered Users
    Jimbly2;398626 said:
    Hi Bobarino,

    .. thanks for that - much appreciated, I was guessing that the ultra high frequency would be generated by some sort of tone generator - I hadn't thought of it as being a sound file but that makes more sense.

    Now to find the sounds... :-)

    Thanks again, and a happy new year to you and yours,
    Jim
    I did a search on "iOS tone generator", and the first link was a project that shows how to create a tone generator using AudioUnits:

    Cocoa with Love: An iOS tone generator (an introduction to AudioUnits)
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • Jimbly2Jimbly2 Posts: 8New Users
    Duncan C;398640 said:
    I did a search on "iOS tone generator", and the first link was a project that shows how to create a tone generator using AudioUnits:

    Cocoa with Love: An iOS tone generator (an introduction to AudioUnits)
    Thanks for the heads up Duncan, I have downloaded the sample and will see if that's a better solution.

    cheers,
    Jim
Sign In or Register to comment.