Just installed Raspyfi yesterday and it worked like a charm right out of the box. I can play 24bit/192kHz files from my USB drive to the USB dac without any glitches.
I do have a problem with Shairport though. It outputs everything in 48kHz which is not correct, it should be 44.1kHz for my music files. Is there any way to change this?
Regards
Jonas
I checked the Shairport source code and from what I understand it can only output 44.1 kHz so a resampling must be done outside of Shairport.
What audio backend is used for Shairport in Raspify?
Hi,
For Airplay, it is the client player that typically enforces resample to 16/44100, but also an Airplay receiver (Apple TV, RaspyFi) may perform a second resampling to 16/48000
For example, lets use a 24/96 music file as our source and iTunes as our player. iTunes will first resample the file to 16/44100 prior to streaming to the Airplay receiver. Then here is what happens at the receiver end:
1. Apple Airport Express 16/44100 output (no resample)
2. Apple TV resample to 16/48000 output
3. RaspyFi resample to 16/48000 output
The worst cases are 2 and 3 where 24/96 resample to 16/44 in the player then resampled again to 16/48 in the receiver. This is not good! Thankfully there are some simple changes you can make in RaspyFi that prevent resampling when using Airplay.
Disabling alsa automatic sample rate conversion i.e., use hw instead of dmix
- sudo nano /etc/asound.conf
- pcm.!default {
type hw
card 0
device 0
}
- OR -
Changing the rate if using dmix automatic sample rate conversion
- sudo nano /usr/share/alsa/alsa.conf
- defaults.pcm.dmix.rate 44100 (default is 48000)
And for those who might want to change the Airplay name that shows up in your player.
- sudo nano /etc/init.d/shairport
- NAME="Airfi – Test"
Thank you very much for your answer.
Disabling dmix in asound.conf gave me a very distorted sound.
Changing the default sample rate to 44100 solved my problem.
I have not tried changing the Airplay name yet but how could that affect the sample rate?
The Airplay name change was just an extra I threw in. It has no effect whatsoever on audio
What model DAC are you using?
tc-fi said
The Airplay name change was just an extra I threw in. It has no effect whatsoever on audio
That explains it
tc-fi said
What model DAC are you using?
I am using a DIY dac. The USB input is handled by WaveIO usb to i2s interface. It is based on XMOS USB 2.0 reference design which is used in many commercial DACs. The output from "cat /proc/asound/card0/stream0" looks like this;
Luckit Luckit USB Audio 2.0 at usb-bcm2708_usb-1.3.1, high speed : USB Audio
Playback:
Status: Stop
Interface 1
Altset 1
Format: S32_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000
Data packet interval: 125 us
Possibly when disabling dmix the sound was distorted because no conversion to S32_LE was happening. Maybe its dmix that does the conversion to the byte format your DAC needs?
I think in my case, since HRT MSII supports both S16_LE and S24_3LE I can safely bypass dmix for 16/44 and 24/96 files. Just guessing.
Dump for HRT MSII DAC.
[email protected]:~$ cat /proc/asound/card0/stream0
http://www.hirestech.com 2013 REV 2.3 Music Streamer II at usb-bcm2708_usb-1.3, full s : USB Audio
Playback:
Status: Stop
Interface 1
Altset 1
Format: S24_3LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 96000, 88200, 48000, 44100, 32000
Interface 1
Altset 2
Format: S16_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 96000, 88200, 48000, 44100, 32000
tc-fi said
Possibly when disabling dmix the sound was distorted because no conversion to S32_LE was happening. Maybe its dmix that does the conversion to the byte format your DAC needs?
I think in my case, since HRT MSII supports both S16_LE and S24_3LE I can safely bypass dmix for 16/44 and 24/96 files. Just guessing.
That makes sense. So I will have to live with dmix I guess. DO you know what else dmix may be doing? Something that may have impact on teh sound quality?
I also noticed that the volume is much lower from shairport compared to mpd. I wonder if dmix does that or if it has something to do with the Airplay protocol?
If dmix and alsa are like Windows audio engine, then as long as all DSP effects (bass boost, eq, preamp, etc) are off and source sample rate = mix output sample rate, then no DSP will occur on the samples other than volume and a final dithering that the mixer will perform.
Low volume when playing through Shairport may be due to how the player app volume and system (Master) volume are, or are not working together. What player app and OS are you using?
Most Users Ever Online: 200
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Gyp: 82
yoghurtlidlicker: 37
PaulM: 36
icai: 35
Derek: 29
Karsten: 27
tc-fi: 22
Ronaldo: 21
ENSen: 21
chriz: 20
Member Stats:
Guest Posters: 3619
Members: 569
Moderators: 0
Admins: 1
Forum Stats:
Groups: 4
Forums: 10
Topics: 469
Posts: 13163
Newest Members: polo2016, dongdong8, wlpwlp, Sager, ninestab123, lmx66, lmx, jlgg, chenyan, guoyanying
Administrators: admin (401)