How do I synthesize sounds with CoreAudio on iPhone/Mac

后端 未结 3 669
清歌不尽
清歌不尽 2021-01-30 05:38

I\'d like to play a synthesised sound in an iPhone. Instead of using a pre-recorded sound and using SystemSoundID to play an existing binary, I\'d like to synthesise it. Partial

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 06:15

    Many of the audio technologies allow for data to be passed in instead of a sound file. AVAudioPlayer, for example, has:

    -initWithData:error:
    Initializes and returns an audio player for playing a designated memory buffer.
    
    - (id)initWithData:(NSData *)data error:(NSError **)outError
    

    However, I am not sure how you would pass in a data ptr, start the sound, and then keeping it looping by passing in other data ptrs, or repeating the same, etc.

提交回复
热议问题