Boxed DVS System for Djs (XwaX on C1)

Moderators: mdrjr, odroid

Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Sun Mar 08, 2015 5:59 pm

Since i have finally been able to get my usb soundcard working without xruns and good latency i have gone ahead with my project.

I will be updating this thread as i moove forard with it as right now i just have had time to get the software part running.

my intention is to box the soundcard, the C1 and a 7" tft screen in a case i will prepare with the buttons + rotary encoder, connected through the gpio pins, i need to control the program without the need of a mouse or keyboard, as i have setup the system to launch my startup script at boot. everything will be conected in the inside, and i will make the appropiate connections in the box exterior to make it as much plug and play as possibe in a dj booth. Basically just route the turntable/cd player output into the box and route the sound into the mixer from there.

Hardware im using at the moment.

Odroid C1
Traktor audio 6 usb soundcard
HDMI input Lcd Controller Board VS-TY50-V2 and a 7inch 800x480 AT070TN93 V.2 Lcd panel

allen heath xone:1d midi controller, this is temporary till i get all my casing with buttons done

setting up the Software

Im using a 1.3 ubuntu image with a .71 kernel... nothing fancy, standard procedure.

Code: Select all
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get upgrade


then i installed the xwax program which the latest version is already in the multiverse repository:

Code: Select all
sudo apt-get install xwax


the hardest part has been getting the soundcard to work properly, due to the odroid being picky with the sound capture settings and freezing... and once working getting the correct period_size and buffer size to get good latency and no xruns. Unfortunately due to the boards input limitations i was not able to use the 3 stereo pairs without getting4 flooded by xruns so i had to stay in 2.

here is the thread about that: viewtopic.php?f=112&t=9424

and here my final /etc/asound.conf file that im using:

Code: Select all
     
pcm.T6_capture {
                type dsnoop
                ipc_key 1646
                slave {
                        pcm "hw:1"
                        period_time 3
                        period_size 128
                        buffer_size 16384
                        rate 48000
                        channels 6
                }
        }

 pcm.T6_playback {
                type dmix
                ipc_key 1646
                slave {
                        pcm "hw:1"
                        period_time 3
                        period_size 128
                        buffer_size 32768
                        rate 48000
                        channels 6
                }
        }

 pcm.T6_duplex {
                type asym
                playback.pcm T6_playback
                capture.pcm T6_capture
        }

pcm.T6_pair1 {
                type plug
                ttable.0.0 1.0
                ttable.1.1 1.0
                slave.pcm T6_duplex
        }

pcm.T6_pair2 {
                type plug
                ttable.0.2 1.0
                ttable.1.3 1.0
                slave.pcm T6_duplex
        }

 pcm.T6_pair3 {
                type plug
                ttable.0.4 1.0
                ttable.1.5 1.0
                slave.pcm T6_duplex
        }



So now i can call the program the following way:

Code: Select all
sudo xwax -r 48000 -a T6_pair2 -a T6_pair3 -l /home/odroid/music


the -r 48000 part is important to get better preformance as my card doesnt like other rates and doesnt preform as well. but i will get to my whole command later on the script.

next thing i did was adding a line to /etc/sudoers so i could sudo without the need of giving a password, so i dont need a keyboard

Code: Select all
sudo visudo

## add the following line at the end of file

odroid  ALL=(ALL) NOPASSWD:ALL

ctrl+k
x


then i compiled a c program i made to inject keyboard presses when it reads midi notes.

u can get it here: https://github.com/ximae/XwaX-midi-hid-control

this is temporary till i finish the gpio program and get my hardware parts to get it working though.

next step is to set up the startup scripts that launch xwax with all the correct settings and music folders and launches my midi to hid control app.

TBC....
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Fri Mar 13, 2015 11:04 pm

Ill continue with the startup scripts part when im done tweaking them........

but now im busy with all the goodies i bought for the project :D

Image


With the binary encoder chips and the rotary encoder i have now been able to finish my gpio control program and get it working, at least on the breadboard testing.

The first tries i did with the programming the gpio button to keystroke program using wiringpi i noticed how i could only get 8 pins reading interrupts, so i went through the datasheet and read C1 has only 8 interrupts assigned to gpio, and i needed plenty more than that. I also noticed how cpu load was very high, and there shouldnt be any load. I was then told by macemoneta that c1 wiringpi really is polling at a very fast rate.... he showed me how to lessen thr poll rate to drastically drop the load, thx again man.

Anyways i had already devised a plan to sidestep the 8 interrupt limitation through a simple combinatory logic circuit, whith which i would be able to read 16 switches just using 4 pins and also lessen considerably the cpu load. My plan was to use a 16 to 4 priority binary encoder, to attatch each switch to an input to generate a 4 bit code that the software would interpret to launch the corresponding function. There is also a rotary encoder attached but i cant take any merit there as i am basically using someone elses library.

i have uploaded the code to :

https://github.com/ximae/XwaX-Gpio-hid- ... y-encoded-

though ill probably be still tweaking a thing or 2. But the code itself, which is probably sloppy as im a noob programmer is sort of future proof as it uses the interrupt functions (which arent so at the moment) and bypasses the 8 interrupt limit with the encoder. So if the gpio interrupt driver is eventually fixed and the wiringpi code siwtched back to its original interrupt state, it should work even better without any modification.


As for the hardware part of the circuit, its a standard 16 to 4 binary encoder (which is documented online and easy to find) made out of 2 cascaded 74HC148 8 to 3 bit encoders (the HC part is important so it can work in 3.3v) and a 4 gate 2 input nand chip 74HC00. rest of the chips are just arrays of resistors to make the pullup for the switches, which is mandatory since they are not connected to pins. Add to that some sockets for the chips, a strip board and cables.

I might post a diagram if i have spare time to create the circuit in kicad and render it.



now its soldering and case modding time.....
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Wed Mar 25, 2015 2:54 am

I am almost done now.... need to resolder ome of the wires that broke while ramming verything into the case since its so tight and tweak a bit the software so one of the functions that rescans the music folders mounts sda1 ( usb stick) so i can hot swap them.... and give it a few hours test with some loud speakers and some beers XD.

here are some pics of how it has ended looking up....

insides

Image

Image

i hadnt mentioned it before but im taking the power from an old usb-sata power source which i stripped out conected it to a switch and soldered type of jack for odroid power in, it outputs a nice 2.5 amps at 5v + another 1.5 amps at 12v which i dont use.

outsides

Image

Image
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby K3nn3th » Wed Oct 12, 2016 7:59 am

Hello there,

great project youre doing!
regarding your xruns, have you tried using a realtime patched kernel?
it would allow a lot lower latencies.

best regards,

K3nn3th
K3nn3th
 
Posts: 1
Joined: Wed Oct 12, 2016 7:56 am
languages_spoken: english

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Tue Oct 25, 2016 4:36 pm

thx kenneth,

well the project was finished more than a year and a half ago, but i had to make a few changes and i just ddnt update the thread.

the xruns i solved simply with alsa parameters customizing the asound.conf file ( its pasted n the first post i think) with the lower buffer and period size, could be the tracktor sound card that was finicky, maybe its easier on other soundcards.

I was testing this with a rpi2 at that moment and i did try an rt kernel, but the solution was worse or maybe i did something wrong as the gui was unresponsive/veeerryy slow stuck on hold by all the rt audio. ( i believe xwax gui is not a rt thread).

Ill go ahead and make another post updatingthe changes.
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Tue Oct 25, 2016 5:15 pm

Project Update and previous ndocumented changes.

My little dvs has been working very well for the las year and a half as i have been taking it out on gigs but i did have to make a few changes in the months fllowing, so ill write about that here.

but before that a little vid (badly recorded by my mobile phone in my shaky hand) of it working.

https://www.youtube.com/watch?v=bCt9D7NgbL0


