Binary Revolution Forums: Recording with SoX - Binary Revolution Forums

Jump to content

Welcome to Binary Revolution Forums

Welcome to the Binary Revolution Forums! You are a guest and are welcome to browse our 7 public forums at the top of the list without registering. All other forums are restricted to registered users only and will give you an "unauthorized" message if you try to browse them. However, if you Register or Sign In (ABSOLUTELY FREE and PRIVATE) you will be able to access many more sections of the site that are reserved for registered members and have lots of other benefits such as bypassing those annoying ads.

  • NO ADS! All of the ads are for GUESTS ONLY!
  • The annoying guest message (this very one) at the top of every page will go away.
  • Access our private messaging system to communicate with other users.
  • Start new topics and reply to others instead of just reading.
  • Subscribe to topics and forums to get automatic updates on watched threads.
  • Add/view events to our community calendar.
  • Customize your profile and see your statistics.
  • Change your preferences such as choosing layouts and tweaking your settings.
  • Contribute your site to our database of links.
  • Access our Gallery and all of its features (instead of just viewing thumbnails) including uploading images of your own.
  • Build up your reputation using our reputation controls.
  • Once again: NO ADS! All of the ads are for GUESTS ONLY! It is all free so Register Now!
Guest Message © 2012 DevFuse
ANNOUNCEMENTS & NEWS:


ANNOUNCEMENT: BinRev is now proud to be hosted and affiliated with lunarpages! See the announcement at the top of the forums for more details.
ANNOUNCEMENT: Follow us on twitter: @binrev @stankdawg

NOTE 2011-11-11: post-dated! I will be getting married on 11/11/11 and will be unavailable for the rest of of November! Any forum issues should be directed to lattera. We apologize in advance for slow responses.

-- StankDawg

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Recording with SoX on two sound cards?? Rate Topic: -----

#1 User is offline   Coder(365) 

  • SUP3R 31337
  • Icon
  • View blog
  • Group: Members
  • Posts: 171
  • Joined: 31-July 04
Reputation: 0
Neutral

  Posted 16 April 2008 - 10:55 PM

I'm building a streaming and recording server for a local volunteer group. I've been trying to find a way to either...

... record audio from the sound card, process it and stream it

OR

... record audio on one card, process and save. and use the other sound card for streaming (2 cards needed).


I've come to the conclusion that option 2 is the best route, and I've began to tailor my shell script towards that. But... I've run into a snag.


Here's the issue.

I can't find a way to specify the device for SoX to use when recording. Any Ideas?

rec -t wav -q - silence 1 1 10% -1 7 2% | lame -S --resample 11025 -b 24 $file_prefix-$date.mp3 &
sleep 2
rec -t wav -q - | lame -S --resample 11025 -b 24 - - | ezstream -c /hamradio/scripts/stream.xml &

0

#2 User is offline   ntheory 

  • data pillager
  • Icon
  • View blog
  • Group: Agents of the Revolution
  • Posts: 1,750
  • Joined: 14-April 03
Reputation: 0
Neutral

Posted 17 April 2008 - 09:36 AM

Any success doing things the Unixy way and using "cat" to fetch the audio from the soundcard and then to write it back?

Although when you do something like this:

cat /dev/sound/dsp0 | magic-sound-processing-scripts > /dev/sound/dsp1

I'm not sure how you set the sampling rate or if there's an implied rate of the sound card's maximum rate (44.1KHz or 48KHz). You may have to write a simple C program that can set the rate and then pump STDIN to/STDOUT from the sound card.
0

#3 User is offline   Coder(365) 

  • SUP3R 31337
  • Icon
  • View blog
  • Group: Members
  • Posts: 171
  • Joined: 31-July 04
Reputation: 0
Neutral

Posted 17 April 2008 - 03:50 PM

Actually it helped out a lot.

If I change the code to this (below) it works great!

Thanks NotTheory!

rec -t wav -q - silence 1 1 10% -1 7 2% | lame -S --resample 11025 -b 24 - /hamradio/audio/$file_prefix-$date.mp3 
cat /dev/dsp1 | rec -t wav -q - |lame -S --resample 11025 -b 24 - - | ezstream -c /hamradio/scripts/stream.xml


I took the "sleep 2" out because it wasn't needed.

Edit: I removed the ampersand from the end of each command so the forum would parse it correctly. For those that don't know the ampersand ( & ) puts the command into the background.

This post has been edited by Coder(365): 17 April 2008 - 03:54 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


  • Time Now: Feb 10 2012 08:38 PM