Re: Simplest way to generate audio tones?
Re: Simplest way to generate audio tones?
- Subject: Re: Simplest way to generate audio tones?
- From: Jonathan Hull <email@hidden>
- Date: Sat, 28 May 2016 23:14:28 -0700
Here it is for iOS (I assume that this is low-level enough that it is almost the same cross-platform):
https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW6
My first thought would be to either create a buffer (as you say) or file with the sound you want, and then play that…
Thanks,
Jon
> On May 28, 2016, at 10:44 PM, Graham Cox <email@hidden> wrote:
>
> Probably should have mentioned this is Mac, not iOS.
>
> Yes, there are Audio Units, but they’re not really what I’m after. You can’t simply create a generator audio unit and use it in an app to generate tones (as far as I’m aware) - it has to be part of the whole Core Audio signal chain. I’m looking for a much higher level approach if possible. I’m thinking perhaps AVAudioPlayer might be suitable, as it has an init method that takes an NSData object that is a sound buffer. I can definitely make one filled with sine values, but as usual the documentation lets me down - it states that the buffer must be formatted according to the supported formats listed in "Multimedia Programming Guide”, but I can find no such guide and the mention on the page isn’t a link.
>
>
> —Graham
>
>
>
>> On 29 May 2016, at 3:36 PM, Jonathan Hull <email@hidden> wrote:
>>
>> This is way out of my area of expertise, but it appears you want AudioUnits:
>> http://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html
>>
>> Thanks,
>> Jon
>>
>>
>>> On May 28, 2016, at 8:24 PM, Graham Cox <email@hidden> wrote:
>>>
>>> Hi all,
>>>
>>> I’m looking for general pointers to the simplest/quickest way to generate an audio tone (sine wave) of a given frequency and duration. Most of the audio APIs seem concerned with playing samples rather than generating tones, so it’s not immediately obvious where to look.
>>>
>>> —Graham
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden