LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 09-02-2011, 10:35 PM   #1
JDCoder
LQ Newbie
 
Registered: Feb 2011
Posts: 3

Rep: Reputation: 0
tvtime and sox (automate both with one shell)


This shell starts both tvtime and sox and closes both when tvtime is closed. It will not allow two instances to run.

Not something of great need, but for a lazy person who enjoys watching tv on his Linux laptop (just for fun), it is convenient.
I am running PCLinuxOS with a Pinnacle Systems PCTV USB2 card. Having to run sox separately became annoying,
so I wrote this small shell to run both and close both when tvtime is closed.

_____________________________________________________________________
#!/bin/sh

# Possible names for the shell: tvtime.sh or tvtime_sox.sh

# Automate tvtime and sox with this shell script
#
# opens both together and closes both together
# add to menu or create desktop launcher to run
# make shell script executable: chmod +x tvtime.sh

#Exit if already running
if [ -n $(ps -C "tvtime") ]; then
exit 0
fi

#Run sox in separate background thread/process
#parms: -q = quite: do not display under-runs
# -t = audio device type (maybe different for your install)
# hw:1,0 = hardware device number (1,0): may be different for your
# install
# -d = use default output audio (works for me)
# -G = use temp files to prevent clipping
# & = run in background: different terminal/thread
#If you have a sox command that works for you (incase this one does not)
#replace the following with your version. Remember to add the ampersand
# to the end
#$(sox -q -t alsa hw:1,0 -d -G) &
$(sox -q -t alsa hw:1,0 -d) &

# Note: I tested the above sox command on a different computer with an Aver TV Go 007 FM Plus.
# The -G option (guard against clipping) blocked the sound. I removed the -G option and there was
# sound.

#Run tvtime in this thread and wait until closed
$(tvtime)

#After tvtime is closed, get the sox PID: used to close/kill sox
#ps is used to get the sox process/proc information
#set is used to parameterize the ps results
#look for the sox pid under this shell and make it parameter $1
set $(ps -C sox --pid "$$" | grep -h sox)

#$1 now contains the process id of sox, if sox is active: $1 will not be
# null
#kill sox, if active
if [ -n $1 ]; then
kill -HUP $1
fi

exit 0
___________________________________________________________________________

Last edited by JDCoder; 09-03-2011 at 03:23 AM.
 
Old 02-15-2013, 06:37 PM   #2
lshantz
LQ Newbie
 
Registered: Oct 2011
Location: Phoenix, AZ
Distribution: Opensuse
Posts: 19

Rep: Reputation: Disabled
Bump!

Okay, here is my tail of woe, and it relates to the above. I have used Opensuse with Tvtime for 2 years. Back when I set it up initially, I had a heck of a time getting sound. Finally figured it out, made the changes and all was well. Until a week ago. My main boot disk with /, and /home went bad. The good news I was backed up. The bad news is, I was not backed up 100%. So a restore left we with a borked system. I ended up doing a fresh install, and the Tv did not work at all. I then took my old /home and restored it. Voilla! TVtime working again. After 2 days, I felt it was time to do my daily rsnapshot backups, and needed the room, so deleted my backups. BAD idea! For some unexplained reason, now all of a sudden, TvTime is back to no sound.

I'm pretty sure that to get it working, I had to do some wizardry with sox, but I forget the details. Can one of you smart guys help me to get this working again? The above does not work for me.

I have an Intel DX58SO MB. I have an older Hauppaugge Tv Tuner. BT878. I have taken the audio output on the card, and put a cable from there to my line in on the motherboard. (I'm almost positive there is a way to do it via bridging without the cable, but I don't care at this point) I have provided the info below in hopes that someone can say, hey stupid, you just do sox x blah.

The pulse audio controller shows the output device as "internal audio analog stereo, with the port at analog output. Input devices shows, internal audio analog stereo, with the port as analog line-in. The Bt878 capture analog stereo shows port: analog video. The configuration shows internal audio with a profile of analog stereo duplex. Bt878 audio capture profile: Analog stereo input. ??? Anybody?

arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC889 Analog [ALC889 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC889 Analog [ALC889 Analog]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
card 1: Bt878 [Brooktree Bt878], device 0: Bt87x Digital [Bt87x Digital]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: Bt878 [Brooktree Bt878], device 1: Bt87x Analog [Bt87x Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
 
Old 02-15-2013, 06:48 PM   #3
lshantz
LQ Newbie
 
Registered: Oct 2011
Location: Phoenix, AZ
Distribution: Opensuse
Posts: 19

Rep: Reputation: Disabled
Well hot dang!

Funny how sometimes when you write it all down and sit back and look at things it makes some sense! I started experimenting with different combinations.

sox -S -t alsa hw:0,0 -d -G
^^ verbose

When I hit 0,0 bam!!! It is working. However, my volume control within TVtime does NOT work. It just shows zero. I could still (and hundreds of others) Could sure use some help on this too.
 
Old 02-16-2013, 11:14 AM   #4
lshantz
LQ Newbie
 
Registered: Oct 2011
Location: Phoenix, AZ
Distribution: Opensuse
Posts: 19

Rep: Reputation: Disabled
Well, as I learn more... it seems that the sox command may not be needed for all users. At one point I found that xfce4-mixer would allow me to activate the sound via the menu. It is a very nice gui interface. Once I did that, I got an echo, and once I killed sox, it was working! Then all of a sudden xfce4-mixer disappeared. I was able to get it back via root, but now it goes away in root too. ?? Don't know why. Still no volume control via TvTime! I had hoped that with xfce4-mixer I would be able to tweak it and get this working too.

So if anyone can shed light on why xfce4-mixer won't load anymore that would be great. Here is the error message:

xfce4-mixer --gst-debug-level=1
xfce4-mixer: Failed to initialize xfconf: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
 
Old 02-17-2013, 09:33 PM   #5
madhank65
LQ Newbie
 
Registered: Feb 2013
Location: somewhere in Ohio
Distribution: UE 3.5 and ZorinOS8. W7 for Media Center only
Posts: 7

Rep: Reputation: Disabled
This is sort of quote of JDCoder but thought I'd skip all that text. So, the only reason I use windows is watching (or listening) to broadcast TV while I work. Linux don't like my dongle evidently (tried lots of options, even wine); so any way going to look into Pinnacle Systems. Any one suggest a possible program that will run ASTC dongle? I'm being lazy eh? Also heard Happhauge cards will work.. I'm the only window user in the home, wife and teen girl all use SolusOS (Debian). Using ZevenOS via VB right now but rather run 1 system.
 
Old 03-21-2013, 01:05 AM   #6
lshantz
LQ Newbie
 
Registered: Oct 2011
Location: Phoenix, AZ
Distribution: Opensuse
Posts: 19

Rep: Reputation: Disabled
Well I'm back...

Same issue... no sound with TvTime. I upgraded my Motherboard, so I am having to start over. You'd think I would have documented carefully what I did last time, but nooooo... so now I get to learn all over.

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC898 Analog [ALC898 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC898 Digital [ALC898 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0

However using the command of:
sox -S -t alsa hw:0,1 -d -G

hw:0,1: (alsa)

Encoding: Signed PCM
Channels: 2 @ 16-bit
Samplerate: 48000Hz
Replaygain: off
Duration: unknown

In:0.00% 00:00:03.50 [00:00:00.00] Out:164k [ | ] Clip:0
Aborted.
but no sound..

Tvtime -v shows in part:
mixer: Can't open device default, mixer volume and mute unavailable.

Can anyone give me an idea of where to go?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it Possible to Automate this Procees using shell script!! anishkumarv Linux - Newbie 8 05-20-2011 08:22 AM
sox package, Slackware 13.1, fails on sox 1.wav -e stat burbabro Slackware 1 05-04-2011 03:26 AM
mp3 conversion using sox automate with cron robteks Linux - Software 3 07-18-2008 04:46 AM
shell command logging for SOX compliance linuxguy99 Red Hat 1 05-03-2007 01:01 PM
LXer: Speaking Unix, Part 6: Automate, automate, automate! LXer Syndicated Linux News 0 01-04-2007 10:54 AM


All times are GMT -5. The time now is 11:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration