Objective-C sound reproduction

I know how to play mp3 files and something else in Xcode iOS. But how can I play a certain frequency, for example, if I just wanted to release a C # note in 25 seconds; How can i do this? (Synthet is not so important to me as soon as a note moves.)

+4
source share
2 answers

You need to generate a PCM sound form that matches the note you want to play, and save it to the sample buffer in memory. Then you send this buffer to the audio equipment.

Here is a tutorial on generating several types of waveforms. This article details many aspects of the note you need to consider, including frequency, volume, waveform, sample rate, etc. The article presents the source code of Flash, I think that you should not have problems with concepts and adapting them to iOS.

If you also need a library that you can use to play back generated buffers on iOS, I recommend open source Finch .

Hope this helps!

+1
source

You can synthesize waveforms of the desired frequency and feed them to callbacks of either audio queues or the RemoteIO Audio Unit API.

Here is a short tutorial on some code that is needed to create sine signals for iOS in C.

0
source

Source: https://habr.com/ru/post/1380932/


All Articles