ESI Juli@ soundcard driver for FreeBSD

It so happen in daily work I prefer FreeBSD to other OS'es. Also I have 2 ESI Juli@ soundcards and a lot of great music, and it wold be great to combine work with pleasant one. FreeBSD has declared support for Juli@ soundcard, but it is very limited - only playback is actually implemented, nothing more. Sadly, even volume level is hardcoded in the driver and cannot be changed via mixer(4). Of course, it doesn't suit me, therefore, a new, maximally functional driver was developed, also with support for external graphical control panel. In the hope that this piece of code could benefit someone else, it was posted here.

This driver works for me without any problems from the end of 2018, but, as I mostly listen to music and do not often use other functionality (such as recording or MIDI), more thorough testing is required. The driver is tested on i386 and amd64 architectures. Both PCI and PCI Express (Juli@ XTe) versions of the sound card are supported. And yes, this is OpenSource project. It is licensed under 2-clause FreeBSD license, and comes without any warranty.

1. Features
2. Download
3. How to use
4. Mixer controls
5. Runtime configuration
6. Known issues
7. License

Features

This driver features:

Download

Source link Version Release date What's new
snd_juliet_v2_source.tar.gz 2 2019.08.06 Read
snd_juliet_v1_source.tar.gz 1 2019.04.07 Initial release

How to use

All operations (except for downloading and extraction) should be done as root.


1. Download source code using link above, or use fetch:

% fetch https://sndbro.ru/snd_juliet/files/snd_juliet_v1_source.tar.gz

2. Extract archive:

% tar xf snd_juliet_v1_source.tar.gz

3. Move into created directory and build driver:

# cd snd_juliet_v1_source
# make && make install

4. Load driver:

# kldload snd_juliet

Enjoy! Feel free to email me (ap at sndbro.ru) with test results and suggestions on further improvements.


If make has failed, please make sure Your /etc/make.conf file doesn't have NO_MODULES=... variable set. Also make sure FreeBSD source code tree is installed under /usr/src/sys.


To make driver automatically loadable at startup, insert 'snd_juliet_load="YES"' line into /boot/loader.conf file.


Remember to configure hw.snd.default_unit sysctl(8) variable if more than one sound card driver is loaded.

Mixer controls

Use mixer(8) to control volumes and selection of a recording source.

DAC built-in attenuator used to control volume levels, soft volume not implemented in this driver. This attenuator have 127 levels of volume, but mixer(8) expects values in range from 0 to 100. Thus formulae for volume calculation is: volume = 127 * mixer(8)_value / 100.

Monitoring volume control changes volumes of all three monitoring channels simultaneously. This is no way to control them separately via mixer(8). Monitoring itself can be enabled by setting sysctl(8) variables (see 'Runtime configuration' below).

Available recording sources are 'line' and 'dig1'. Line is default source. Use mixer =rec dig1 command to switch to digital input and mixer =rec line to switch back to analog. Multiple recording sources cannot be selected.

Runtime configuration

Following sysctl(8) variables are available:


dev.pcm.X.play_outs Selects active playback output(s): 0 = analog+digital, 1 = analog only, 2 = digital only. Cannot be changed while playback is in progress. Default value: 0.
dev.pcm.X.sample_rate_manual Disable of automatic sampling rate control. 0 = automatic sampling rate control enabled, 1 = disabled. Default value: 0.
dev.pcm.X.sample_rate Displays current sampling rate. This variable is writable, so hardware can be switched to another sampling rate on the fly. Supported rates are 44100, 48000, 88200, 96000, 176400 and 192000.
dev.pcm.X.override_system_latency 0 = disabled, 1 = enabled. If enabled, latency (block sizes) can be controlled manually (see dev.pcm.X.latency). If disabled, block sizes calculated by sound(4) according to hw.snd.latency and hw.snd.latency_profile variables. Default value: 0.
dev.pcm.X.latency Set buffering block size (affects latency). To make use these values, set dev.pcm.X.override_system_latency first. Valid values are in range 0-5. Change them accordingly to required block size (in bytes: 0=512, 1=1024, 2=2048, 3=4096, 4=8192, 5=16384). Smaller block implies smaller latency at the cost of increased interrupt rate. Default value: 3.
dev.pcm.X.mon_spdif_out, dev.pcm.X.mon_spdif_in, dev.pcm.X.mon_analog_in 0 = disabled, 1 = enabled. Enable any of these to monitor corresponding channel at analog output. Can be enabled in any combination. Use mixer(8) or control panel to control monitoring volume. Default values: 0.
dev.pcm.X.extclock Enable soundcard clock synchronization with external clock source. Useful if external signal source connected to digital input. Default value: 0.

Known issues

This driver supports only 32-bit data format. There is nothing to worry about, until one wish use bitperfect mode with virtual channels disabled. In this mode (tunables dev.pcm.X.bitperfect=1, dev.pcm.X.play.vchans=0 and dev.pcm.X.rec.vchans=0) any data processing is disabled by sound(4), including data format conversion. Thus only 24-bit data can be played or recorded within this mode, and your userland software will show error 'data format not supported' or similar in case of playback of 16-bit audio data. To overcome this restriction, either not disable vchans (this allows data format conversion by sound(4) itself, note feeder_format(X->Y) in feeder chain), or use your userland software abilities of data format conversion. For example, using mplayer with -format s32le command line option enables mplayer's internal format conversion routine, and solves this problem.

License

Copyright (c) 2019 Aleksei Palyutin 
All rights reserved.                                                         

Redistribution and use in source and binary forms, with or without           
modification, are permitted provided that the following conditions           
are met:
 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND       
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE        
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE      
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS      
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)        
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT    
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF       
SUCH DAMAGE.

Please take a moment and comment on this article

No comments yet...