AudioToolbox

RSS for tag

Record or play audio convert formats parse audio streams and configure your audio session using AudioToolbox.

Posts under AudioToolbox tag

136 Posts

Post

Replies

Boosts

Views

Activity

Low level audio recording on macOS. Please Help!
I am struggling to see why the following low-level audio recording function - which is based on tn2091 - Device input using the HAL Output Audio Unit - (a great article, btw, although a bit dated, and it would be wonderful if it was updated to use Swift and non deprecated stuff at some point!) fails to work under macOS: func createMicUnit() -> AUAudioUnit { let compDesc = AudioComponentDescription( componentType: kAudioUnitType_Output, componentSubType: kAudioUnitSubType_HALOutput, // I am on macOS, os this is good componentManufacturer: kAudioUnitManufacturer_Apple, componentFlags: 0, componentFlagsMask: 0) return try! AUAudioUnit(componentDescription: compDesc, options: []) } func startMic() { // mic permision is already granted at this point, but let's check let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.audio) precondition(status == .authorized) // yes, all good let unit = createMicUnit() unit.isInputEnabled = true unit.isOutputEnabled = false precondition(!unit.canPerformInput) // can't record yet, and know why? print(deviceName(unit.deviceID)) // "MacBook Pro Speakers" - this is why let micDeviceID = defaultInputDeviceID print(deviceName(micDeviceID)) // "MacBook Pro Microphone" - this is better try! unit.setDeviceID(micDeviceID) // let's switch device to mic precondition(unit.canPerformInput) // now we can record print("\(String(describing: unit.channelMap))") // channel map is "nil" by default unit.channelMap = [0] // not sure if this helps or not let sampleRate = deviceActualFrameRate(micDeviceID) print(sampleRate) // 48000.0 let format = AVAudioFormat( commonFormat: .pcmFormatFloat32, sampleRate: sampleRate, channels: 1, interleaved: false)! try! unit.outputBusses[1].setFormat(format) unit.inputHandler = { flags, timeStamp, frameCount, bus in fatalError("never gets here") // now the weird part - this is never called! } try! unit.allocateRenderResources() try! unit.startHardware() // let's go! print("mic should be working now... why it doesn't?") // from now on the (UI) app continues its normal run loop } All sanity checks pass with flying colors but unit's inputHandler is not being called. Any idea why? Thank you!
3
0
2.2k
Jan ’23
MIDI file generated by using MusicSequenceFileCreate has Sysex MIDI message (iOS 16.0.2)
I am using the MusicSequenceFileCreate method to generate a MIDI file from a beat-based MusicSequence. In iOS 16.0.2 devices, the file that is created has a Sysex MIDI message added (not by me) to the file at time 0: f0 2a 11 67 40 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 f7 Sysex messages are manufacturer dependent, a file with this Sysex message can't be read into apps like Nanostudio, Ableton, Zenbeats. It can be read by GarageBand. My app's deployment target is iOS 13.0. Has anybody else ran into this issue? Thanks
1
0
1.3k
Oct ’22
Sound decibel recognition
Hi Community Members, We tried to find the particular sound through the microphone. We used PKCCheck to detect the sound decibel. we detect the sound based on the number of dB values per second we receive and add some logic over it to get the result, but when we have continuous sound like an alarm we can't detect it as the gap between the sound is very less. Any suggestion on libraries to achieve this. Also whether we can achieve this thru Frequency & Amplitude method. Please advise.
0
0
1.2k
Oct ’22
Microphone is disabled when trying to record (using getUserMedia)
I built a simple recorder on my website for users to record and playback audio. It works on ALL desktop browsers (including Safari) but when I use any browser on my iPhone, the mic is active at the opposite time. The flow is: ask permission > user allows mic access > user presses record > records audio > saves and plays back On iPhone what's happening is after the user allows permission, the mic goes active (visualized by the mic icon in safari browser) and then once the user presses record, it disables the mic. I am using getUserMedia within a React.js app Why is it doing this?
1
0
1.6k
Sep ’22
AudioUnit: AUParameterEvent vs AUParameterTree implementorValueObserver
Hello, I'm trying to write my own audio unit extension and I have a problem. I don't understand the difference between implementorValueObserver and AUParameterEvent. It looks like both of them can be used to update parameters in DSPKernel. It seems natural to use an observer, but it requires to think about thread safety in contrast to AUParameterEvent handling. Can someone comment on this or give me more context about this two entities?
0
0
816
Aug ’22
How set CBR in AVAudioConverter?
I am using AVAudioConverter in Objective C. AVAudioConverter has bitRate and bitRateStrategy parameters defined. The default bitRateStrategy value is AVAudioBitRateStrategy_LongTermAverage. If I set bitRateStrategy to AVAudioBitRateStrategy_Constant there is no change. The bitRate variable works correctly. AVAudioConverter *audioConverter = [[AVAudioConverter alloc] initFromFormat:inputFormat toFormat:outputFormat]; audioConverter.bitRate = 128000; audioConverter.bitRateStrategy = AVAudioBitRateStrategy_Constant;
0
0
989
Aug ’22
Why is internalRenderBlock fetched and used before allocateRenderResources() is called?
I have a working AUv3 AUAudioUnit app extension but I had to work around a strange issue: I found that the internalRenderBlock value is fetched and invoked before allocateRenderResources() is called. I have not found any documentation stating that this would be the case, and intuitively it does not make any sense. Is there something I am doing in my code that would be causing this to be the case? Should I *force* a call to allocateRenderResources() if it has not been called before internalRenderBlock is fetched? Thanks! Brad
6
1
2.9k
Jul ’22
Physical 16.0 iPhone XS does not show among Xcode targets
I am trying to compile on my iPhone XS device an app on Xcode Version 14.0 beta 2. First time I connected the device it correctly showed among the devices urging me to enable Developer Modality on Privacy & Security. I did it and the iPhone restarted, but once it happened the iPhone disappeared from the targets, thus not allowing me to compile on it. For some strange reason my iPad instead showed, but when I tried to compile on it, Xcode of course urged me to connect it. So it seems Xcode sees not connected device and does not see connected devices. Is anyone able to give a sense to that and possibly a solution?
0
0
955
Jul ’22
The AudioUnit user presets system has ceased to work as expected in iPadOS 14
The AUAudioUnit in my app uses the user presets system that was introduced with iPadOS/iOS 13. The user presets system worked well in iPadOS 13, and it worked in at least one of the pre-release beta versions of iPadOS 14. However, it has not worked since iPadOS 14.0 was released. The problem is (superficially, at least) that: saveUserPreset no longer writes preset files to the app's Documents folder, but the method doesn't fail either. The userPresets array, which typically contains the presets that were deserialised from the files stored in the Documents folder, is invariably empty. The presets that the array would contain prior to upgrading from iPadOS 13 are no longer accessible. In other words, prior to upgrading to iPadOS 14, my app could save user presets using the saveUserPreset method and subsequently access their contents from the userPresets array. Since upgrading to iPadOS 14, the userPresets array is invariably empty and the saveUserPreset method no longer saves presets to the Documents folder. Has anyone else experienced this problem?
1
0
1.3k
Jun ’22
AudioObjectSetPropertyData with bluetooth devices on macOS Monterey (12.0.1)
In previous versions of macOS (Catalina & Big Sur) I used the following code in my app to mute the system Input device (assuming a good inputDeviceId): let inputDeviceId = input.id var address = AudioObjectPropertyAddress( mSelector: AudioObjectPropertySelector(kAudioDevicePropertyMute), mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeInput), mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) let size = UInt32(MemoryLayout<UInt32>.size) var mute: UInt32 = muted ? 1 : 0 AudioObjectSetPropertyData(inputDeviceId, &address, 0, nil, size, &mute) This worked great in both previous operating systems across all input devices I tested. However, in macOS 12.0.1 this no longer works specifically for bluetooth devices. And, beyond that, it instead mutes the Output volume of these bluetooth devices. On the system microphone or via a line-in, this still works as expected. I'm trying to determined what changed in Monterey that caused bluetooth devices to start behaving the opposite as they were before with respect to this API? Is there a new recommended approach for muting microphone input from Bluetooth devices? Any help, guidance, or context here is appreciated.
5
2
3.3k
Jun ’22
AUParameterNode defaultValue ??
We're seeing the following when running auvaltool It seems AUParameterNode cannot be constructed with a default value and has no option to set default values via property or method so what does this mean? .... Does it mean we ALSO have to iterate all the parameters using the old fashioned long winded toolbox calls ? Or does it mean nothing at all? The "Will fail in future auval version" is worrying! Values: Minimum = 5.000000, Default = 0.000000, Maximum = 300.000000 Flags: Expert Mode, Readable,  WARNING: use -strict_DefP flag * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Parameter's Published defaultvalue does not fall with [min, max] range  * * This will fail using -strict option. Will fail in future auval version  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   -parameter PASS
2
0
2k
May ’22
Caching the view for an out-of-process audio unit
I'm writing a macOS audio unit hosting app using the AVAudioUnit and AUAudioUnit APIs. I'm trying to use the NSView cacheDisplay(in:to:) function to capture an image of a plugin's view: func viewToImage(veiwToCapture: NSView) -> NSImage? {     var image: NSImage? = nil     if let rep = veiwToCapture.bitmapImageRepForCachingDisplay(in: veiwToCapture.bounds) {       veiwToCapture.cacheDisplay(in: veiwToCapture.bounds, to: rep)       image = NSImage(size: veiwToCapture.bounds.size)       image!.addRepresentation(rep)     }     return image   } } This works ok when a plugin is instantiated using the .loadInProcess option. If the plugin is instantiated using the .loadOutOfProcess option the resulting bitmapImageRep is blank. I'd much rather be loading plugins out-of-process for the enhanced stability. Is there any trick I'm missing to be able to capture the contents of the NSView from an out-of-process audio unit?
1
0
1.3k
Apr ’22
Developing a call recorder app for ptivate use
Hello, Is there any way to create a call recording app without distributing it to the app store? And just use it as a beta local app on my iphone only? If there is a way to do it, can you briefly explain how can i do it? Because all of the app store recording apps store my calls on their server and i dont want that, i just want to save my calls locally on my iphone. Thanks!
0
0
1.5k
Apr ’22
How to use CoreAudio
MacOS CoreAudio buffer playback produces annoying noise between correct sound. I'm interested to play valid .wav data though the buffer. Why I'm playing a .wav? It has valid data. What I'm trying to achieve is to understand how to write correctly to the sound buffer. I'm porting a music engine to MacOS .... #include <string.h> #include <math.h> #include <unistd.h> #include <stdio.h> #include <AudioToolbox/AudioToolbox.h> FILE *fp; typedef struct TwavHeader{ char RIFF[4]; uint32_t RIFFChunkSize; char WAVE[4]; char fmt[4]; uint32_t Subchunk1Size; uint16_t AudioFormat; uint16_t NumOfChan; uint32_t SamplesPerSec; uint32_t bytesPerSec; uint16_t blockAlign; uint16_t bitsPerSample; char Subchunk2ID[4]; uint32_t Subchunk2Size; }TwavHeader; typedef struct SoundState { bool done; }SoundState; void auCallback(void *inUserData, AudioQueueRef queue, AudioQueueBufferRef buffer) { buffer->mAudioDataByteSize = 1024*4; int numToRead = buffer->mAudioDataByteSize / sizeof(float) * 2; void *p = malloc(numToRead); fread(p, numToRead,1,fp); void *myBuf = buffer->mAudioData; for (int i=0; i < numToRead / 2; i++) { uint16_t w = *(uint16_t *)&(p[i*sizeof(uint16_t)]); float f = ((float)w / (float)0x8000) - 1.0; *(float *)&(myBuf[i*sizeof(float)]) = f; } free(p); AudioQueueEnqueueBuffer(queue, buffer, 0, 0); } void checkError(OSStatus error){ if (error != noErr) { printf("Error: %d", error); exit(error); } } int main(int argc, const char * argv[]) { printf("START\n"); TwavHeader theHeader; fp = fopen("/Users/kirillkranz/Documents/mytralala-code/CoreAudioTest/unreal.wav", "r"); fread(&theHeader, sizeof(TwavHeader),1,fp); printf("%i\n",theHeader.bitsPerSample); AudioStreamBasicDescription auDesc = {}; auDesc.mSampleRate = theHeader.SamplesPerSec; auDesc.mFormatID = kAudioFormatLinearPCM; auDesc.mFormatFlags = kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsPacked; auDesc.mBytesPerPacket = 8; auDesc.mFramesPerPacket = 1; auDesc.mBytesPerFrame = 8; auDesc.mChannelsPerFrame = 2; auDesc.mBitsPerChannel = 32; AudioQueueRef auQueue = 0; AudioQueueBufferRef auBuffers[2] ={}; // our persistent state for sound playback SoundState soundState= {}; soundState.done=false; OSStatus err; // most of the 0 and nullptr params here are for compressed sound formats etc. err = AudioQueueNewOutput(&auDesc, &auCallback, &soundState, 0, 0, 0, &auQueue); checkError(err); // generate buffers holding at most 1/16th of a second of data uint32_t bufferSize = auDesc.mBytesPerFrame * (auDesc.mSampleRate / 16); err = AudioQueueAllocateBuffer(auQueue, bufferSize, &(auBuffers[0])); checkError(err); err = AudioQueueAllocateBuffer(auQueue, bufferSize, &(auBuffers[1])); checkError(err); // prime the buffers auCallback(&soundState, auQueue, auBuffers[0]); auCallback(&soundState, auQueue, auBuffers[1]); // enqueue for playing AudioQueueEnqueueBuffer(auQueue, auBuffers[0], 0, 0); AudioQueueEnqueueBuffer(auQueue, auBuffers[1], 0, 0); // go! AudioQueueStart(auQueue, 0); char rxChar[10]; scanf( "%s", &rxChar); printf("FINISH"); fclose(fp); // be nice even it doesn't really matter at this point if (auQueue) AudioQueueDispose(auQueue, true); } what do I do wrong?
0
0
1.7k
Apr ’22
Low level audio recording on macOS. Please Help!
I am struggling to see why the following low-level audio recording function - which is based on tn2091 - Device input using the HAL Output Audio Unit - (a great article, btw, although a bit dated, and it would be wonderful if it was updated to use Swift and non deprecated stuff at some point!) fails to work under macOS: func createMicUnit() -> AUAudioUnit { let compDesc = AudioComponentDescription( componentType: kAudioUnitType_Output, componentSubType: kAudioUnitSubType_HALOutput, // I am on macOS, os this is good componentManufacturer: kAudioUnitManufacturer_Apple, componentFlags: 0, componentFlagsMask: 0) return try! AUAudioUnit(componentDescription: compDesc, options: []) } func startMic() { // mic permision is already granted at this point, but let's check let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.audio) precondition(status == .authorized) // yes, all good let unit = createMicUnit() unit.isInputEnabled = true unit.isOutputEnabled = false precondition(!unit.canPerformInput) // can't record yet, and know why? print(deviceName(unit.deviceID)) // "MacBook Pro Speakers" - this is why let micDeviceID = defaultInputDeviceID print(deviceName(micDeviceID)) // "MacBook Pro Microphone" - this is better try! unit.setDeviceID(micDeviceID) // let's switch device to mic precondition(unit.canPerformInput) // now we can record print("\(String(describing: unit.channelMap))") // channel map is "nil" by default unit.channelMap = [0] // not sure if this helps or not let sampleRate = deviceActualFrameRate(micDeviceID) print(sampleRate) // 48000.0 let format = AVAudioFormat( commonFormat: .pcmFormatFloat32, sampleRate: sampleRate, channels: 1, interleaved: false)! try! unit.outputBusses[1].setFormat(format) unit.inputHandler = { flags, timeStamp, frameCount, bus in fatalError("never gets here") // now the weird part - this is never called! } try! unit.allocateRenderResources() try! unit.startHardware() // let's go! print("mic should be working now... why it doesn't?") // from now on the (UI) app continues its normal run loop } All sanity checks pass with flying colors but unit's inputHandler is not being called. Any idea why? Thank you!
Replies
3
Boosts
0
Views
2.2k
Activity
Jan ’23
Getting audio from another application directly
I've seen applications such as Dante Via (Audinate) and Loopback (Rogue Amoeba) that can capture audio from an application directly. Which framework is used to achieve this? So far all I've seen is ways to tap in to audio devices with AUs.
Replies
1
Boosts
0
Views
1.6k
Activity
Dec ’22
API call to detect silent mode status
Does anyone know of an iOS API call that would return the status of silent mode?
Replies
0
Boosts
0
Views
1.1k
Activity
Oct ’22
MIDI file generated by using MusicSequenceFileCreate has Sysex MIDI message (iOS 16.0.2)
I am using the MusicSequenceFileCreate method to generate a MIDI file from a beat-based MusicSequence. In iOS 16.0.2 devices, the file that is created has a Sysex MIDI message added (not by me) to the file at time 0: f0 2a 11 67 40 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 f7 Sysex messages are manufacturer dependent, a file with this Sysex message can't be read into apps like Nanostudio, Ableton, Zenbeats. It can be read by GarageBand. My app's deployment target is iOS 13.0. Has anybody else ran into this issue? Thanks
Replies
1
Boosts
0
Views
1.3k
Activity
Oct ’22
Sound decibel recognition
Hi Community Members, We tried to find the particular sound through the microphone. We used PKCCheck to detect the sound decibel. we detect the sound based on the number of dB values per second we receive and add some logic over it to get the result, but when we have continuous sound like an alarm we can't detect it as the gap between the sound is very less. Any suggestion on libraries to achieve this. Also whether we can achieve this thru Frequency & Amplitude method. Please advise.
Replies
0
Boosts
0
Views
1.2k
Activity
Oct ’22
Microphone is disabled when trying to record (using getUserMedia)
I built a simple recorder on my website for users to record and playback audio. It works on ALL desktop browsers (including Safari) but when I use any browser on my iPhone, the mic is active at the opposite time. The flow is: ask permission > user allows mic access > user presses record > records audio > saves and plays back On iPhone what's happening is after the user allows permission, the mic goes active (visualized by the mic icon in safari browser) and then once the user presses record, it disables the mic. I am using getUserMedia within a React.js app Why is it doing this?
Replies
1
Boosts
0
Views
1.6k
Activity
Sep ’22
ios15.x AVMIDIPlayer can't play midi file which use ios16.x create
when we use AVMIDIPlayer play midi file, it throw a exception: The operation couldn’t be completed. (com.apple.coreaudio.avfaudio error -3.) and i find midi file's structure create at ios15.x is different with ios16.x
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’22
AudioUnit: AUParameterEvent vs AUParameterTree implementorValueObserver
Hello, I'm trying to write my own audio unit extension and I have a problem. I don't understand the difference between implementorValueObserver and AUParameterEvent. It looks like both of them can be used to update parameters in DSPKernel. It seems natural to use an observer, but it requires to think about thread safety in contrast to AUParameterEvent handling. Can someone comment on this or give me more context about this two entities?
Replies
0
Boosts
0
Views
816
Activity
Aug ’22
How set CBR in AVAudioConverter?
I am using AVAudioConverter in Objective C. AVAudioConverter has bitRate and bitRateStrategy parameters defined. The default bitRateStrategy value is AVAudioBitRateStrategy_LongTermAverage. If I set bitRateStrategy to AVAudioBitRateStrategy_Constant there is no change. The bitRate variable works correctly. AVAudioConverter *audioConverter = [[AVAudioConverter alloc] initFromFormat:inputFormat toFormat:outputFormat]; audioConverter.bitRate = 128000; audioConverter.bitRateStrategy = AVAudioBitRateStrategy_Constant;
Replies
0
Boosts
0
Views
989
Activity
Aug ’22
Why is internalRenderBlock fetched and used before allocateRenderResources() is called?
I have a working AUv3 AUAudioUnit app extension but I had to work around a strange issue: I found that the internalRenderBlock value is fetched and invoked before allocateRenderResources() is called. I have not found any documentation stating that this would be the case, and intuitively it does not make any sense. Is there something I am doing in my code that would be causing this to be the case? Should I *force* a call to allocateRenderResources() if it has not been called before internalRenderBlock is fetched? Thanks! Brad
Replies
6
Boosts
1
Views
2.9k
Activity
Jul ’22
iMessage and sounds
The possibility of sending predefined sounds and being able to associate them with images should be implemented in iMessage. For example, the iconic sound of netflix.
Replies
0
Boosts
0
Views
885
Activity
Jul ’22
Inserting Audio Files into Comments in MS Word for Mac
I am working on a function that inserts audio files into comments in MS Word for Mac. I can insert MS Word, MS Excel, and picture files, but not audio files. It was also a problem for MS Word in Windows 11, but Microsoft eventually fixed it.
Replies
0
Boosts
0
Views
838
Activity
Jul ’22
Physical 16.0 iPhone XS does not show among Xcode targets
I am trying to compile on my iPhone XS device an app on Xcode Version 14.0 beta 2. First time I connected the device it correctly showed among the devices urging me to enable Developer Modality on Privacy & Security. I did it and the iPhone restarted, but once it happened the iPhone disappeared from the targets, thus not allowing me to compile on it. For some strange reason my iPad instead showed, but when I tried to compile on it, Xcode of course urged me to connect it. So it seems Xcode sees not connected device and does not see connected devices. Is anyone able to give a sense to that and possibly a solution?
Replies
0
Boosts
0
Views
955
Activity
Jul ’22
The AudioUnit user presets system has ceased to work as expected in iPadOS 14
The AUAudioUnit in my app uses the user presets system that was introduced with iPadOS/iOS 13. The user presets system worked well in iPadOS 13, and it worked in at least one of the pre-release beta versions of iPadOS 14. However, it has not worked since iPadOS 14.0 was released. The problem is (superficially, at least) that: saveUserPreset no longer writes preset files to the app's Documents folder, but the method doesn't fail either. The userPresets array, which typically contains the presets that were deserialised from the files stored in the Documents folder, is invariably empty. The presets that the array would contain prior to upgrading from iPadOS 13 are no longer accessible. In other words, prior to upgrading to iPadOS 14, my app could save user presets using the saveUserPreset method and subsequently access their contents from the userPresets array. Since upgrading to iPadOS 14, the userPresets array is invariably empty and the saveUserPreset method no longer saves presets to the Documents folder. Has anyone else experienced this problem?
Replies
1
Boosts
0
Views
1.3k
Activity
Jun ’22
AudioObjectSetPropertyData with bluetooth devices on macOS Monterey (12.0.1)
In previous versions of macOS (Catalina & Big Sur) I used the following code in my app to mute the system Input device (assuming a good inputDeviceId): let inputDeviceId = input.id var address = AudioObjectPropertyAddress( mSelector: AudioObjectPropertySelector(kAudioDevicePropertyMute), mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeInput), mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) let size = UInt32(MemoryLayout<UInt32>.size) var mute: UInt32 = muted ? 1 : 0 AudioObjectSetPropertyData(inputDeviceId, &address, 0, nil, size, &mute) This worked great in both previous operating systems across all input devices I tested. However, in macOS 12.0.1 this no longer works specifically for bluetooth devices. And, beyond that, it instead mutes the Output volume of these bluetooth devices. On the system microphone or via a line-in, this still works as expected. I'm trying to determined what changed in Monterey that caused bluetooth devices to start behaving the opposite as they were before with respect to this API? Is there a new recommended approach for muting microphone input from Bluetooth devices? Any help, guidance, or context here is appreciated.
Replies
5
Boosts
2
Views
3.3k
Activity
Jun ’22
AUParameterNode defaultValue ??
We're seeing the following when running auvaltool It seems AUParameterNode cannot be constructed with a default value and has no option to set default values via property or method so what does this mean? .... Does it mean we ALSO have to iterate all the parameters using the old fashioned long winded toolbox calls ? Or does it mean nothing at all? The "Will fail in future auval version" is worrying! Values: Minimum = 5.000000, Default = 0.000000, Maximum = 300.000000 Flags: Expert Mode, Readable,  WARNING: use -strict_DefP flag * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Parameter's Published defaultvalue does not fall with [min, max] range  * * This will fail using -strict option. Will fail in future auval version  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   -parameter PASS
Replies
2
Boosts
0
Views
2k
Activity
May ’22
Instance count for same AUv3 component in app
Curious if there is a sound way for an AUv3 component to identify how many other instances of it that are running on a device. For instance, if GarageBand has 4 tracks and all of the tracks use the same AUv3 component, is there a sound way for each one to obtain a unique index value? Thanks!
Replies
1
Boosts
0
Views
2.1k
Activity
May ’22
Caching the view for an out-of-process audio unit
I'm writing a macOS audio unit hosting app using the AVAudioUnit and AUAudioUnit APIs. I'm trying to use the NSView cacheDisplay(in:to:) function to capture an image of a plugin's view: func viewToImage(veiwToCapture: NSView) -> NSImage? {     var image: NSImage? = nil     if let rep = veiwToCapture.bitmapImageRepForCachingDisplay(in: veiwToCapture.bounds) {       veiwToCapture.cacheDisplay(in: veiwToCapture.bounds, to: rep)       image = NSImage(size: veiwToCapture.bounds.size)       image!.addRepresentation(rep)     }     return image   } } This works ok when a plugin is instantiated using the .loadInProcess option. If the plugin is instantiated using the .loadOutOfProcess option the resulting bitmapImageRep is blank. I'd much rather be loading plugins out-of-process for the enhanced stability. Is there any trick I'm missing to be able to capture the contents of the NSView from an out-of-process audio unit?
Replies
1
Boosts
0
Views
1.3k
Activity
Apr ’22
Developing a call recorder app for ptivate use
Hello, Is there any way to create a call recording app without distributing it to the app store? And just use it as a beta local app on my iphone only? If there is a way to do it, can you briefly explain how can i do it? Because all of the app store recording apps store my calls on their server and i dont want that, i just want to save my calls locally on my iphone. Thanks!
Replies
0
Boosts
0
Views
1.5k
Activity
Apr ’22
How to use CoreAudio
MacOS CoreAudio buffer playback produces annoying noise between correct sound. I'm interested to play valid .wav data though the buffer. Why I'm playing a .wav? It has valid data. What I'm trying to achieve is to understand how to write correctly to the sound buffer. I'm porting a music engine to MacOS .... #include <string.h> #include <math.h> #include <unistd.h> #include <stdio.h> #include <AudioToolbox/AudioToolbox.h> FILE *fp; typedef struct TwavHeader{ char RIFF[4]; uint32_t RIFFChunkSize; char WAVE[4]; char fmt[4]; uint32_t Subchunk1Size; uint16_t AudioFormat; uint16_t NumOfChan; uint32_t SamplesPerSec; uint32_t bytesPerSec; uint16_t blockAlign; uint16_t bitsPerSample; char Subchunk2ID[4]; uint32_t Subchunk2Size; }TwavHeader; typedef struct SoundState { bool done; }SoundState; void auCallback(void *inUserData, AudioQueueRef queue, AudioQueueBufferRef buffer) { buffer->mAudioDataByteSize = 1024*4; int numToRead = buffer->mAudioDataByteSize / sizeof(float) * 2; void *p = malloc(numToRead); fread(p, numToRead,1,fp); void *myBuf = buffer->mAudioData; for (int i=0; i < numToRead / 2; i++) { uint16_t w = *(uint16_t *)&(p[i*sizeof(uint16_t)]); float f = ((float)w / (float)0x8000) - 1.0; *(float *)&(myBuf[i*sizeof(float)]) = f; } free(p); AudioQueueEnqueueBuffer(queue, buffer, 0, 0); } void checkError(OSStatus error){ if (error != noErr) { printf("Error: %d", error); exit(error); } } int main(int argc, const char * argv[]) { printf("START\n"); TwavHeader theHeader; fp = fopen("/Users/kirillkranz/Documents/mytralala-code/CoreAudioTest/unreal.wav", "r"); fread(&theHeader, sizeof(TwavHeader),1,fp); printf("%i\n",theHeader.bitsPerSample); AudioStreamBasicDescription auDesc = {}; auDesc.mSampleRate = theHeader.SamplesPerSec; auDesc.mFormatID = kAudioFormatLinearPCM; auDesc.mFormatFlags = kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsPacked; auDesc.mBytesPerPacket = 8; auDesc.mFramesPerPacket = 1; auDesc.mBytesPerFrame = 8; auDesc.mChannelsPerFrame = 2; auDesc.mBitsPerChannel = 32; AudioQueueRef auQueue = 0; AudioQueueBufferRef auBuffers[2] ={}; // our persistent state for sound playback SoundState soundState= {}; soundState.done=false; OSStatus err; // most of the 0 and nullptr params here are for compressed sound formats etc. err = AudioQueueNewOutput(&auDesc, &auCallback, &soundState, 0, 0, 0, &auQueue); checkError(err); // generate buffers holding at most 1/16th of a second of data uint32_t bufferSize = auDesc.mBytesPerFrame * (auDesc.mSampleRate / 16); err = AudioQueueAllocateBuffer(auQueue, bufferSize, &(auBuffers[0])); checkError(err); err = AudioQueueAllocateBuffer(auQueue, bufferSize, &(auBuffers[1])); checkError(err); // prime the buffers auCallback(&soundState, auQueue, auBuffers[0]); auCallback(&soundState, auQueue, auBuffers[1]); // enqueue for playing AudioQueueEnqueueBuffer(auQueue, auBuffers[0], 0, 0); AudioQueueEnqueueBuffer(auQueue, auBuffers[1], 0, 0); // go! AudioQueueStart(auQueue, 0); char rxChar[10]; scanf( "%s", &rxChar); printf("FINISH"); fclose(fp); // be nice even it doesn't really matter at this point if (auQueue) AudioQueueDispose(auQueue, true); } what do I do wrong?
Replies
0
Boosts
0
Views
1.7k
Activity
Apr ’22