WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: sound extensions and recording your soundcards output  (Read 5562 times)

Offline cast-fish

  • Hero Member
  • *****
  • Posts: 1000
  • hi there
sound extensions and recording your soundcards output
« on: November 27, 2012, 05:12:17 PM »
Hello

does anybody know the command to make the MPG123 extension "record" what sound
your soundcard is making.?

It works great for playing web music streams and i think there is a command to "dump"
those mp3 streams to mp3 file at the same time as listening to them (what is that commandf?)



But also it would be great to be able to record the actual sound from the soundcard
at any time in question...

OR

what is the command to make MPLAYER record whatever sound your soundcard is making
to an mp3 file.

thanks

V.

Offline cast-fish

  • Hero Member
  • *****
  • Posts: 1000
  • hi there
Re: sound extensions and recording your soundcards output
« Reply #1 on: November 29, 2012, 08:01:05 AM »
Hello

yes

Aus...that's not really what i want to do.

As the post says, i want to record *any* sound that my soundcard is making at any particular time  (regardless of if it's audio streams or whatever). I already pretty much know how to dump streams using Mplaye. Yes, stream ripper is also fine

I just want a generic way of recording *any* sound that my soundcard is making.

This is ironically pretty difficult to discover how to do.  So strange, as it's the first thing you would
want any "Sound recording APP" to be able to do..(record the computers realtime sound)....

Audacity can do it...but i wanted a simple dedicated command line tool....that recorded the soundcards output to mp3 file   ("arecord")  .

There are many"command line apps"  for win32 that do it.....

Thanks

Vince.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1026
Re: sound extensions and recording your soundcards output
« Reply #2 on: November 29, 2012, 10:10:57 AM »
hi friends,

there are a couple of tiny recording tools...
perhaps you want to give sox with the help of lame a try?

sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - ./test.mp3

i´ve found that hint at
http://linuxfocus.berlios.de/English/March2001/article178.shtml


Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11020
Re: sound extensions and recording your soundcards output
« Reply #3 on: November 29, 2012, 12:04:05 PM »
If audacity can do it, then arecord can too, you just need the right device name.
The only barriers that can stop you are the ones you create yourself.

aus9

  • Guest
Re: sound extensions and recording your soundcards output
« Reply #4 on: November 29, 2012, 06:16:02 PM »
cast-fish and others

I have removed 2 irrelevant posts as I misunderstood what OP was asking for.
I assumed he was looking to record what he was hearing from a web based app and not just any sound he was hearing.

AFAIK sox has no mp3 support in TC

eg
Code: [Select]
sox 6.wav 22.mp3
sox FAIL formats: can't open output file `22.mp3': SoX was compiled without MP3 encoding support
« Last Edit: November 30, 2012, 01:04:33 AM by aus9 »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: sound extensions and recording your soundcards output
« Reply #5 on: November 29, 2012, 07:04:27 PM »
The thread
http://forum.tinycorelinux.net/index.php/topic,8197
contains all necessary info to capture soundcard output with OSS4.

With alsa, capturing soundcard output could be very simple, if something like "Mix" is available as capture source in mixer - depending on soundcard and driver used.

P.S.: I do not think choice of apps would play a big role, ossrecord resp. arecord which come included with their respective sound system do a perfect job for recording.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

aus9

  • Guest
Re: sound extensions and recording your soundcards output
« Reply #6 on: November 29, 2012, 08:12:58 PM »
ok got it working in PA from this link

http://www.funwithelectronics.com/?id=95

firstly my stuff
Code: [Select]
tce-load -i pulseaudio pavucontrol sox

pacmd list | grep ".monitor"
monitor source: 0
name: <alsa_output.pci-0000_00_1b.0.analog-surround-51.monitor>
monitor_of: 0
device.class = "monitor"
alsa_output.pci-0000_00_1b.0.analog-surround-51.monitor/#0: Monitor of Built-in Audio Analog Surround 5.1
source: 0 <alsa_output.pci-0000_00_1b.0.analog-surround-51.monitor>

What we are looking for is source of the monitor of the output which means we are using the output as the source to record.

Your setup may differ, this is 6 channel

Code: [Select]
pacat --record -d alsa_output.pci-0000_00_1b.0.analog-surround-51.monitor | sox -t raw -r 44100 -s -L -b 16 -c 2 - "output.wav"

I do not have a audio app like audacity loaded to edit the start and end points but proof-of-recording is a success

Naturally I have a media player playing a file, in this case vlc setup to use pulseaudio plugin

At this stage of proof of concept I am not concerned that I made the output only a 2 channel sound file

EDIT
strange pathway for audacity explained by an older tcz
/usr/local/audacity-1.3.x/bin/audacity
but its crashing
« Last Edit: November 30, 2012, 12:51:03 AM by aus9 »

aus9

  • Guest
Re: sound extensions and recording your soundcards output
« Reply #7 on: November 30, 2012, 01:01:06 AM »
cast-fish

as I  know you have followed the OSS link
post deleted as irrelevant but my method above remains for others to see or not
« Last Edit: December 01, 2012, 07:33:37 PM by aus9 »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: sound extensions and recording your soundcards output
« Reply #8 on: November 30, 2012, 01:04:12 AM »
Code: (bash) [Select]
arecord|lame - test.mp3
works fine for me, either with capture set to "Mix" or "Mix Mono" in alsamixer.
Sure the command could be finetuned by using parameters according to desire.

Apart from alsa, only lame.tcz is required.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

aus9

  • Guest
Re: sound extensions and recording your soundcards output
« Reply #9 on: November 30, 2012, 01:15:11 AM »
 tinypoodle

on the input screen of alsamixer I don't have " mix" control,  care to show a screen shot?   Mine is in here


I had problems with OSS as well which I won't hijack any further here

The options are mic (rear or front) and line in

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: sound extensions and recording your soundcards output
« Reply #10 on: November 30, 2012, 02:04:31 AM »
tinypoodle

on the input screen of alsamixer I don't have " mix" control

The options are mic (rear or front) and line in

Please read the second sentence of  Reply #5

Posting amixer output is easier for me than screenshot, showing basically same content:

tc@box:~$ amixer controls|grep Source
numid=24,iface=MIXER,name='Capture Source'

tc@box:~$ amixer cget numid=24
numid=24,iface=MIXER,name='Capture Source'
  ; type=ENUMERATED,access=rw------,values=2,items=8
  ; Item #0 'Mic'
  ; Item #1 'CD'
  ; Item #2 'Video'
  ; Item #3 'Aux'
  ; Item #4 'Line'
  ; Item #5 'Mix'
  ; Item #6 'Mix Mono'
  ; Item #7 'Phone'
  : values=5,5
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

aus9

  • Guest
Re: sound extensions and recording your soundcards output
« Reply #11 on: November 30, 2012, 02:56:09 AM »
Quote
Please read the second sentence of  Reply #5
as I said, oss does not like me....well actually its a snd_hda-intel thing

On proof of your card having the feature, I have removed proof against audacity as its now more likely my issues may not not be implied to other sound card users. YMMV

in aussie speak...my sound card is a $$$@

Code: [Select]
amixer controls|grep Source
numid=17,iface=MIXER,name='Input Source'
numid=18,iface=MIXER,name='Input Source',index=1
tc@box:~$ amixer cget numid=17
numid=17,iface=MIXER,name='Input Source'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Mic'
  ; Item #1 'CD'
  : values=0
tc@box:~$ amixer cget numid=18
numid=18,iface=MIXER,name='Input Source',index=1
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Mic'
  ; Item #1 'CD'
  : values=0

 :'(  :'(
« Last Edit: November 30, 2012, 03:07:52 AM by aus9 »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: sound extensions and recording your soundcards output
« Reply #12 on: November 30, 2012, 11:07:52 PM »
aus9,

On a hda-intel card with similar restrictions, I installed OSS4 and never looked back.
Much better controls than with alsa in general and the loop device works perfectly well to capture soundcard output. Only minor disadvantage that jack sensing wouldn't work with OSS4, which I would handle with a script to toggle output between speakers vs. headphones.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline cast-fish

  • Hero Member
  • *****
  • Posts: 1000
  • hi there
Re: sound extensions and recording your soundcards output
« Reply #13 on: December 01, 2012, 09:40:41 AM »
Hello

thanks for all your help.

Tiny poodles answer seems best   "arecord | lame test.mp3"

what could be more simple

i also found that "FFMPEG" tool works well for this task of recording the soundcards
output.

Vince