Questions tagged [audiotoolbox]

The Audio Toolbox framework provides interfaces for recording, playback, and stream parsing. In iOS, the framework provides additional interfaces for managing audio sessions.

Audio Toolbox Framework Reference

366 questions
110
votes
1 answer

Receiving kAUGraphErr_CannotDoInCurrentContext when calling AUGraphStart for playback

I'm working with AUGraph and Audio Units API to playback and record audio in my iOS app. Now I have a rare issue when an AUGraph is unable to start with the following error: result = kAUGraphErr_CannotDoInCurrentContext (-10863) The error occurred…
Mando
  • 11,414
  • 17
  • 86
  • 167
27
votes
2 answers

Play musical notes in Swift Playground

I am trying to play a short musical note sequence with a default sine wave as sound inside a Swift Playground. At a later point I'd like to replace the sound with a Soundfont but at the moment I'd be happy with just producing some sound. I want…
Bernd
  • 11,133
  • 11
  • 65
  • 98
26
votes
3 answers

Extract meter levels from audio file

I need to extract audio meter levels from a file so I can render the levels before playing the audio. I know AVAudioPlayer can get this information while playing the audio file through func averagePower(forChannel channelNumber: Int) -> Float. But…
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193
23
votes
3 answers

How to generate audio wave form programmatically while recording Voice in iOS?

How to generate audio wave form programmatically while recording Voice in iOS? m working on voice modulation audio frequency in iOS... everything is working fine ...just need some best simple way to generate audio wave form on detection…
iVenky
  • 441
  • 1
  • 4
  • 14
20
votes
2 answers

Need to access the default camera shutter sound used by the iPhone

Right now when a user presses a button I play a custom camera shutter sound. However, if possible, I would much rather just use the camera shutter sound that plays by default whenever you take a photo using your iPhone. Is there a way that I can…
user3344977
  • 3,584
  • 4
  • 32
  • 88
17
votes
1 answer

Using AudioToolbox from Swift to access OS X master volume

Is there a solution to setting the system's master volume from within my Swift app? I read a lot about AudioToolbox and read some source examples in Objective-C. For example, I found this: Setting Mac OS X Volume Programatically after 10.6 But I…
Peter Shaw
  • 1,867
  • 1
  • 19
  • 32
16
votes
4 answers

Is there an event for when the headphones are unplugged?

During a test, a client noticed that video playback in the iPhone pauses when headphones are unplugged. He wanted similar functionality for audio playback, and maybe the ability to pop up a message. Does anyone know if there's an event of some kind…
Ben Clayton
  • 80,996
  • 26
  • 120
  • 129
12
votes
2 answers

Why does AudioServicesCreateSystemSoundID throw an exception internally but return 0 as an error code?

I’m running an iOS program in the 4.3.2, 5.0, and 5.1 Simulators, and I’m hitting a weird internal exception in AudioToolbox. I have a breakpoint set in Xcode (Xcode 4.3.1, running on 10.7.3) for all exceptions, and the debugger is breaking during a…
cbowns
  • 6,295
  • 5
  • 47
  • 64
12
votes
1 answer

Using AVFoundation / CoreMedia / Other Frameworks to Detect Beats / Onsets

(Preface: This is my first audio-related question on Stack Overflow, so I'll try to word this as best as I possibly can. Edits welcome.) I'm creating an application that'll allow users to loop music. At the moment our prototypes allow these "loop…
Bryan Veloso
  • 1,595
  • 18
  • 34
12
votes
6 answers

AudioServicesPlaySystemSound not playing sounds

I am playing a small .wav file using the AudioToolBox. AudioServicesPlaySystemSound (soundFileObject); But sometimes it is not playing. What is the reason?
Biranchi
  • 16,120
  • 23
  • 124
  • 161
10
votes
4 answers

Swift - AVPlayer load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled"

I try to play a video from url string. But I have get some error as question title. I try this code in below. videoPath is a url string. let videoURL = URL(string: videoPath) let player = AVPlayer(url: videoURL!) let…
Ali Ihsan URAL
  • 1,894
  • 1
  • 20
  • 43
10
votes
1 answer

iOS Swift playing audio (aac) from network stream

I'm developing an iOS application and I'm quite new to iOS development. So far I have implemented a h264 decoder from network stream using VideoToolbox, which was quite hard. Now I need to play an audio stream that comes from network, but with no…
Jorge
  • 540
  • 6
  • 21
10
votes
1 answer

AudioFileWriteBytes (AudioToolbox) fails with error code -38 kAudioFileNotOpenError

I'm working on the app that records user audio, writes data to file using AudioToolbox and processes these data. In analytics I see A LOT of errors that happen in AudioToolbox recording. Almost half of them is -38 kAudioFileNotOpenError error…
derpoliuk
  • 1,756
  • 2
  • 27
  • 43
10
votes
2 answers

Swift: Retrieve audio file marker list from url?

I just want to get a list of the markers in an audio file. I thought this would be an easy common task that wouldn't be too difficult. However, I can barely find any example code or documentation, so I ended up with this: private func getMarkers(_…
MysteryPancake
  • 1,365
  • 1
  • 18
  • 47
10
votes
2 answers

What are the system sound ids for the new keyboard clicks in iOS 10?

General I'm developing a third party keyboard and am currently trying to mimic the new keyboard clicks that Apple introduced in iOS 10b4. Current SituationThe regular click sound can be played using AudioServicesPlaySystemSound(1104) but I can't…
cyril
  • 3,020
  • 6
  • 36
  • 61
1
2 3
24 25