Thursday, October 4, 2012

Configuring the M-Audio (ICE1712 chip) Delta 44 for webSDR

Here is the steps I had to take to get my  M-Audio (ICE1712 chip) Delta 44 sound card working as a SDR input on a Ubuntu Linux computer.
Where can I get a Delta 44 sound cart interface for my SDR http://www.giga.co.za
or if you looking for softrock SDR you also can get it at  http://www.giga.co.za
Here is a picture of my configuration.






1) The Sound card has 4 input and 4 output ports but could only sample at 24-bit/96kHz full-duplex audio. This means I can only connect two softrocks lite II sound cards to my computer. 96kHz is a bit slow but this is all I can afford at the moment. (Need about 192kHz to display the full  40M band).

2) To configure the Delta 44 to be used for WebSDR was not so easy as I thought.

3) Ubuntu Linux is using  ALSA sound drivers for your sound-card interfaces and it took we a lot of reading to understand how it works.

4) My problem was that the webSDR server was only able to read ALSA devices defined as a 3 digit interface. (hw:[INT],[INT],[INT]) where INT must be replaced by integer values (0,1,2,3....) hw,[CARD],[DEV],[SUBDEV].

5) So I jumped right in and installed the Delta 44 card and needed to find out how to map the card input ports to (hw:[INT],[INT],[INT]) for the webSDR server to read the inputs. (to set the Delta 44 card audio levels run this command sudo envy24control) or a another good command is sudo pavucontrol

So the commands to list available ALSA sound input ports is as follows.



sudo arecord -l


**** List of CAPTURE Hardware Devices ****
card 0: M44 [M Audio Delta 44], device 0: ICE1712 multi [ICE1712 multi]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: IXP [ATI IXP], device 0: ATI IXP AC97 [ATI IXP AC97]
Subdevices: 0/1
Subdevice #0: subdevice #0

So the commands to list available sound output ports is as follows.

sudo aplay -l


**** List of PLAYBACK Hardware Devices ****
card 0: M44 [M Audio Delta 44], device 0: ICE1712 multi [ICE1712 multi]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: IXP [ATI IXP], device 0: ATI IXP AC97 [ATI IXP AC97]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: IXP [ATI IXP], device 1: ATI IXP IEC958 [ATI IXP IEC958 (AC97)]
Subdevices: 1/1
Subdevice #0: subdevice #0

So in my case the the M-Audio sound card is 0 and my build in motherboard card Card 1. So we need to find out what is the sub device for this card 0.(What I found is if you reboot your computer the cards mite swap but if you explicit name the card on it's name M44  and not 0 it will always use the correct card)
sudo arecord -L


Home directory /home/anton not ours.
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=M44
    M Audio Delta 44, ICE1712 multi
    Default Audio Device
front:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    Front speakers
surround40:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    4.0 Surround output to Front and Rear speakers
surround41:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=M44,DEV=0
    M Audio Delta 44, ICE1712 multi
    IEC958 (S/PDIF) Digital Audio Output
default:CARD=IXP
    ATI IXP, ATI IXP AC97
    Default Audio Device
front:CARD=IXP,DEV=0
    ATI IXP, ATI IXP AC97
    Front speakers
surround40:CARD=IXP,DEV=0
    ATI IXP, ATI IXP AC97
    4.0 Surround output to Front and Rear speakers
surround41:CARD=IXP,DEV=0
    ATI IXP, ATI IXP AC97    
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=IXP,DEV=0
    ATI IXP, ATI IXP AC97
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=IXP,DEV=0
    ATI IXP, ATI IXP AC97
    5.1 Surround output to Front, Center, Rear and Subwoofer speakersSo the IXP sound card is the one on the motherboard.

Ok I now have all the sound card info and need to configure the ALSA sound system environment to expose my sound card inputs as a 3 digit device.(eg hw:0,0,0 .....) I also have a additional requirement where I want to have multiple audio clients connect to the same input.
I want my SDR server to read the audio inputs and I also want my beacon / PSK monitoring application to monitor the SDR output. The sharing of the SDR output will have to be done by Linux application called jack.

The jack server will have to be configured to read SDR audio output and and allow the webSDR and other applications use the same audio stream.

configuring the ALSA file ~/.asoundrc or the /etc/asound.conf to define hardware audio interfaces.
The following options need to be configured in this file.

1) ALSA devices (hardware) and ALSA plugins (software).
2)  Device hw: and plughw: plugin give you access to the physical hardware. Both have as parameters the card (ID string or numerical index)
2) Control interface for the card.
3) Additional plugins for the card.
3.1) mixer, snoop , rate , lost more ......



