Comments (31)
That'd be weird. I thought I always let the device decide what to output...
On Tue, Aug 14, 2012 at 2:38 PM, Morgan Packard [email protected]:
Am I crazy? Has this always been the case and nobody noticed until now?
Novocaine is outputting audio in mono through headphones.
ioData->mBuffers[0].mNumberChannels is 1.If I figure out why, I'll make a note, and, with luck and a good attitude,
commit some code.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28.
from novocaine.
Just downloaded Novocaine fresh from github to make sure and am getting only one channel of TLC.
from novocaine.
What in the what
Goshdarnit
On Tue, Aug 14, 2012 at 2:59 PM, Morgan Packard [email protected]:
Just downloaded Novocaine fresh from github to make sure and am getting
only one channel of TLC.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-7736377.
from novocaine.
I'm not sure I trust the ASBD that the iPhone provides. After this bit:
// Check the input stream format
# if defined ( USING_IOS )
UInt32 size;
size = sizeof( AudioStreamBasicDescription );
CheckError( AudioUnitGetProperty( inputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
1,
&inputFormat,
&size ),
inputFormat.mNumberChannels is 2. I'd expect it to be 1.
from novocaine.
also after this bit:
CheckError(AudioUnitSetProperty(inputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
kInputBus,
&outputFormat,
size),
"Couldn't set the ASBD on the audio unit (after setting its sampling rate)");
inputFormat.mNumberChannels is 2. I tried explicitly setting the ASBD for kAudioUnitScope_Input, bus 0, which seems like it should control the number of channels in the render callback, but it had no effect. I also threw my phone out the window, and that didn't help either. I will toss my computer after it and see if that helps.
from novocaine.
Gosh diggity darn it
You getting stereo out of the iPod app?
On Tue, Aug 14, 2012 at 3:13 PM, Morgan Packard [email protected]:
also after this bit:
CheckError(AudioUnitSetProperty(inputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
kInputBus,
&outputFormat,
size),
"Couldn't set the ASBD on the audio unit (after setting its sampling rate)");inputFormat.mNumberChannels is 2. I tried explicitly setting the ASBD for
kAudioUnitScope_Input, bus 0, which seems like it should control the number
of channels in the render callback, but it had no effect. I also threw my
phone out the window, and that didn't help either. I will toss my computer
after it and see if that helps.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-7736826.
from novocaine.
Mono out of my phone running the demo ios app in the latest from github, stereo from simulator (running an older version of novocaine, but I suspect a newer would also be stereo).
My phone is working correctly. I'm getting audio in stereo from other apps.
from novocaine.
Aight. Gotta think about that.
On Tue, Aug 14, 2012 at 3:24 PM, Morgan Packard [email protected]:
Mono out of my phone running the demo ios app in the latest from github,
stereo from simulator (running an older version of novocaine, but I suspect
a newer would also be stereo).My phone is working correctly. I'm getting audio in stereo from other apps.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-7737150.
from novocaine.
I will do the same.
from novocaine.
Closing in on the problem (maybe). Looks like the render callback is expecting non-interleaved data. Does that square with your understanding Alex? I'm going to take a closer look and see if that could explain why the audio is coming through clean, but mono.
from novocaine.
Interesting. The render callback was designed to always ask for interleaved data, and then inside the machinery of Novocaine, everything gets massaged into exactly what the hardware expects, which can be any number of things (interleaved, non-interleaved, mono, stereo, SInt16 or float).
On Aug 15, 2012, at 9:29 AM, Morgan Packard wrote:
Closing in on the problem (maybe). Looks like the render callback is expecting non-interleaved data. Does that square with your understanding Alex? I'm going to take a closer look and see if that could explain why the audio is coming through clean, but mono.
—
Reply to this email directly or view it on GitHub.
from novocaine.
Ok, so my previous comment about knowing things are busted because ioData->mBuffers[0].mNumberChannels
is 1 may not indicate a problem. mNumberChannels
indicates the number of interleaved channels.
Next potential problem:
int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;
for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
vDSP_vsadd(sm.outData+iChannel, sm.numOutputChannels, &zero, (float *)ioData->mBuffers[iBuffer].mData, thisNumChannels, inNumberFrames);
}
Even if thisNumChannels was 2, the starting point on the destination buffer is ioData->mBuffers[iBuffer].mData on every iteration. Wouldn't successive iterations just overwrite data in the same place here? Based on what I"m seeing here and what I think I understand, I'd expect the audio to be either noise/glitch in the right channel, or maybe pitched 2x too fast, but I'm hearing clean audio, just the same in each channel.
EDIT
Nevermind. Bear with me while I de-stupid myself.
from novocaine.
Still keep ignoring me please.
from novocaine.
On it
On Wed, Aug 15, 2012 at 10:35 AM, Morgan Packard
[email protected]:
Still keep ignoring me please.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-7757402.
from novocaine.
Ok. Found the problem. Give me a cookie.
for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {
int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;
for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
vDSP_vsadd(sm.outData+iChannel, sm.numOutputChannels, &zero, (float *)ioData->mBuffers[iBuffer].mData, thisNumChannels, inNumberFrames);
}
}
With interleaved data, thisNumChannels
is 1 and ioData->mNumberBuffers
is 2. If the data is non-interleaved, we loop through the outer loop twice and the inner loop once. If it's interleaved, the opposite happens. Either way, for a stereo signal, vDSP_vsadd
gets called twice. We need to get the correct start point on sm.outData
. If thisNumChannels
is 2 and mNumberBuffers
is 1, this works fine, but if thisNumChannels
is 1 and mNumberBuffers
is 2, we start at the very first sample every time in sm.outData. Adding iBuffer
to the pointer offset in vDSP_vsadd
fixes the problem in my particular case. Don't know what it might break in other cases though.
vDSP_vsadd(sm.outData+iChannel+iBuffer, sm.numOutputChannels, &zero, (float *)ioData->mBuffers[iBuffer].mData, thisNumChannels, inNumberFrames);
from novocaine.
thanks morganpackard for saving lots of time 👍
from novocaine.
Reviving an old thread, but there still seems to be a problem with stereo non-interleaved output on iOS devices, at least with iPhone 4/iOS6.
The problem lies here:
for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {
int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;
for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
vDSP_vfix16(sm.outData+iChannel, sm.numOutputChannels, (SInt16 *)ioData->mBuffers[iBuffer].mData+iChannel, thisNumChannels, inNumberFrames);
}
}
For non-interleaved stereo output, there will be 2 mBuffers each with one channel of non-interleaved output. The existing code will loop through both of these, but copies the first (left) channel from the interleaved sm.outData
to each output channel, since iChannel
will never be larger than 0.
Fix is something like this:
if (sm.isInterleaved){
for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {
int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;
for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
vDSP_vsadd(sm.outData+iChannel, sm.numOutputChannels, &zero, (float *)ioData->mBuffers[iBuffer].mData, thisNumChannels, inNumberFrames);
}
}
}
else{
for (int iChannel = 0; iChannel < sm.numOutputChannels; iChannel++){
if (iChannel > ioData->mNumberBuffers) break; // this shouldn't happen
vDSP_vsadd(sm.outData+iChannel, sm.numOutputChannels, &zero, (float *)ioData->mBuffers[iChannel].mData, 1, inNumberFrames);
}
}
The break
statement is a safeguard but unless CoreAudio is reporting incorrect format info, it should never happen.
I have it working on another project (collab with @morganpackard actually). Happy to submit a pull request if this looks good.
from novocaine.
Or what morgan said 7 months ago also works...
from novocaine.
I would totally love a pull request. Nick and Morgan — you guys are some of
the most active users of Novocaine, do either of you want to be able to
contribute directly to the project?
My involvement has dipped significantly because of other obligations.
Would love to have some other devs onboard as contributors.
On Wed, Mar 20, 2013 at 7:41 PM, Nick D. [email protected] wrote:
Or what morgan said 7 months ago also works...
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-15211054
.
from novocaine.
I don't see why not. I'll be gentle, I promise.
-m-
On Wed, Mar 20, 2013 at 8:52 PM, Alex Wiltschko [email protected]:
I would totally love a pull request. Nick and Morgan — you guys are some
of
the most active users of Novocaine, do either of you want to be able to
contribute directly to the project?
My involvement has dipped significantly because of other obligations.
Would love to have some other devs onboard as contributors.On Wed, Mar 20, 2013 at 7:41 PM, Nick D. [email protected]
wrote:Or what morgan said 7 months ago also works...
—
Reply to this email directly or view it on GitHub<
https://github.com/alexbw/novocaine/issues/28#issuecomment-15211054>
.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-15213556
.
Morgan Packard
cell: (720) 891-0122
aim: mpackardatwork
twitter: @morganpackard
from novocaine.
Ok Morgan and Nick. You're contributors and stewards. Nick, we haven't met (I don't think...) but Morgan says you're a smarty pants and a half, so you're in too.
from novocaine.
Thanks Alex!
Sent from my iPhone
On Mar 24, 2013, at 6:23 PM, Alex Wiltschko [email protected]
wrote:
Ok Morgan and Nick. You're contributors and stewards. Nick, we haven't met
(I don't think...) but Morgan says you're a smarty pants and a half, so
you're in too.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/28#issuecomment-15370802
.
from novocaine.
I"m experiencing this same problem.
from novocaine.
Morgan, if you find the time, can you pull in your changes that fix this?
On Fri, Mar 29, 2013 at 12:17 PM, David Solberg [email protected]:
I"m experiencing this same problem.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-15648135
.
from novocaine.
Sorry, how can I unsubscribe from this list?
On Mar 29, 2013, at 12:18 PM, Alex Wiltschko [email protected] wrote:
Morgan, if you find the time, can you pull in your changes that fix this?
On Fri, Mar 29, 2013 at 12:17 PM, David Solberg [email protected]:
I"m experiencing this same problem.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-15648135
.—
Reply to this email directly or view it on GitHub.
Hans Tutschku
www.tutschku.com
from novocaine.
FYI, either suggested fix worked for me on an iPad with iOS 6 using a .m4a file.
from novocaine.
Will do.
On Fri, Mar 29, 2013 at 12:18 PM, Alex Wiltschko
[email protected]:
Morgan, if you find the time, can you pull in your changes that fix this?
On Fri, Mar 29, 2013 at 12:17 PM, David Solberg [email protected]:
I"m experiencing this same problem.
—
Reply to this email directly or view it on GitHub<
https://github.com/alexbw/novocaine/issues/28#issuecomment-15648135>
.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-15648204
.
Morgan Packard
cell: (720) 891-0122
aim: mpackardatwork
twitter: @morganpackard
from novocaine.
Is this pulled in yet?
from novocaine.
@morganpackard Is this a dead issue?
from novocaine.
I think so.
Sent from my iPhone
On Nov 14, 2013, at 11:36 PM, Alex Wiltschko [email protected]
wrote:
@morganpackard https://github.com/morganpackard Is this a dead issue?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/28#issuecomment-28546840
.
from novocaine.
Hi,
Am novocain addicted new ios developer. Am using novocain in an ios project. App is recording 2 channel audio. Client records audio with a sensor device. That sensor also can work as receiver. Client's requirement is to send a tone to sensor not speaker while recording from sensor. Please help me how to send tone to sensor.
from novocaine.
Related Issues (20)
- Audio distortion isuue while playing on iphone speaker HOT 1
- 1
- use of @autoreleasepool in renderCallback and inputCallback HOT 1
- inputblock + outputblock + forceOutputToSpeaker = Error: Couldn't render the output unit (-50) HOT 1
- Can't play an audio file that was downloaded from server but the data is the same HOT 1
- Music from the Internet HOT 1
- What exactly comes from the newAudio variable?
- Bluetooth Audio? HOT 3
- updateMeters and averagePowerForChannel equivalents for Novocaine? HOT 2
- Setting deployment target to 8.0 causes demo app to crash HOT 2
- Is there anyway to properly convert the audio array (float*) into UTF 8? HOT 7
- m4a files
- Gapless
- RingBuffer.h - class RingBuffer syntax error HOT 3
- Use of deprecated AudioSession APIs on Novocaine.m HOT 2
- How to 8000hz/16000hz get or put as short* array for audio ?
- Is this library suitable to make a lack-in amplifier from microphone input?
- Couldn't initialize the output unit ('!cat') on Device only HOT 1
- Mac Catalyst (UIKit for Mac) support
- Does default sample rate cause resampling and setting buffer size for minimum latency? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from novocaine.