While the odroid c1 is a great machine compared to the rpi2 on the processing-multimedia level but its behind on the gpio part. It has only 8 available interrupts and if ur using both edges, then half. That was the main reason I went with the binary decoder aproach to be able to run all the switches from just interrupt driven functions, i was trying not to poll for better resource management. I ran into a problem though, im not sure if it was some em noise or just some bad soldering on my part, but ocationaly the circuit would send the wrong signal and th program would read a button press wrongly, calling another function.

Finally i just decided to just remove the circuit and just do a standard button setup of one gpio pin input per button (with its physical resistor). this meant i had to modify my code to use all the available interrupts and just poll the rest of the gpio interrupts. Since i was at it i tiedied up a bit the innards of the box using shorter cables and using two smaller but linked stripboards (closer to the switches) connected with a 40 pin connector+flat cable.

Another issue i was having was the lcd screen wouldsometimes take quite a while to light up since i was feeding its needed 5v through a usb port, so i just soldered it into the input 5v line that cmes from the power source.

I dont have pics of those 2 modifications though, sorry.

There are a couple of issues still present, but they are just because of me being lazy and not fixing them:

1: sometimes the sd card where i store the music will change name resulting in not loading the music library, i could just alias it... its so seldom i just change the path coz im in dj mode, not geek mode.

2: my importer script will fail loading xwax if the root music folders have innapropiate characters like spaces, because i didnt do any error detection in the script to solve that.... so im just carefull naming the folders XD.

Ill try to update the new code soon.

and post the startup scripts etc.
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Thu Oct 27, 2016 12:21 am

I have uploaded my newer xwax control program to github, _I actually have modified it a bit for easier understanding and modification by thirds, yeah im messy :D

https://github.com/ximae/xwax-control-gpio

additional info:

added this line to /etc/sudoers:

Code: Select all
odroid ALL=NOPASSWD: ALL


added this line to /etc/security/limits.conf

Code: Select all
 odroid - rtprio 80


added these lines into /home/odroid/.config/lxsession/Lubuntu/autostart.

Code: Select all
@lxterminal --command "/home/odroid/Scripts/xwaxcontrol"
@lxterminal --command "/home/odroid/Scripts/startxwax"


scripts:

/home/odroid/Scripts/xwaxccontrol

Code: Select all
#!/bin/sh

cd /home/odroid/Scripts
sudo ./xwaxcontrol


/home/odroid/Scripts/startxwax

Code: Select all
#!/bin/sh
   
     sudo mount /dev/sda1/media/odroid/usbdrive
   
    sleep 3s

    cd /home/odroid/music
    sudo  ls -p | grep "/" > "dir.txt"
    PA=" $(pwd)/"
   
    PLAYLISTS=
    while read P; do
        PLAYLISTS="-l $PA$P $PLAYLISTS"
    done <dir.txt
     
 xwax -r 48000 -a T6_pair2 -a T6_pair3 -g 800x480 $PLAYLISTS -l /media/odroid/usbdrive -t serato_2b -t serato_cd -t serato_2a

ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Tue Nov 22, 2016 6:30 am

ximae wrote:Project Update and previous ndocumented changes.

There are a couple of issues still present, but they are just because of me being lazy and not fixing them:

1: sometimes the sd card where i store the music will change name resulting in not loading the music library, i could just alias it... its so seldom i just change the path coz im in dj mode, not geek mode.

2: my importer script will fail loading xwax if the root music folders have innapropiate characters like spaces, because i didnt do any error detection in the script to solve that.... so im just carefull naming the folders XD.


I have solved these 2 issues with a new startup script.

I am now unmounting and then mounting the sd card to a fixed place so it never changs.

I have changed the music folder scanning loop so it doesnt read and write to a file, detects if the item is a folder and then adds double quotes to each path so it preserves the spaces or illegal characters.

Also added a few extra flags to the xwax start command.

Code: Select all
#!/bin/bash

sudo umount /dev/mmcblk1p1
sudo mount /dev/mmcblk1p1 /media/odroid/music
sudo mount /dev/sda1 /media/odroid/usbdrive
   
sleep 3s

