roc-toolkit icon indicating copy to clipboard operation
roc-toolkit copied to clipboard

Configurable channel set

Open gavv opened this issue 7 years ago • 5 comments

What we need:

  • configurable sender input channel set
  • configurable receiver output channel set
  • configurable network channel set

Features:

  • [x] mono, stereo
  • [x] surround sound (3.x, 4.x, 5.x, 6.x, 7.x)
  • [x] multitrack recording (up to 1024 channels/tracks)
  • [x] different orders (smtpe, alsa)
  • [x] surround <=> surround mapping (upmixing & downmixing)
  • [x] multitrack <=> multitrack mapping
  • [x] surround <=> multitrack mapping
  • [x] mapping between orders

Internals:

  • [x] ChannelLayout (surround, multitrack)
  • [x] ChannelOrder (order of surrounf channels in memory; smtpe, alsa)
  • [x] ChannelPosition (identifiers of surround channels)
  • [x] ChannelSet (multi-word channel mask + layout + order)
  • [x] update SampleSpec
  • [x] downmixing/upmixing tables
  • [x] ChannelMapper
  • [x] ChannelMapperReader
  • [x] ChannelMapperWriter
  • [x] update pipeline
  • [x] rtp::FormatMap should provide layout, order, and mask

API:

  • [x] mono
  • [x] stereo
  • [x] multitrack

CLI:

  • [ ] --io-encoding
  • [ ] --packet-encoding

gavv avatar Jul 12 '17 06:07 gavv

is it, at the moment, possible to have a multi-channel setup?

for example jack-router allows to specify virtual outputs. They show up in my qjack-ctl Screen Shot 2021-03-04 at 14 34 58

How would I connect each one of them to a single roc-send? So my roc-recv on the other side just has to deal with 1 channel.

When doing roc-send -L I get

supported device drivers:
  core

on OSX

How would I connect to the right device? And pass the right channel to each roc-send instance?

kaosbeat avatar Mar 04 '21 13:03 kaosbeat

Hi!

is it, at the moment, possible to have a multi-channel setup?

Currently, roc always uses exactly two channels. I'm planning to fix this in 0.2 (upcoming major release).

How would I connect each one of them to a single roc-send? So my roc-recv on the other side just has to deal with 1 channel.

Currently roc doesn't support JACK. But if you map each output port to a separate ALSA device, you can run an instance of roc-send for each device.

If somebody will add support for JACK in future, it could be possible to connect roc-send directly to a JACK port.

How would I connect to the right device? And pass the right channel to each roc-send instance?

You can use --input option of roc-send to specify device ID. IIRC, you can get the list of devices available using system_profiler SPAudioDataType.

We use sox for recording and playback on macOS, and its latency is not ideal. I plan to add native coreaudio backend in 0.3.

gavv avatar Mar 05 '21 11:03 gavv

I'm planning to fix this in 0.2 (upcoming major release).

We'll see multichannel when it arrives :)

if you map each output port to a separate ALSA device, you can run an instance of roc-send for each device.

I guess on a mac you cannot make separate ALSA devices?

The system profiler spits out quite a list. It however has no effect I tried the --input option with no success. It defaults to the the default input device, which is on my mac a single channel microphone. I'm using the "name" because that is the closest I can find to ID

I tried changing the inputs like this: roc-send --input "Audiohub 2x4" --packet-length=5ms -vv -s rtp+rs8m:192.168.1.152:10001 -r rs8m:192.168.1.152:10002

the output of system_profiler SPAudioDataType is

