record streaming audio

Using applications, configuring, problems
Post Reply
Message
Author
robpeteuk
Posts: 40
Joined: Fri 22 Feb 2008, 16:09

record streaming audio

#1 Post by robpeteuk »

Hi I have been trying to set up my sound card to record streaming audio. I can do this with xp with no problem. I have a Realtek ALC888 with Intel 82801I HD Audio Controller intergrated sound card and am using slacko 5.6 I think the problem is that alsa does not have a capture mix slider for some reason. I presume it may be unable to configure itself for this card if that makes sense. Everything else works fine as far as I know. Wondered if I can't capture audio through alsa if I could through setting up pulse audio or something similar. I can do it by running xp but find it annoying to restart pc and also have to use xp. Any ideas thanks Rob

linus.cl
Posts: 126
Joined: Wed 02 Apr 2014, 14:09
Location: Germany
Contact:

#2 Post by linus.cl »


gcmartin

#3 Post by gcmartin »

Hello @RobPeteuk. You are in luck of some timely effort shared over the last week in this forum.

See this thread for 3 explanations for audio capture.

Hope it helps in understanding and addresses your need(s) for recording audio.

robpeteuk
Posts: 40
Joined: Fri 22 Feb 2008, 16:09

#4 Post by robpeteuk »

Thanks for help. Unfortunately Audacity still does not record streaming audio. I think it is something to do with ALSA not being able to work fully with the on board audio of the Dell Vostro, a Realtec Alc 888. There is no mix on the Alsa sliders which there is on another pc running Slacko . The other PC records streaming audio fine. I have wondered about trying to install Pulse Audio but it seems to have lots of problems too from forums I have read.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#5 Post by mikeb »

hmm either there is no hardware mix on the card or the alsa driver is not 100%... If its the former then you can have software mixing which may be what windows is doing. These built in intel chipset type cards tend to be lacking.

There is that option with alsa...dmix etc but having never done it I am not one to advise...I vaguely recall that a config (.asoundrc? ) file is made to make it happen...one to google. I assume you want to capture the output since none of the available capture inputs does the job...alsamixer and tab..arrows and spacebar to select.

mike

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#6 Post by SFR »

I have the same problem (lack of 'mix' under Linux on both of my laptops), but I found a partial workaround here:
https://bbs.archlinux.org/viewtopic.php?id=147852
You could try this. Here's more straightforward, step-by-step setup guide:

1. Load snd-aloop kernel module by typing in terminal:

Code: Select all

modprobe snd-aloop
(later, if it turns out to be working well, you can add this module in Bootmanager, so it will be loaded at system boot)

