Showing posts with label sound. Show all posts
Showing posts with label sound. Show all posts

Sunday, December 14, 2008

Saving streaming wmv files with Linux

This past week my sister-in-law was on the radio in NYC and my father-in-law wanted me to try and record it for him. Since I live in North Carolina, obviously the only way to do that would be to stream it over the web. I figured finding and listening to the stream would be the easy part. I listen to streaming radio ALL the time (thanks WUNC!).

Before getting into all of this, you are likely going to need to install some applications. Everything I used was available through the Ubuntu repositories though I do have Medibuntu enabled in addition to all the other easily enable able ones (main, universe, restricted and multiverse). This was also all done using 8.10 Intrepid Ibex. I also know I have several of the restricted packages installed which I am pretty sure is the only reason Windows Media files work. Now for the details.

The hard part would be to actually save the stream. Here is a step by step of what I did:

  • Obviously the first step was to find a stream of the station. She was playing on WQXR - 96.3 FM and I found their Windows Media stream on PenguinRadio.
  • I found that VideoLAN - VLC media player would be my best bet. It also works in Windows too. I didn't try this on Windows but I bet it would work the same with VLC.
  • I had the hardest time trying the many command line options for vlc. I really wanted to download the file and transcode it to wav or directly to MP3 but I just couldn't get that to work. Instead I just saved it directly as WMV and decided to worry about the rest later. I had some trouble with all the many GUI options too so I went with the safer command line route. I used the command line:
    vlc -vvv "http://htc-01.media.globix.net/COMP005996MOD1/meta/wqxr_live_high.asx" --sout '#duplicate{dst=display,dst=std{access=file,mux=asf,dst=/home/forrest/download.wmv}}'
  • Here is the easy to replace version: vlc -vvv "MY_STREAM" --sout '#duplicate{dst=display,dst=std{access=file,mux=asf,dst=MY_DOWNLOAD_FILE}}'

After all that I had a 34.1MB wmv file with just under 27 minutes recorded. At this point I converted it to a wav using mplayer like so: mplayer download.wmv -ao pcm:file=download.wav

Since I wanted to play it safe and be sure not too miss anything I needed recording, I started to recording early and kept it going past time. At first I wanted to use Audacity to trim the file but I had a problem getting that to work so I used a program called sox. To truncate the wav with sox you just specify the trim option, the start time and how long to run (NOT the end time). In my case it was: sox download.wav download-trim.wav trim 14:50 9:39

Next I converted the wav to MP3 so I could make it easy to get to online before burning it to a CD. I was sick of command line options at this point so I used SoundConverter instead of Lame (though it likely uses lame as a back end anyway) to save me the trouble.

Friday, May 16, 2008

Weird sound issues on Ubuntu 8.04, only one speaker or no sound at all

Now that I have upgraded to Ubuntu 8.04 I am utilizing PulseAudio instead of esd so the audio subsystem should be much better right? According to the Hardy release notes, PulseAudio

... makes it possible to mix audio from multiple applications together, assign audio from individual applications to specific sound cards, adjust volume levels of each individual application, and perform advanced operations on audio streams such as transferring the audio to another computer or changing sample formats and channel counts.
That sounds great. Only thing is it has been doing some strange things. Occasionally I lose sound on some or all applications. I haven't exhaustively tried to fix this problem yet but so far restarting has been the only solution.

I also just recently had a problem where only my left speaker was giving me any output. Fortunately muting and unmuting fixed that. I also read that adjusting the volume of both or more channels will also fix it.