ALSA recording device name for my M-Audio delta 44 (pcm.sdrM44Record) all 4 inputs
ALSA Playback device name pcm.sdrM44Play all 4 outputs


Here is my configuration file  ~/.asoundrc

#This configeration file is for sdr server pc.
#This pc has 3 sound cards
# 1) IXP motherboard (1 sterio input and 1 sterio output)
# 2) M44 M-Audio Delta 44 (4 mono inputs and 4 mono outputs)
# 3) Audiophile192 M-Audio Audiophile 192 (2 mono inputs and 2 mono outputs)

#************************** pcm definition ************************************
pcm.sdrMIXP_card{# interal sound card
        type hw
        card IXP #internal sound card
}
pcm.sdrM44_card {# defining the card to be used
     type hw
     card M44 # this has to be done to force reboot to point to same card
}
pcm.sdrAudiophile192_card {# defining the card to be used
     type hw
     card Audiophile192 # this has to the same as above to force reboot to point to same card
}
#************************* controle section ***********************************
ctl.sdrM44_card {#defining the control interface
     type hw
     card M44 # this has to the same as above
     }

ctl.sdrAudiophile192_card {#defining the control interface
     type hw
     card  Audiophile192 # this has to the same as above
     }

ctl.sdrIXP_card {#defining the control interface
     type hw
     card IXP  # this has to the same as above
     }

#******************************** channel dev *****************************
#        0 1   # front left
#        1 0   # front right
#        2 6   # rear left
#        3 7   # rear right
#        4 2   # center
#        5 3   # lfe
#        6 4   # side left
#        7 5   # side right

pcm.sdrM44_channel1 {#(only has 4 mono inputs/outputs)
    type plug #
    ttable.0.0 1 # studio monitor ...Delta 1 L
    ttable.0.1 1 # studio monitor ...Delta 2 R
#    slave.pcm ice1712
     slave.pcm pcm.sdrM44_card
}
pcm.sdrAudiophile192_channel1 {#(Only has 2 mono inputs/outputs)
    type plug #
    ttable.0.0 1 # studio monitor ...Delta 1 L
    ttable.0.1 1 # studio monitor ...Delta 2 R
    slave.pcm ice1724
}

pcm.sdrM44_channel2 {#(only has 2 mono inputs/outputs)
    type plug
    ttable.0.2 1 # studio monitor ...Delta 3 L
    ttable.0.3 1 # studio monitor ...Delta 4 R
    slave.pcm ice1712
}

#******************************** dmixer ***************************************
pcm.dmixer_M44 { # slave plugin dmixer
     type dmix
     ipc_key 4714
     slave {
     pcm sdrM440_card
     format S32_LE
     period_time 0
     channels 2 # 4 input
     period_size 512
     buffer_size 4096
     }
#     bindings {
#             0 0
#             1 1
#     }
}
#****************************** dsnoop ***************************************
pcm.dsnooper_M44 {
     type dsnoop #This plugin splits one capture stream to more streams
     ipc_key 4711
         slave {
         pcm sdrM44_card
         channels 2
         format S32_LE
         period_time 0
         period_size 512
         buffer_size 4096
        rate 96000
#       ttable.0.0 1 # studio monitor ...Delta 1 L
#       ttable.0.1 1 # studio monitor ...Delta 2 R
         }
         bindings {
                       0 0
                       1 1
         }
}
pcm.dsnooper_Audiophile192 {
     type dsnoop #This plugin splits one capture stream to more streams
     ipc_key 4711
         slave {
         pcm Audiophile192_card
         format S32_LE
         period_time 0
         period_size 512
         buffer_size 4096
         }
         bindings {
                       0 0
                       1 1
         }
}
#******************************* play ****************************************
pcm.sdrM44Play {# ouput
     type plug
     slave {
     pcm "dmixer_M44"
     }
}
#****************************** recording ***********************************
pcm.sdrM44Record { # input
     type plug
     slave {
     pcm "dsnooper_M44"
     }
}

pcm.sdrAudiophile192Record { # input
     type plug
     slave {
     pcm "dsnooper_Audiophile192"
     }
}


In webSDR I just add a device $pcm.sdrM44Record in place of $hw:0,0,0




I got the info from http://www.ruby-forum.com/topic/2162026


here is the jack configuration if you want to add jack.


pcm.jackplug {
 type plug
 slave { pcm "jack" }
}

pcm.jack {
 type jack
 playback_ports {
  0 pcm.sdrM44Play 

  
 }
 capture_ports {
  0 pcm.sdrM44Record

  
 }
}

I will add some more info as I get time.