# Bitperfect to usb audio



## boombim (Mar 28, 2021)

Hello. I have Motu m2.
Freebsd 13 is installed on my laptop.
I'm trying to send bitperfect audio to usb interface but unfortunately get distorted and dirty signal.

I seted
dev.pcm.3.play.vchans=0
dev.pcm.3.bitperfect=1

What do I do wrong?


----------



## bsduck (Mar 31, 2021)

I typically get distorted sound if I either
1. use a wrong sampling rate, for example a program sending 44100Hz while the hardware is expecting 48000Hz (bitperfect means no resampling)
2. set a too low latency, in my case `hw.snd.latency` < 2


----------



## boombim (Apr 1, 2021)

bsduck said:


> I typically get distorted sound if I either
> 1. use a wrong sampling rate, for example a program sending 44100Hz while the hardware is expecting 48000Hz (bitperfect means no resampling)
> 2. set a too low latency, in my case `hw.snd.latency` < 2


I've tried even he.snd.latency=10. Nothing changed.
About first point.
I've checked dmesg and looks like my audio interface supports wide range of samplerates from 44100 to 192000.
BUT only in 32-bit.

Is "bitperfect" really direct stream? I notice that many even professional DACs support only one format (16-bit or 24-bit or 32-bit).  I guess it means if signal (e.g. audio file) is not in 32-bit natively than it should be converted anyway. Right?

According to this thought I've also tried to set `vchansmode` to "adaptive". This way distortion gone. BUT audio plays few times quicker and produce weird and funny song

Who knows about this?


----------



## ludensen (May 10, 2021)

Hello boombim,
have you found the 'magic' combination of parameters that gives you 'clean' signal/sound?
If or when - please write your findings here to help others  thanks

It is a bit disheartening (maybe too strong a word) to see how little response audio questions get. Apparently sound is not that important for us - the average FreeBSD user...  (unfortunately I'm not the change to that - yet.)

Hoping you have or will find a solution  

BSD-regards
Tom Ludensen


----------



## Tieks (May 10, 2021)

What boombim describes as 'distorted and dirty signal' could be jitter. Latency plays a role there, as bsduck already pointed out. But audio playing a few times quicker probably has to do with different resolutions. I don't know the Motu M2, looking at their website I see it's USB 2.0 audio class compliant. On Mac/iOS it doesn't need driver software, then it should work with FBSD too.
Finding the right settings is a bit of a hassle. `cat /dev/sndstat` gives information, `ffprobe -hide_banner -show_streams -f oss -i /dev/dsp3` is better for incoming streams (ffprobe is part of ffmpeg).



			
				ludensen said:
			
		

> Apparently sound is not that important for us


To me it is. I'm running an external dac/adc in bitperfect mode using snd_hda, oss, audacity and audacious. Finding out how to use it took me some time when I started with it. But it was certainly worth the trouble now that it is running fine.


----------



## ludensen (May 10, 2021)

Tieks said:


> I'm running an external dac/adc in bitperfect mode using snd_hda, oss, audacity and audacious.


Which ADC if I may ask?
I'm in the research phase of doing something similar and am about to post a HW-question and a SW-question about the subject on the forum...

BSD-regards
Tom Ludensen


----------



## Tieks (May 11, 2021)

ludensen said:
			
		

> Which ADC if I may ask? I'm in the research phase of doing something similar



Mine is an RME ADI-2, not the latest model but its predecessor. It's a 2-channel AD/DA based on AKM converters, connected to mobo using sp/dif coax. I bought it second hand back in 2012 and have been using it with FBSD ever since. Always worked well with snd_hda/OSS, although it took me some time to find the settings that work best for me. Downside: One very rare timing problem, resulting in irregular ticks during recording. That rarely happens and can be solved by restarting Audacity or switching the RME off and back on. The real downside is that I feel stuck with sp/dif now, don't see many motherboards that have these ports. The sound is, though subject to taste of course, precise and neutral. I like the RME very much.


If I had to buy another converter, I would look at USB-devices now. Something that is USB audio class compliant and comes without driver software from the manufacturer. Like it said on the Motu website "plug-and-play operation on Mac or iOS". Don't want to install Wine for it. I would choose Firewire or sp/dif only if I had these ports available on a relatively new motherboard.


----------

