Samplerate problem on E-MU 0404USB

Please report any bug found here

Samplerate problem on E-MU 0404USB

Postby Sergey » 11 Jan 2015, 16:30

Hi!
When playing files like 24/96, 16/48, somtheng another than 16/44,1 sound bitstreaming in soundcard, but operating system doesn't chachge internal clock of it quartz, so 0404usb decoding at 44100 samples all files and break quality.
Sergey
 
Posts: 15
Joined: 25 Dec 2014, 06:51

Re: Samplerate problem on E-MU 0404USB

Postby Sergey » 11 Jan 2015, 18:01

http://mailman.alsa-project.org/piperma ... 79103.html
Same problem, reported to ALSA devels. If it posipble, please help me to fix it.
Sergey
 
Posts: 15
Joined: 25 Dec 2014, 06:51

Re: Samplerate problem on E-MU 0404USB

Postby Sergey » 16 Jan 2015, 17:44

ACX, please check it for avaliability to patch Yours disributive for people, who using 0202usb, 0404usb and other emu's usb snd cards.
I want to buy new DAC, but economic crisis in Russia are broke my plans, because all import goods cost more then 2 times higher, then 1 year ago, so i have to use 0404usb along Russian crisis is end, i don't progs developer, so i don't know, how to patch kernel, or other source code manipulation.
Sergey
 
Posts: 15
Joined: 25 Dec 2014, 06:51

Re: Samplerate problem on E-MU 0404USB

Postby ACX » 16 Jan 2015, 20:24

Hi Sergey, have you tried this workaround?
http://murga-linux.com/puppy/viewtopic. ... 547#745547
Unfortunatly we are almost useless with this, as we don't own any soundcard with those chips and we can't test it.
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: Samplerate problem on E-MU 0404USB

Postby Sergey » 17 Jan 2015, 17:06

Yes, it work. ACX, can You implement it in next release like a Cmedia fix? Tumbler "E-MU click fix" something one? I think all of user that old card be happy and be thankful to You, and all your comunity. It work not ideal and have lag, but much better then without it.
Sergey
 
Posts: 15
Joined: 25 Dec 2014, 06:51

Re: Samplerate problem on E-MU 0404USB

Postby ACX » 17 Jan 2015, 18:33

Please post here a 100% working script and the instructions to run it (has it to be run only once to fix the problem?), available for use to anyone who needs it, at least until we decide to integrate that into the UI (let's also see if other people ask for that before).
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: Samplerate problem on E-MU 0404USB

Postby Sergey » 18 Jan 2015, 06:58

I get script frpm web-site You listed above without any changes, named clock.sh, put it in "/home":

Code: Select all
#!/bin/bash

# if this is the first run, EMU-rate does not exist,create it
if [ ! -f /dev/shm/EMU-rate ]; then    # file does not exist
    echo "00" > /dev/shm/EMU-rate
fi


while : ; do
   mpc idle
   # stuff below executes when mpc is not idle

   sleep 0.4 # wait for actual track to start playing (fist 0,4 sec., to determine the sample rate)
   old_rate=$(cat /dev/shm/EMU-rate)
   # echo "old rate:$old_rate"
   sRateStr=$(cat /proc/asound/card1/stream0 | grep Momentary)
   # echo "full line: " $sRateStr
   cur_rate=${sRateStr:21:2} # here we get just the first two digits (44, 48, 96, etc.)
   # echo "cur rate:$cur_rate"
   # if $cur_rate is empty, next iteration ("continue")
   if [ -z "$cur_rate" ] # string is empty
   then
     # echo "No song playing"
     continue  # $cur_rate is null/empty, nothing to do, wait for next iteration
   fi

   # echo "Track sample rate: $cur_rate"
   if [ "$old_rate" = "$cur_rate" ]
   then
     # echo "The rates are the same"
     continue # rates are the same, nothing to do, wait for next iteration
   fi

   # here we actually compare rates and take appropriate action (change EMU clock rate using "amixer")
   # E-MU 0404 is visible as "card 1" on my system, i.e. it needs switch "-c1" for manipulation

   case $cur_rate in
   44)
   amixer -c1 set 'Clock rate Selector' 0
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   48)
   amixer -c1 set 'Clock rate Selector' 1
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   88)
   amixer -c1 set 'Clock rate Selector' 2
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   96)
   amixer -c1 set 'Clock rate Selector' 3
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   17)
   amixer -c1 set 'Clock rate Selector' 4
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   19)
   amixer -c1 set 'Clock rate Selector' 5
   echo "$cur_rate" > /dev/shm/EMU-rate
   continue
   ;;
   esac     

   echo "$cur_rate" > /dev/shm/EMU-rate

done


Then i create systemd service "clock.service", put it int "/etc/systemd/system":

[Unit]
Description=Samplerate EMU Fix

[Install]
WantedBy=multi-user.target

[Service]
Type=idle
RemainAfterExit=yes
ExecStart=/home/clock.sh


And install the service "systemctl enable clock.service"
So it startup with OS every time, and compare sound clock to set in alsa mixer right value for EMU USB card
Sergey
 
Posts: 15
Joined: 25 Dec 2014, 06:51

Re: Samplerate problem on E-MU 0404USB

Postby ACX » 18 Jan 2015, 17:48

Thank you, I edited your post with the proper CODE tag.
User avatar
ACX
RuneAudio co-founder
 
Posts: 1692
Joined: 29 Nov 2013, 02:25
Location: Udine, Italy

Re: Samplerate problem on E-MU 0404USB

Postby den_hr » 17 Feb 2015, 14:16

Geeez, that's my script!

Good to see it helps others!

I know it's been a heck of an ugly workaround, but, hey - it works (kind of)... :)

Every once in a while you might get a short "beep" as the track with a different sample rate starts to play, before the script kicks in and changes the sample rate... But, even that is a lot better than nothing.

BTW, I quite liked the sound of that E-MU 0404USB :)
Enjoy!

Denis
den_hr
 
Posts: 52
Joined: 06 Feb 2015, 17:10
Location: Croatia

support RuneAudio Donate with PayPal


Return to Bug report

Who is online

Users browsing this forum: No registered users and 2 guests