2. Create (if doesn't exist) /etc/asound.conf and add the following content to it:

Code: Select all

pcm.!default {
  type asym
  playback.pcm "LoopAndReal"
  #capture.pcm "looprec"
  capture.pcm "hw:0,0"
}

pcm.looprec {
    type hw
    card "Loopback"
    device 1
    subdevice 0
}


pcm.LoopAndReal {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}


pcm.mdev {
  type multi
  slaves.a.pcm pcm.MixReale
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}


pcm.MixReale {
  type dmix
  ipc_key 1024
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

pcm.MixLoopback {
  type dmix
  ipc_key 1025
  ipc_perm 0666
  slave {
    pcm "hw:Loopback,0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}
NOTE: it might be the case that your card has different index than 0.
For example in Acer AO 722 I had to replace all occurences of 'hw:0,0' with 'hw:1,0'.

3. Perform a quick test - turn on some music and type:

Code: Select all

arecord -f dat -D looprec -V stereo > /root/test.wav
Keep recording for some time, press CTRL+C and type:

Code: Select all

aplay /root/test.wav
to see (hear) if it's working.

Now, if you want to use e.g. mhWaveEdit for recording, you need to reconfigure it.
In 'Edit -> Preferences -> Sound -> (Driver: ALSA) Settings -> Recording device' enter looprec.
Also, sample format ('Play -> Record -> Sample format -> Other format') has to be:
- Channels: Stereo
- Sample type: 16 bit PCM
- Signedness: Signed
- Endianness: Little endian
- Sample rate: 48000

There are some side effects and shortcomings though:
- PCM slider in Alsamixer/Retrovol doesn't work anymore
- you can't record from microphone using this method (device: looprec)
- nor from PMusic, because it uses its own, custom ~/.asoundrc config file (probably needed by equalizer), but if you delete this file after starting PMusic and restart a track, it becomes recordable
- nor from apps that use OSS, unless they have an option to set ouput to ALSA

Apps I've tested to work fine are: DeaDBeeF, Gnome-mplayer (<-set output to ALSA), SMPlayer, Simple GTK Radio (by dejan555), aplay, ffplay and browser based stuff like YT and similar...

HTH
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#7 Post by RSH »

Instead of configuring stuff that will disable play/recording ability of some applications, I recommend NOT to use the onboard sound cards in desktop PC's.

Disable the onboard sound cards in BIOS and use a PCI sound card like Creative Soundblaster etc.pp.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

robpeteuk
Posts: 40
Joined: Fri 22 Feb 2008, 16:09

#8 Post by robpeteuk »

Brilliant. Thanks so much. After searching and playing around for hours recording streaming audio now works great, at least in audacity. Thanks SFR ( and everyone else for suggestions. Rob

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#9 Post by mikeb »

Nice description SFR of what always seemed a bit of a black art....

I reckon it should become a how-to since I and others have needed to do this at some time or other :)

mike

robpeteuk
Posts: 40
Joined: Fri 22 Feb 2008, 16:09

#10 Post by robpeteuk »

Agree would have been good to have been on How to capture streaming audio. Would have saved me a lot of hassle.
After I created a asound.conf file and configured mhWaveEdit as described by SFR I had to add to the /etc/rc.d/rc.local file the line modprobe snd-aloop for audacity and mhWave Edit to reload with the correct configuration after shut down and bootup. There did not seem to be a snd-aloop module to add to bootmanager.

sheldonisaac
Posts: 902
Joined: Mon 22 Jun 2009, 01:36
Location: Philadelphia, PA

#11 Post by sheldonisaac »

Thank you, SFR. I did as you said, and indeed the test.wav does contain the audio.
But also it contains unpleasant repeating sounds like "PSSSS -PSSSS-PSSSS"
continued indefinitely.

Can someone help?

Thank you very much..
Dell E6410: BusterPup, BionicPup64, Xenial, etc
Intel DQ35JOE, Dell Vostro 430
Dell Inspiron, Acer Aspire One, EeePC 1018P

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#12 Post by SFR »

mikeb wrote:I reckon it should become a how-to since I and others have needed to do this at some time or other :)
That was my thought too, a few months ago when I finally got it working, but was/am too lazy. ;)

robpeteuk wrote:There did not seem to be a snd-aloop module to add to bootmanager.
Ah, if a module is already loaded, it won't be listed in BootManager.
BootManager wrote:On the left pane is the complete list of modules available to be used by Puppy (and not currently loaded).
So, it's necessary to rmmod snd-aloop first, in order to make it visible in BM.

sheldonisaac wrote:But also it contains unpleasant repeating sounds like "PSSSS -PSSSS-PSSSS" continued indefinitely.
Never encountered such a thing...
Does it happen even if all audio apps are closed and you record silence?
And what if you used mhWaveEdit/Audacity instead of arecord?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

sheldonisaac
Posts: 902
Joined: Mon 22 Jun 2009, 01:36
Location: Philadelphia, PA

#13 Post by sheldonisaac »

SFR wrote:
sheldonisaac wrote:But also it contains unpleasant repeating sounds like "PSSSS -PSSSS-PSSSS" continued indefinitely.
Never encountered such a thing...
Does it happen even if all audio apps are closed and you record silence?
And what if you used mhWaveEdit/Audacity instead of arecord?
Greetings!
Thanks for your very prompt response.
I am completely inexperienced in this, so please excuse me.
May I ask for guidance in providing you possible diagnostic info, such as hardware, OS, etc.
I hope I can attach test1.wav, recorded 'silence'
And test2.wav, recorded while pmusic played a radio stream

Oops, .wav is not allowed; I'll rename them with .gz extensions.

Oh, and regarding mhWaveEdit/Audacity : how would one use mhWaveEdit to record an audio stream?
As to Audacity, I don't have it - may I ask for advice?


Thanks again,
Sheldon Isaac
Attachments
test2.gz
(71.88 KiB) Downloaded 176 times
test1.gz
(137.54 KiB) Downloaded 212 times
Dell E6410: BusterPup, BionicPup64, Xenial, etc
Intel DQ35JOE, Dell Vostro 430
Dell Inspiron, Acer Aspire One, EeePC 1018P

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#14 Post by SFR »

sheldonisaac wrote:Oh, and regarding mhWaveEdit/Audacity : how would one use mhWaveEdit to record an audio stream?
As to Audacity, I don't have it - may I ask for advice?
Have a look at my first post in this very thread for the info about configuring mhWaveEdit.
Audacity should be available in PPM.
sheldonisaac wrote:test1.wav, recorded 'silence'
I looked into these files via hexdump and I think I know what's going on: older versions of arecord send the visual representation of VU meter's output to stdout (newer - to stderr), so it's being saved in WAV file along with audio stream, hence the artifacts.
Me and William (mcewanw) were struggling with that mess lately, while fixing a bug in p(av)record.
Try without VU meter:

Code: Select all

arecord -f dat -D looprec > /root/test.wav
Hopefully, should be fine now.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

sheldonisaac
Posts: 902
Joined: Mon 22 Jun 2009, 01:36
Location: Philadelphia, PA

#15 Post by sheldonisaac »

SFR wrote:
sheldonisaac wrote:Oh, and regarding mhWaveEdit/Audacity : how would one use mhWaveEdit to record an audio stream?
As to Audacity, I don't have it - may I ask for advice?
Have a look at my first post in this very thread for the info about configuring mhWaveEdit.
Audacity should be available in PPM.
sheldonisaac wrote:test1.wav, recorded 'silence'
I looked into these files via hexdump and I think I know what's going on: older versions of arecord send the visual representation of VU meter's output to stdout (newer - to stderr), so it's being saved in WAV file along with audio stream, hence the artifacts.
Me and William (mcewanw) were struggling with that mess lately, while fixing a bug in p(av)record.
Try without VU meter:

Code: Select all

arecord -f dat -D looprec > /root/test.wav
Hopefully, should be fine now.

Greetings!
SFR, you have been VERY generous with your time and knowledge; thank you again.
Audacity works. And regarding the arecord and mhWaveEdit., thanks also; I will work on that (and probably be back for more help :)
Dell E6410: BusterPup, BionicPup64, Xenial, etc
Intel DQ35JOE, Dell Vostro 430
Dell Inspiron, Acer Aspire One, EeePC 1018P

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#16 Post by mikeb »

SFR...no excuses...copy and paste was made for slobs like us :D

Thanks for the arecord stdout info.... my simple recorder uses the meter output and gets upset if its left on when recording starts...might be related.

mike

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#17 Post by SFR »

Alright, so here it is, a new and shiny tutorial: How to capture audio output

USE IT TOGETHER
USE IT IN PEACE
:wink:
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#18 Post by mikeb »

Yo...and may your toes be forever blessed for your kindness :)

mike

Post Reply