Advertise here

Advertise here

Howdy, Stranger!

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

HELP Please. Sound effect and record using AVAUDIOENGINE

davut5davut5 Posts: 10New Users Noob
edited September 2015 in iOS SDK Development
i want to record my voice with reverb effect. i hear my voice with effect while recording.
When I listen to my voice after recording is finished, I hear my voice none-effect. WHY?
here is my code.

var reverb = AVAudioUnitReverb()
var engine = AVAudioEngine()
var file: AVAudioFile?
var player = AVAudioPlayerNode() // if you need play record later

override func viewDidLoad() {

// Do any additional setup after loading the view, typically from a nib.
file = AVAudioFile(forWriting: URLFor("my_file.caf")!, settings: engine.inputNode.inputFormatForBus(0).settings, error: nil)

reverb.wetDryMix = 80


engine.connect(engine.inputNode, to: reverb, format: engine.inputNode.inputFormatForBus(0)) //configure graph

engine.connect(reverb, to: engine.mainMixerNode, format: engine.mainMixerNode.outputFormatForBus(0))


@IBAction func record(sender: AnyObject) {
engine.inputNode.installTapOnBus(0, bufferSize: 1024, format: engine.mainMixerNode.outputFormatForBus(0)) { (buffer, time) -> Void in
self.file?.writeFromBuffer(buffer, error: nil)


@IBAction func stop(sender: AnyObject) {

func URLFor(filename: String) -> NSURL? {
if let dirs : [String] = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true) as? [String] {
let dir = dirs[0] //documents directory
let path = dir.stringByAppendingPathComponent(filename)
return NSURL(fileURLWithPath: path)
return nil
Post edited by davut5 on
Sign In or Register to comment.