OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | #planetgemini chat on matrix.org | #gemini-pda chat on Freenode | #zaurus and #alarmz chat on Freenode | ELSI (coming soon) | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> USB Audio in Sailfish, How to use a DAC
mgfm99
post Jul 1 2018, 10:20 AM
Post #1





Group: Members
Posts: 12
Joined: 2-March 18
Member No.: 818,566



I've been playing around with the most recent Community Build of Sailfish for the Gemini and thought I'd post a guide to using a USB DAC with the Gemini in Sailfish - the instructions for this I gleaned from a Google search of the IRC archives for sailfish OS adaptations.

The original Jolla 1 did not have USB OTG, so the UI interface was never developed for using peripherals; but with the community versions there have now been many devices which work with Sailfish and have USB OTG.

The Gemini recognizes USB audio DACs on insertion (or at least it does with an Audioquest Dragon Fly), but it won't play any music from any app to it.

To do that you need to do three things:

1. You need to block udev recognising the internal sound system (this won't affect the use of the internal speaker; but if you don't do this, running a udev detect with the new device attached will lead to a reboot):
Add a new file to /etc/udev/rules.d which blacklists the internal sound system before any pulseaudio rules are run: e.g.
89-pulseaudio-usb.rules with the content
ATTRS{id}=="mtsndcard", ENV{PULSE_IGNORE}="1"

2. You need to get pulseaudio to connect with the alsa definitions for usb audio devices; to do this, you only need to
rename usbaudio.conf.disabled to usbaudio.conf in /etc/pulse/xpolicy.conf.d;

3. Last, you need pulseaudio to register that the usb DAC is available in the system. As far as I can see, this needs to be done manually at the moment:
After restarting your Gemini in Sailfish, you need to open thumbterm and run (as user, not as root) 'pactrl load-module module-udev-detect'
On IRC it was suggested simply adding the load-module line to default.pa in /etc/pulse - but the module load is already there, and doesn't seem to react to external devices even after udev rules have been modified, so I found I needed to run this command manually. Didn't matter whether the DAC was already connected or not.

4. You can check this has worked by running as user pacmd list-sinks - there should now be an additional one at the end (i.e. a fifth device) with the details of your DAC.

5. At this stage, media players will output through your USB Audio device - but sound will be capped to 48Hz sample rate; to allow sample rates up to the highest your DAC will allow, edit daemon.conf in /etc/pulse to enable the entry alternate-sample-rate, by default this is set as 48000. For the Audioquest, you should set it to 96000.

6. You might find it useful to install alsa-utils and usbutils from https://build.merproject.org to check that things are being recognized by the kernel when first attached, and that alsa knows this is a soundcard.

7. Must be said that the sound is still somewhat glitchy - as it can be also in Android. However the tweaks in USBAudio Pro in Android enable one to get a perfect and excellent sound out of the Gemini; that uses its own driver, and unfortunately there is no equivalent in Sailfish, and the alsa standard driver is not of the same quality.
Go to the top of the page
 
+Quote Post
klampfenfreak
post Dec 1 2018, 03:35 AM
Post #2





Group: Members
Posts: 11
Joined: 29-October 18
Member No.: 835,812



Strange, after that changes fingerterm could not rotate into landscape-inverted, anymore. blink.gif
Zoom H4n USB audio did not work at all, trying to play or record audio thru it.

QUOTE(mgfm99 @ Jul 1 2018, 10:20 AM) *
I've been playing around with the most recent Community Build of Sailfish for the Gemini and thought I'd post a guide to using a USB DAC with the Gemini in Sailfish - the instructions for this I gleaned from a Google search of the IRC archives for sailfish OS adaptations.

The original Jolla 1 did not have USB OTG, so the UI interface was never developed for using peripherals; but with the community versions there have now been many devices which work with Sailfish and have USB OTG.

The Gemini recognizes USB audio DACs on insertion (or at least it does with an Audioquest Dragon Fly), but it won't play any music from any app to it.

To do that you need to do three things:

1. You need to block udev recognising the internal sound system (this won't affect the use of the internal speaker; but if you don't do this, running a udev detect with the new device attached will lead to a reboot):
Add a new file to /etc/udev/rules.d which blacklists the internal sound system before any pulseaudio rules are run: e.g.
89-pulseaudio-usb.rules with the content
ATTRS{id}=="mtsndcard", ENV{PULSE_IGNORE}="1"

2. You need to get pulseaudio to connect with the alsa definitions for usb audio devices; to do this, you only need to
rename usbaudio.conf.disabled to usbaudio.conf in /etc/pulse/xpolicy.conf.d;

3. Last, you need pulseaudio to register that the usb DAC is available in the system. As far as I can see, this needs to be done manually at the moment:
After restarting your Gemini in Sailfish, you need to open thumbterm and run (as user, not as root) 'pactrl load-module module-udev-detect'
On IRC it was suggested simply adding the load-module line to default.pa in /etc/pulse - but the module load is already there, and doesn't seem to react to external devices even after udev rules have been modified, so I found I needed to run this command manually. Didn't matter whether the DAC was already connected or not.

4. You can check this has worked by running as user pacmd list-sinks - there should now be an additional one at the end (i.e. a fifth device) with the details of your DAC.

5. At this stage, media players will output through your USB Audio device - but sound will be capped to 48Hz sample rate; to allow sample rates up to the highest your DAC will allow, edit daemon.conf in /etc/pulse to enable the entry alternate-sample-rate, by default this is set as 48000. For the Audioquest, you should set it to 96000.

6. You might find it useful to install alsa-utils and usbutils from https://build.merproject.org to check that things are being recognized by the kernel when first attached, and that alsa knows this is a soundcard.

7. Must be said that the sound is still somewhat glitchy - as it can be also in Android. However the tweaks in USBAudio Pro in Android enable one to get a perfect and excellent sound out of the Gemini; that uses its own driver, and unfortunately there is no equivalent in Sailfish, and the alsa standard driver is not of the same quality.
Go to the top of the page
 
+Quote Post
mgfm99
post Dec 1 2018, 10:31 AM
Post #3





Group: Members
Posts: 12
Joined: 2-March 18
Member No.: 818,566



[quote name='klampfenfreak' date='Dec 1 2018, 12:35 PM' post='290847']
Strange, after that changes fingerterm could not rotate into landscape-inverted, anymore. blink.gif
Zoom H4n USB audio did not work at all, trying to play or record audio thru it.

Did you install alsa-utils?

what does lsusb show when you run it?

What about aplay -l and aplay -L?

also you could try playing a test file from the command line using aplay and specifying the alsa device explicitly to see if anything can be routed to your dac.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th October 2019 - 01:24 PM