Re: More than 1 bus in a Node creating distorded audio?
Re: More than 1 bus in a Node creating distorded audio?
- Subject: Re: More than 1 bus in a Node creating distorded audio?
- From: Patrick Muringer <email@hidden>
- Date: Wed, 25 Aug 2010 20:32:14 +0200
- Thread-topic: More than 1 bus in a Node creating distorded audio?
Bill,
Thanks for the reply. In fact, my first attempt was with the use of the
AVAudioPlayer. Since I'd like to write a sequencer app, I need to have
accurate timing. I did not have enough good result with those High level
API. That's why I use the AudioUnit and graph.
Pat
On 8/25/10 7:38 PM, "William Stewart" <email@hidden> wrote:
>it maybe the same, but you haven't checked that the mixer thinks they are
>the same. So, you need to check the format of each of the buses.
>
>But, maybe there is a more fundamental question to ask - can you use
>audio queues or even AVAudioPlayers to do what you are doing? Why do you
>think you need to use the mixer directly? (Just as an FYI, both audio
>queue and AVAudioPlayer use these same services in their implementation,
>but you have a higher level API to do this (with no difference to the
>fidelity of the audio being played))
>
>Bill
>
>On Aug 25, 2010, at 8:36 AM, Patrick Muringer wrote:
>
>> Sound is not distorded but clipped (only for the busses 2
>> and on) and exit only on the left (from busses 2 and on)
>>
>> the strange thing is that bus 0 and 1 play correctly.
>>
>> The code for each bus is the same.
>>
>> Patrick
>>
>> ----- Original Message -----
>> Da : Gregory Wieber <email@hidden>
>> A : Patrick Muringer <email@hidden>,
>> email@hidden
>> Oggetto : Re: More than 1 bus in a Node creating distorded
>> audio?
>> Data : Wed, 25 Aug 2010 08:29:16 -0700
>>
>>> I agree with Bill -- particular if the distortion sounds
>>> like a 'bit reduced' kind of distortion (like the
>>> 'bitcrusher' distortion plugin for logic) then it's
>>> probably an ASBD format issue. Also, keep in mind that
>>> you need to keep your levels from clipping, and since the
>>> mixer is additive,
>>> multiple busses can result in clipping.
>>>
>>> On Tue, Aug 24, 2010 at 6:04 PM, William Stewart
>>> <email@hidden> wrote:
>>>
>>>>
>>>> On Aug 23, 2010, at 11:55 PM, Patrick Muringer wrote:
>>>>
>>>>> Thanks Bill for your reply,
>>>>>
>>>>> You are right, my writing was not clear enough.
>>>>>
>>>>> I add the callbacks for each bus manually:
>>>>> AUGraphSetNodeInputCallback(graph, MixerNode, 0,
>>>>> &callback); .
>>>>> .
>>>>> .
>>>>> AUGraphSetNodeInputCallback(graph, MixerNode, N,
>>>>> &callback); should I use the loop instead?
>>>>
>>>> no difference
>>>>
>>>> But you should make sure that the formats are what you
>>>> expect on each and every bus.
>>>>
>>>> I would guess (from the code below) that you are
>>>> expecting all of the buses to be mono, but some are
>>> stereo. >
>>>>
>>>>>
>>>>> In the call back, I have a series of IF statements for
>>>>> each bus number were I either fill with data or with
>>>> 0: >
>>>>> if(inBusNumber == 0) {
>>>>> if(input.isPlayingTrack1) {
>>>>> [input fillBufferWithSampleForBus0:inNumberFrames
>>>>> :frameBuffer]; }
>>>>> else {
>>>>> [input fillBufferWith0:inNumberFrames :frameBuffer];
>>>>> }
>>>>> }
>>>>> .
>>>>> .
>>>>> if(inBusNumber == N) {
>>>>> ...
>>>>> }
>>>>>
>>>>>
>>>>> The fillBufferWithSampleForBus (0 to N) does this:
>>>>>
>>>>> -(void)
>>> fillBufferWithSampleForBus0:(UInt32)inNumberFrames
>>>>> :(UInt32 *) frameBuffer {
>>>>> int packetCount;
>>>>> int packetIndex; //Current position in sample
>>>>>
>>>>> //loop through the buffer and fill the frames
>>>>> packetCount = (int)[self.sample1 getPacketCount];
>>>>> packetIndex = (int)[self.sample1 getIndex];
>>>>>
>>>>> self.nbSampleToPlayTrack1 = ((packetCount -
>>>>> packetIndex) < inNumberFrames)? (packetCount -
>>>>> packetIndex):inNumberFrames; for (int j = 0; j <
>>>>> inNumberFrames; j++){ if(self.nbSampleToPlayTrack1 >
>>>>> 0) { frameBuffer[j] = [self.sample1 getNextPacket];
>>>>> self.nbSampleToPlayTrack1--;
>>>>> }
>>>>> else {
>>>>> self.isPlayingTrack1=FALSE;
>>>>> [self.sample1 reset];
>>>>> frameBuffer[j] = 0;
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>
>>>>> So I guess I'm filling the buffer for each bus.
>>>>>
>>>>> Everything that I "play" on bus 2 and on (correct
>>>>> behavior for busses 0 and 1) is sent clipped only to
>>>>> the left of my headset. I taught it was the sample so
>>>>> I used the same sample for each bus and I had the same
>>> strange behavior. Anything that I do wrong? >
>>>> I think its a format issue - make sure you have mono or
>>>> stereo as you want as the format for each bus you are
>>>> using. If it si mono, you have one buffer to deal with,
>>>> if stereo, you have two, and the first buffer is the
>>> left channel >
>>>> Bill
>>>>
>>>>>
>>>>> Pat
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be
>>>> ignored. Coreaudio-api mailing list
>>>> (email@hidden) Help/Unsubscribe/Update
>>> your Subscription: >
>>>>
>>>
>>
>>l.com
>>>>
>>>> This email sent to email@hidden
>>>>
>>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Coreaudio-api mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden