How to list audio card IDs from terminal
system_profiler is the tool in mac OS to show hw or sw configuraion.

Get the datatye you want to look for using --listDataTypes.

$ system_profiler -listDataTypes | grep Audio
SPAudioDataType


Then fire the command, 

$ system_profiler SPAudioDataType
Audio:

    Intel High Definition Audio:

      Audio ID: 128

        Headphone:

          Connection: Combination Output

        Speaker:

          Connection: Internal

        External Microphone / iPhone Headset:

          Connection: Combination Output

        Internal Microphone:

          Connection: Internal

        S/PDIF Optical Digital Audio Output:

          Connection: Combination Output

        HDMI / DisplayPort Output:

          Connection: Display

    Devices:

        Built-in Microphone:

          Default Input Device: Yes
          Input Channels: 2
          Manufacturer: Apple Inc.
          Current SampleRate: 44100
          Transport: Built-in

        Built-in Output:

          Default Output Device: Yes
          Default System Output Device: Yes
          Manufacturer: Apple Inc.
          Output Channels: 2
          Current SampleRate: 44100
          Transport: Built-in