LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-13-2009, 04:55 AM   #1
ralfbutler
Member
 
Registered: Jul 2009
Posts: 38

Rep: Reputation: 18
Split on the fly mic stereo into two mono files


Hi,

Currently I record mic input like this
PHP Code:
arecord -f cd -t raw oggenc - --o audio.ogg 
However, I was wondering if I could split the mic stereo input in two mono files on the fly via the terminal (no X installed)? Doesn't need to be ogg. mp3 is fine as well.

Has someone an idea?

Thank you,
Ralf

Last edited by ralfbutler; 12-13-2009 at 04:57 AM.
 
Old 12-16-2009, 08:03 AM   #2
kubaPL
LQ Newbie
 
Registered: Apr 2009
Location: Poland
Distribution: Fedora
Posts: 6

Rep: Reputation: 0
okay, my idea is a little on the crash side, but it just might work.

i haven't implemented a full implementation but i have implemented a basic framework that you an adjust to your needs.

basically the idea is as follows. arrows indicate pipes and the numbers indicate processes

1) arecord (from mix in a format ffmpeg understands) ----> tee left ----> tee right

2) cat left ----> ffmpeg (throw away right and maybe compress)

3) cat right ----> ffmpeg (throw away left and maybe compress)

left and right are both fifos created using mkfifo.

basically i tested this in the following manner:
- created left and right fifos using mknod
- created single file called containing "ababababababababbbababbabab" to represent the left and right audio data
- created script that starts both left and right fifo readers that will "encode" the data.
- streamed "audio data" to both left and right fifos using cat.

--- file "stream" ---
aaabababababbbabababbabababababbababbababababbababa
--- end file ---

--- file "readlr.sh" ---
#!/bin/bash

cat left | sed -e "s/[^a]//g" &
cat right | sed -e "s/[^b]//g"
--- end file ---

in one console i ran readlr.sh first
$readlr.sh

and then in second console i ran the "streamer"
$ cat stream | tee left | tee right

the output on the reader console was as follows
$ ./readlr
aaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb

how you will split the left from the right is up to you. i would probably use ffmpeg and try to eliminate a channel using channel mappings and setting the max number of channels to one. i don't know if this will work as expected but that's where i would begin. you might find that ffmpeg will just downmix both channels into one which is obvious not what you want.

if you get this working, please post a solution as i'm sure others would appreciate that.

good luck.
 
Old 12-16-2009, 01:35 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
$ sox stereo_input.wav output_left.wav mixer -l
(avg -l on older versions)

$ sox stereo_input.wav output_right.wav mixer -r
(avg -r on older versions)

Not on the fly. But it's possible. Some applications let you record each channel individually. Just most cli based ones would require you to launch separate applications to record both channels individually at the same time. Leaving you with an unknown latency between channels, if you ever needed to seemlessly rejoin to a stereo image. Sox lets you do the extraction in post, seemlessly, so it really depends on how on the fly you need things to be.
 
  


Reply



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
alsa - averaging stereo to mono for speaker output bdjnk Linux - General 0 08-18-2009 02:38 PM
configuring ALSA for stereo to mono ubercow Linux - Software 0 05-13-2008 07:05 AM
Xitel Pro Hifi-link playing mono, not stereo (Fedora Core 6) mojones Linux - Hardware 2 12-11-2006 08:12 AM
how to convert stereo mp3 to mono wav? Beck24 Linux - Software 2 07-11-2006 08:04 PM
Alsa stereo to mono mix kdogksu Linux - Software 1 11-30-2005 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:52 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
Open Source Consulting | Domain Registration