| Open Sound System |
Open Sound System driver for Sonorus Studi/o professional audio devices.
Sonorus STUDI/O is a high end audio card with two optical digital input and output ports. Both ports can be configured to work in S/PDIF (stereo) or ADAT (8 channels) modes. This gives up to 16 simultaneous input and output channels. In addition the card has a 18 bit analog output (monitor) port. There is a mixer that can be used to mix any combination of the input and output signals to the monitor port. In addition OSS supports the monitor port as an independent stereo output device.
Both 16 and 24 bit (actually 32 bit msb aligned) formats are supported.
See http://www.sonorus.com for more information about STUDI/O.
The STUDI/O card is very versatile device. Together with OSS you can use it for example to following tasks:
The STUDI/O driver will create several audio device files (/dev/dsp#) when started. The number of device files depends on the mode in which the card is being used (will be described in the next chapter).
The first device being created is an output device for the analog monitor device. It will always work in stereo mode (mono use is not possible).
There are separete sets of device files for both the output and the input channels. The number of devices being created depends on the selected mode. The following example shows the devices for mode 0 (device numbering may be different if there are other sound devices installed):
Audio devices:
0: STUDI/O monitor output (stereo)
1: STUDI/O output A0
2: STUDI/O output A1
3: STUDI/O output B0
4: STUDI/O output B1
5: STUDI/O input A0
6: STUDI/O input A1
7: STUDI/O input B0
8: STUDI/O input B1
In the above case monitor output is the /dev/dsp0 device. Output devices for the S/PDIF channels A0, A1 (port A), B0 and B1 (port B) are /dev/dsp1 to /dev/dsp4 (respectively). The input device files are /dev/dsp5 to /dev/dsp8).
Monitor and output ports can be opened only for write access (O_WRONLY) while the input devices are read only (O_RDONLY). For fuplex use you will need to two devices. One or more of the output ports for writing and one or more of the input ports for reading.
As mentioned earlier the monitor port works always in stereo mode. The digital devices can be used in 1 to N channel modes where the N depends on the device file being used and the studio mode. In the 2*ADAT modes N can be as large as 16.
When an input or output device file is opened it will be in one channel (mono) mode. When the application changes the number of channels a check will be made to see if desired number of channels are available and the channels will be allocated for the device file. For example when /dev/dsp1 is set to 4 channel mode the /dev/dsp2, /dev/dsp3 and /dev/dsp4 devices will be joined with it. After that none of these devices cannot be opened until /dev/dsp1 is closed. This means that in the above case /dev/dsp1 and /dev/dsp5 can be used in 1, 2, 3 or 4 channel modes while it's possible to use /dev/dsp4 and /dev/dsp8 only in one channel mode.
It's possible to use the available devices in any combination of modes provided that the channel ranges don't intersect. For example it's possible to open /dev/dsp1 and /dev/dsp3 and to set both of them to stereo mode. Alternatively all of the devices (1 to 4) can be opened separately and used in mono mode.
When more than one channels are allocated for a device file the samples for each channel will be interleaved in the audio data stream. For example (3 channel mode): ch1_sample1, ch2_sample1, ch3_sample1, ch1_sample2, ch2_sample2, ch3_sample2.
Note that all the device files may not be created automatically when the STUDI/O card is configured for modes supporting more than 16 channels. A method for fixing this situation is described later in this document.
The sample rate used for all the device files can be derived from various sources. The settings can be changed using the ossmix utility. The associated parameters will be described later in this document.
The main clock source is determined by the fpga.clock parameter). By default the clock is derived from the S/PDIF port A ("AES"). The other alternatives are dixed 44.1kHz or 48 kHz rates (derived from an internal crystal oscillator) or PLL oscillator.
Operating mode of the PLL circuit is determined by the fpga.pll setting. The available alternatives are locking to the port A or port B input signals, internal sample rate timer or external sync input (from optional sync backplane).
In addition to the main clock some modes support different sampling rate for the output port A than the one used by the other inputs and outputs. This can be used for example to produce a real time 44.1kHz mix of a performance otherwise occurring using 48kHz sample rate. This SRC clock can be set using the fpga.srcclock setting which works just like fpga.clock.
These settings can be changed any time but it's highly recommended to do changes only when none of the device files are in use. However the changes will not take effect before the device is reactivated (by starting an input or output operation).
During recording the clock should be determined from the input port used as the source. Otherwise incoming signal will be completely distorted. Internal source should be used when no input is connected to the digital input ports. If sync is dropped during recording/playback the device will be stopped and all applications using it will receive an I/O error (EIO).
It's not yet possible to start recording/playback operations using several device files simultaneously. All device files will start the transfer as soon as read is called or enough data (128 samples/channel) is written to the the device file. There will be methods for syncronous operation of device files in the final STUDI/O driver version.
This chapter is intended only for programmers writing applications that use the STUDI/O card.
NOTE! Some applications use the SNDCTL_DSP_GETBLKSIZE in incorrect way (it should always be called after selecting the sampling parameters).
recording will not work with applications that call this ioctl before
selecting the sample rate, number of channels and/or sample format.
NOTE! Applications should not change the sampling parameters after starting the read or write operation. The device file should be
closed and reopened before doing this. In particular number
of channels cannot be decreased without reopening the device.
NOTE! Fragment size will always be controlled by the driver and it will be set to match 64 samples/channel when using the selected sample format
(for example 256 bytes for 16bit/stereo format). The
SNDCTL_DSP_SETFRAGMENT ioctl can be used to change the number of
fragments but it will not have any effect to the fragment size.
ANALOG MONITOR (MIX) OUTPUT
In addition to the monitor output device file (/dev/dsp0 in the above case) the analog monitor output connector receives a mix of the digital input and output signals. This mixing process is controlled by the mixer settings that are changeable using the ossmix utility shipped with OSS (see below).
The default mixer volume settings are selected so that even numbered channels (A0, A2, A4, ... B0, B2, B4, ..., B(N-1)) will be mixed only to the left channel of the analog monitor mix while the other channels are sent only to the right channel. When the A0 port is used in mono mode the output will be heard only from the left monitor channel. It's possible to change panning for the outputs or inputs using the ossmix utility.
Channel pairs A0+A1, A2+A3, ..., B0+B1, B2+B3, ... can be used as stereo pairs. When different combinations (such as A1+A2) are used the channels will be reversed. This can be fixed by adjusting the mixer settings.
There are several parameters that can be changed before starting recording and/or playback (actually they can be changed any time but the change will take effect when recording/playback is (re)activated next time. These parameters include for example clock source. These settings can be changed using the command line based ossmix program (a GUI based one will be released in future). The following start time options are available (some of them are not available in all modes):
setup.mon1l <OFF|A0..A7|B0..B7> (currently A0)
setup.mon2l <OFF|A0..A7|B0..B7> (currently OFF)
setup.mon1r <OFF|A0..A7|B0..B7> (currently A1)
setup.mon2r <OFF|A0..A7|B0..B7> (currently B1)
These settings can be used to route the monitor mix to up to two pairs of digital output ports. The default value is OFF which means that the monitor mix is not sent to the digital outputs. This feature can be used for example for real time mixing of a performance to a DAT tape.
There are few parameters that can be changed any time and the change will take effect immediately. The main volume (analog monitor output volume) parameter can be changed using any mixer program. In addition there are some parameters that can be changed only using ossmix. These ones include settings for independent digital channel volumes. The following settings can be adjusted any time:
vol <both/leftvol>[:<rightvol>] (currently 50:50) This setting defines master volume of the analog monitor output.
mixer.out_a0 <both/leftvol>[:<rightvol>] (currently 100:0) mixer.out_a1 <both/leftvol>[:<rightvol>] (currently 0:100) ... mixer.out_b0 <both/leftvol>[:<rightvol>] (currently 100:0) mixer.out_b1 <both/leftvol>[:<rightvol>] (currently 0:100) ... There are individual controls for each output channels which define how much of this signal is added to the monitor mix. Note the default settings which are totally out of balance (a0 is routed only to the left monitor channel and a1 to the right one and so on). Number of the available controls will vary depending on the mode.
mixer.in_a0 <both/leftvol>[:<rightvol>] (currently 100:0) mixer.in_a1 <both/leftvol>[:<rightvol>] (currently 0:100) ... mixer.in_b0 <both/leftvol>[:<rightvol>] (currently 100:0) mixer.in_b1 <both/leftvol>[:<rightvol>] (currently 0:100) ... Like above but for the digital inputs.
STUDI/O card has capability to provide many kind of online information such as peak meters for the channels and some error/status variables.
studio_mode=0 2*S/PDIF in, 2*S/PDIF out.
studio_mode=1 ADAT+S/PDIF(SRC) in, ADAT+S/PDIF out.
studio_mode=2 2*ADAT in, 2*ADAT out (not supported)
studio_mode=3 ADAT+SPDIF(SRC) in, 2*ADAT out (for Korg 168RC
digital mixing console). Supported but OUTB
channels don't get assigned properly.
NOTE! studio_mode=2 is not supported due to unidentified system lockup problems. In most cases studio_mode=3 will give the same
functionality.
studio_aes_mode= ? 0=consumer and 1=pro (not supported yet)
NOTE! By default OSS will create only 16 audio device files. This will not be enough if STUDI/O board is used in one of the ADAT or ADAT+S/PDIF modes.
There are some limitations in this version of the STUDI/O OSS driver. Most of them have been discussed earlier. Below is a list of the most important ones:
studio.conf Device configuration file
4Front Technologies