PLAYLISTS=
for P in /media/odroid/music/music/*; do
    if [ -d "$P" ]; then
     PLAYLISTS="-l \"$P\" $PLAYLISTS"
    fi
done

echo "         "
echo "Crates: "$PLAYLISTS
echo "         "

lxterminal --command="xwax -r 48000 -m 4 -k -q 80 -g 800x480 -c -t serato_2b --phono -a T6_pair2 --line -a T6_pair3 -l /media/odroid/usbdrive $(echo $PLAYLISTS) -t serato_2a -t serato_cd"
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby odroid » Tue Nov 22, 2016 9:52 am

Good to know you made more robust DVS system.
Thank you for sharing the solutions. :D
User avatar
odroid
Site Admin
 
Posts: 23663
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby rooted » Tue Nov 22, 2016 10:03 am

If you used UUID instead of the dev entry you wouldn't have the drive change issue.

Very interesting setup.
User avatar
rooted
 
Posts: 3652
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Tue Nov 22, 2016 9:56 pm

Thx for the replies.

If you used UUID instead of the dev entry you wouldn't have the drive change issue.


but can you access/browse folders in disks through uuid?

I though it was for mounting them, which i previously wasnt doing and just relying on the systems automount. Which is why the sd card was sometimes being mounted differently and the script path would fail. Now I added the unmounting and remounting to the script, yeah still not using uuid but /dev/ but there should not be any problem as that sd card is fixed ( i never remove it) and it just has one partition so it should always be the same.

am i missing something?
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby rooted » Wed Nov 23, 2016 2:47 am

Nope, your way is just fine.
User avatar
rooted
 
Posts: 3652
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby Tabularasa » Sat Dec 10, 2016 9:54 pm

Hi,

I'm trying to get a similar project running on a C2 with a Traktor Audio 10 (T10).
Unfortunately I could not manage to tune the .asoundrc to a point of getting no xruns with xwax (not even with 1 channel).

I tried several settings based on the .asoundrc you posted here but the buffer_size seems to big. With buffer_size 32768 and buffer_size 16384 xwax fails to detect the pitch correctly. I have to go down to buffer_size 512 for correct pitch detection.
Using binding on dsnoop and dmix to reduce the channel count to 6 as on you T6 helps but the best I could achieve was about 5-10 seconds of playback with a pop or click in the playback (even if xwax does not show any xruns).

Could you share the .asoundrc you are using on you C2 or do you have any other tips? Did you have any other usb devices connected during playback? It seems that dwc_otg is flooded with interupst on my C2 but I cant find the root cause.
I also connected the T10 on the USB OTG port but it did not improve the performance

Best regards,
Martin
Tabularasa
 
Posts: 11
Joined: Wed Dec 07, 2016 6:50 am
languages_spoken: english, german
ODROIDs: C2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby ximae » Sat Dec 17, 2016 2:36 am

Hi tabularasa.

im running this on a c1 not a c2. But i do have a c2 where i tested running a 3 deck setup. I used the same exact asound.conf file and did not have xruns, but i had the same issues with clicks n pops.

I think it is mostly related related to the usb ports, used the normal ones and ive read around here that alot of people are having issues with those and usb soundcards. btw I also tried a generic 1 channel class compliant usb card and it has the same issue...

I thought that just running through the micro usb port with an otg cable ( i dont have one atm) would solve it. Do you have a normal single channel soundcard you can test there to see if its the port or the t10 soundcard configuration?

im mostly inclined to think its something with the c2 usb ports more than the soundcard config, coz you probably have tried many different buffer sizes without any noticeable change, and its not normal that a standard usb class compliant card has this sort of issues.

I would open a new thread about you issue in the c2 forum section and see if some of the devs can help you out.

on the c1 i can run the t6 without any problems reading music from a pendrive + a mouse and keyboard conected.... ( i connect the t6 through the micro usb so its a different usb bus)
ximae
 
Posts: 118
Joined: Sat Jan 10, 2015 3:16 am
Location: spain
languages_spoken: english, spanish
ODROIDs: c1 and c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby Tabularasa » Mon Dec 19, 2016 11:54 pm

Hi Ximae,

Thanks a lot for your reply.
Unfortunately I have no single channel usb device available for testing. I connected the T10 on the USB OTG port but still get around 6 pops and clicks a minute at best with xwax.

A realtime kernel on Odroids Ubuntu perfromed even worse (hundred of xruns per minute). I achived slighlty better performance with Armbian but still didn't get it working 100%.

I used aplay to play a sinewave on my split channels set-up (T10_pair2, T10_pair3, ...) and the playback is fine. I gueess the pops and clicks is somehow caused by the combination of dsnoop/dmix and xwax's "m" parameter.

Next week I will have the ability to get my hands on on a Traktor T4 where the channels are available as sub-devices. This way I could run xwax without dsnoop/dmix and hope to gather more knowledge about possible root causes.

Best regards,
Martin
Tabularasa
 
Posts: 11
Joined: Wed Dec 07, 2016 6:50 am
languages_spoken: english, german
ODROIDs: C2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby Tabularasa » Wed Jan 11, 2017 5:56 am

I tested my C2 with an Audio 4DJ and it works like a charm. I can get xwax down to 3ms latency with the Audio 4DJ connected to the USB hub while keyboard mouse and a usb hard drive are connected in parallel.
So it's good to know that it's probably not a hardware issue of the C2 that the Audio 6&10 do not work properly. I will now concentrate on the Audio 4 DJ and will try to do a similar build.

Did you use any specific buttons (like arcade buttons) and are there any things that you would change on the user interface in future revisions?
Tabularasa
 
Posts: 11
Joined: Wed Dec 07, 2016 6:50 am
languages_spoken: english, german
ODROIDs: C2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby gregski » Thu Apr 06, 2017 4:08 pm

Hi fellow dj's


I am on the odroid c1+ trying to get it working with Audio 4 dj ( a little project - gift - for my nephew ). Since I have all required hardware, I was trying to get it up and running but the xwax is not starting. I am assuming it is due to /etc/asound.conf not being edited. Would you be able to assist me with this one?
My hardware / software setup is:
odroid c1+
NI audio 4 dj
generic hdmi display for now ( will order a 8inch touch screen from odroid later as soon as I will get the machine working)
2x vestax pdx 2000 turntable
serato timecode vinyl

the odroid is running ubuntu 16.04-2 mate from official website.
Like I mentioned - it is a clean install with no modifications to files / config files.
Thanks in advance for your help and keep up the great work! The odroid machines are great!
gregski
 
Posts: 2
Joined: Thu Apr 06, 2017 4:00 pm
languages_spoken: english
ODROIDs: c1+, c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby Tabularasa » Wed Apr 19, 2017 5:08 am

Hello gregski,

you don't need to create an .asoundrc for the Audio 4 DJ, just use plughw:1,0,0 and plughw:1,0,1 as alsa devices for xwax.
Don't forget to modifiy /etc/security/limits.conf to allow you user realtime priority.
Tabularasa
 
Posts: 11
Joined: Wed Dec 07, 2016 6:50 am
languages_spoken: english, german
ODROIDs: C2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby gregski » Thu Apr 20, 2017 5:15 pm

Thanks! works like a charm! you mentioned priorities for realtime, could you post your config, I am just not sure how to use the limits.conf file. Cheers!

EDIT: found this : http://wiki.xwax.org/setting_up_real_ti ... y_for_xwax - would that be enough to get it smoothly running?
gregski
 
Posts: 2
Joined: Thu Apr 06, 2017 4:00 pm
languages_spoken: english
ODROIDs: c1+, c2

Re: Boxed DVS System for Djs (XwaX on C1)

Unread postby Tabularasa » Fri Apr 21, 2017 4:53 am

This looks good. You can also configure memlock - unlimited. I'm not sure if it's necessary for your setup. I think you need it with the -k option of xwax.
http://www.jackaudio.org/faq/linux_rt_config.html
Tabularasa
 
Posts: 11
Joined: Wed Dec 07, 2016 6:50 am
languages_spoken: english, german
ODROIDs: C2


Return to Projects

Who is online

Users browsing this forum: No registered users and 1 guest