« Return to Thread: Using sox with external audio devices on OSX

Re: Using sox with external audio devices on OSX

by marleynoe :: Rate this Message:

| View in Thread

Hi,

Thanks, I'm currently not compiling myself so I'll have to wait for the next release...
 
In the meantime (for those interested), here is a possible workaround using soundflower/soundflowerbed (http://code.google.com/p/soundflower/); 
Setting soundflower as the system's default audio device sox can send/receive audio from this driver. Via soundflowerbed one can tap into the audio and route it to external audio devices. Note, however, that this is limited to max. 16Channels, introduces a buffer of latency and works only for audio output. (For the inverse, i.e. routing audio from an external device into sox, it must first be sent into soundflower via an external app or similar).

Marlon

On 2011-09-29, at 22:41 , Chris Bagwell wrote:

> I've fixed the bug below but can't test it very well since I only have
> 3 audio devices (why I never saw the problem before I guess).
>
> I'm thinking a new release of SoX is probably due soon.  If your not
> able to compile custom versions yourself... then hopefully it won't be
> to long.
>
> Chris
>
> On Wed, Sep 28, 2011 at 2:57 PM, Chris Bagwell <chris@...> wrote:
>> Ouch.  I think I see a bug in SoX source code.  Look for how
>> property_size is used to see how many audio devices are in the system.
>>
>>
>>          devices = malloc(property_size);
>>          status = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &prop
>> erty_size, devices);
>>
>>          if (status == noErr)
>>          {
>>              int i;
>>              for (i = 0; i < property_size/sizeof(AudioDeviceID); i++)
>>              {
>>                  char name[256];
>>                  status =
>> AudioDeviceGetProperty(devices[i],0,false,kAudioDevicePropertyDeviceName,&property_size,&name);
>>
>>
>> We really shouldn't be basing the loop count on a variable that is
>> re-init'ed inside the for loop.
>>
>> I'll test it out later and commit a fix.
>>
>> Chris
>>
>> On Wed, Sep 28, 2011 at 2:40 PM, Schumacher Marlon
>> <marlon.schumacher@...> wrote:
>>> Hi,
>>>
>>> Hmmm, unfortunately I don't know the internal workings of coreaudio that well. All I can say is that the other audio devices show up in Audio Midi Setup and Sound preferences as in the screencap below.
>>>
>>>
>>>
>>>
>>> ...and this is what sox returns for the command "/Applications/sox-14.3.2/sox  -V6 -n -t coreaudio unknown" :
>>>
>>> ------------------------
>>> /Applications/sox-14.3.2/sox: SoX v14.3.2
>>> time:  Feb 27 2011 10:42:10
>>> uname: Darwin Marlon-MBPro-2.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
>>> gcc:   4.2.1 (Apple Inc. build 5646) (dot 1)
>>> arch:  1248 48 44 L OMP
>>> /Applications/sox-14.3.2/sox INFO nulfile: sample rate not specified; using 48000
>>>
>>> Input File     : '' (null)
>>> Channels       : 1
>>> Sample Rate    : 48000
>>> Precision      : 32-bit
>>>
>>> /Applications/sox-14.3.2/sox INFO coreaudio: Found Audio Device "Built-in Microphone"
>>>
>>> /Applications/sox-14.3.2/sox INFO coreaudio: Found Audio Device "Built-in Input"
>>>
>>> /Applications/sox-14.3.2/sox INFO coreaudio: Found Audio Device "Built-in Outpu"
>>>
>>> /Applications/sox-14.3.2/sox FAIL formats: can't open output file `unknown': can not open audio device
>>> ------------------------
>>>
>>> -apparently sox doesn't find the other devices... or the 'query' is not correct?
>>>
>>> Marlon
>>>
>>> On 2011-09-28, at 15:03 , Chris Bagwell wrote:
>>>
>>>> I'm not sure why these would not show up in list.  If they present
>>>> themselves as audio devices then as far as I know they should show up
>>>> via coreaudio queries.
>>>>
>>>> I believe the SoX coreaudio driver is using same OS functions to get
>>>> the list that most other apps are.
>>>>
>>>> Chris
>>>>
>>>> On Wed, Sep 28, 2011 at 12:44 PM, Schumacher Marlon
>>>> <marlon.schumacher@...> wrote:
>>>>> Hi,
>>>>>
>>>>> Sorry for the late reply. Thanks, this works.
>>>>> However, I can only see the coreaudio devices. Is there a way to 'query' other audio devices in the system, too?
>>>>> (e.g. I can't see other drivers such as Soundflower, JackRouter or external devices).
>>>>>
>>>>> Marlon
>>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> All the data continuously generated in your IT infrastructure contains a
>>> definitive record of customers, application performance, security
>>> threats, fraudulent activity and more. Splunk takes this data and makes
>>> sense of it. Business sense. IT sense. Common sense.
>>> http://p.sf.net/sfu/splunk-d2dcopy1
>>> _______________________________________________
>>> Sox-users mailing list
>>> Sox-users@...
>>> https://lists.sourceforge.net/lists/listinfo/sox-users
>>>
>>>
>>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Sox-users mailing list
> Sox-users@...
> https://lists.sourceforge.net/lists/listinfo/sox-users
>


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

 « Return to Thread: Using sox with external audio devices on OSX