Record the sound and play it back with changed pitch

后端 未结 2 1780
情歌与酒
情歌与酒 2021-02-06 13:37

I have to implement a iphone application which will record user\'s voice as you starts speaking, and change the pitch of the recorded sound and play it back. I am able to record

2条回答
  •  臣服心动
    2021-02-06 14:05

    Actually there is an easier solution. Use the rate feature of the audio player. It ranges between 0.1f - 2.0f where higher number means faster and squeekier pitch and lower number means slow dragged out sound (deep voice)

    player = [[AVAudioPlayer alloc] initWithContentsOfURL:
                      [NSURL fileURLWithPath:path] error:&err];
            player.volume = 0.4f;
            player.enableRate=YES;
            [player prepareToPlay];
            [player setNumberOfLoops:0];
            player.rate=2.0f;
            [player play];
    

提交回复
热议问题