$ system_profiler SPAudioDataType
dlopen error : dlopen(libjack.0.dylib, 0x0001): file not found 'libjack.0.dylib'
dlopen error : dlopen(libjack.0.dylib, 0x0001): file not found 'libjack.0.dylib'
Audio:

    Devices:

        DisplayPort:

          Manufacturer: Apple Inc.
          Output Channels: 2
          Current SampleRate: 48000
          Transport: DisplayPort
          Output Source: HP LP2475w

        Audiohub 2x4:

          Input Channels: 2
          Manufacturer: Novation
          Output Channels: 4
          Current SampleRate: 48000
          Transport: USB
          Input Source: Default
          Output Source: Default

        External Headphones:

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

        MacBook Pro Microphone:

          Input Channels: 1
          Manufacturer: Apple Inc.
          Current SampleRate: 48000
          Transport: Built-in
          Input Source: MacBook Pro Microphone

        MacBook Pro Speakers:

          Default Input Device: Yes
          Default Output Device: Yes
          Manufacturer: Apple Inc.
          Output Channels: 2
          Current SampleRate: 44100
          Transport: Built-in
          Output Source: MacBook Pro Speakers

        JackRouter:

          Input Channels: 8
          Manufacturer: Grame
          Output Channels: 20
          Current SampleRate: 0
          Transport: Unknown
          Input Source: Default
          Output Source: Default

but even running without the input option roc-send won't start

$ roc-send --packet-length=5ms -vv -s rtp+rs8m:192.168.1.152:10001 -r rs8m:192.168.1.152:10002
13:16:16.349 [dbg] roc_sndio: initializing sox backend
13:16:16.349 [dbg] roc_send: pool: initializing: object_size=2064 poison=0
13:16:16.349 [dbg] roc_send: pool: initializing: object_size=2576 poison=0
13:16:16.349 [dbg] roc_send: pool: initializing: object_size=632 poison=0
13:16:16.352 [inf] roc_sndio: sox source: opening: driver=coreaudio input=default
13:16:16.433 [inf] roc_sndio: sox source: in_bits=32 out_bits=32 in_rate=48000 out_rate=0 in_ch=1 out_ch=0 is_file=0
13:16:16.433 [err] roc_sndio: sox source: can't open: unsupported # of channels: expected=2 actual=1
13:16:16.433 [inf] roc_sndio: sox source: closing input
13:16:16.434 [err] roc_send: can't open input file or device: driver=(null) input=(null)

I just have to go to audio setting and set a different default audio device that has 2 channel input. Tried doing this for "jackrouter" (as that would solve part of my other problem) but I cannot choose this device as a default input/output

We use sox for recording and playback on macOS, and its latency is not ideal. I plan to add native coreaudio backend in 0.3.

I was surprised how well it works out-of-the-box with default settings, I did not expect < 10ms latency...

kaosbeat avatar Mar 05 '21 12:03 kaosbeat

I guess on a mac you cannot make separate ALSA devices?

Oh, yes, this is only about Linux.

I tried changing the inputs like this:

Looks legit. Last time I tested it with soundflower device: https://gavv.github.io/articles/roc-tutorial/#run-roc-send-1

So when you use --input "Audiohub 2x4", roc-send ignores it and just uses default input device?

but even running without the input option roc-send won't start

Yes, until this issue is resolved, roc-send wont work unless audio backend allows to open device in two-channel mode. PulseAudio will always allow it and perform channel mapping if necessary. IIRC coreaudio just doesn't have this feature, so for now you can use only two-channel devices.

BTW until there is multichannel support, you can try to hack the source code and just change the number of channels, which is hard-coded to 2, to another number. You'll need to change DefaultChannelMask in roc_pipeline and maybe a few other constants (not sure).

gavv avatar Mar 05 '21 13:03 gavv

  • e1c741af5c48f1a5ba954b0bba7edc4037bed7bb
  • 0548221ed2fdc5507ca11e225f48332285736397
  • 703583c956ceb0c88e9e221c63ed6eb4d1c0fbaa
  • a63b8ce4952daced9107bbbdce62b0d846319b33
  • adc90bfe43595ceeb67698f0d9f5dcb6061e17e7
  • 919873e94d43eaee06fe9885defbc1fa7f05075f

gavv avatar Oct 10 '23 17:10 gavv