<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

WaveInput plugin

From SqueezeboxWiki

Jump to: navigation, search

Contents

WaveInput Plugin

Overview

The WaveInput plugin enables PC sound to be played through SqueezeCenter by hooking into Windows recording facility. This plugin is useful for those stream which cannot be played directly by SqueezeCenter. The user would start the audio playing through the PC (e.g. use a Browser ang go to a Website) and then enable Waveinput on SC for the audio to be relayed through SC (albeit with a short delay)

The WaveInput plugin is based around an utility which samples the PC audio stream configured as the recording source and then converts and feeds the sampled stream as a WAV stream into SqueezeCenter.

Background

Joe Bryan wrote the original plugin for Slimserver 6.5 and more importantly the wavin2cmd application. The Forum thread on which this page is based can be read here WaveInput Forum Thread.

Installation

There are two ways to install the plugin

  • Automatic installation via the remote repository (recommended)
  • Manual installation by downloading the plugin (deprecated)

Automatic Installation

Since release 7.3 of Squeezecenter a feature called the Extension Downloader (ED) is available. On the plugins page you can specify URLs to remote repositories. Plugins can be installed automatically through the repositories in a similar manner as you install extensions to Firefox, for example.

To install the Wave Input plugin, follow these steps:

  1. Go to the plugins page (Settings->Plugins)
  2. Scroll to the bottom and find a text box called something like "Additional repositories".
  3. Enter the URL "http://bpaplugins.googlecode.com/svn/trunk/repo.xml" into the text box and click on "Apply"
  4. A list of Plugins should be displayed. Check the box opposite the WaveInput plugin and click "Apply"
  5. If Installation is successful - restart SC.

After the restart, check the plugins page. It might display an error next to the Wave Input plugin saying that the version is not compatible. To fix this:

  1. Locate the cache folder of Squeeze Center. Typically, it would be located in "C:\Documents and Settings\All Users\Application Data\Squeezebox\Cache".
  2. Change into the "InstalledPlugins\Plugins\WaveInput" subdirectory.
  3. Open the "install.xml" file
  4. Find the tag called "<maxVersion>".
  5. check if the version listed there matches your installed SC version. Wildcards are possible, e.g. enter "7.4.*"
  6. restart SC and verify on the Plugins page that the change worked

Manual Installation

The installation of this plugin has two stages:

  • Download WaveInput Plugin zip file.
  • Install WaveInput plugin

Stage 1. Download Wavinput zip file

The most recent versions of the plugin can be found here: http://code.google.com/p/bpaplugins/downloads/list

For older versions, follow these instructions: Download the WaveInput plugin attached to post post #1 & #49 for 6.5 [1] or post #119 for 7.0 [2] or post #177 for 7.1, 7.2 and 7.3 [3]. If you are using IE6 or IE7, you may get a message The compressed (zipped)file is invalid or corrupted. For some reason IE has downloaded the zip file onto your system and then recompressed it again but into GZIP format. A format for which MS has not provided a decoder !!

If you get this messages - you have two choice

  1. Install Firefox and use Firefox to download the file.
  2. To unpack the IE downloaded file - rename the extension to GZ and then download something like WinRAR or WinZIP to unpack the zip file from the GZ file.

Why IE does this is a mystery (possibly something in the forum http response is causing it) and I cannot find the setting to disable it.

Stage 2a. To install WaveInput plugin in Slimserver 6.5

1. Stop Slimserver.

2. Unzip the downloaded zip file into your SlimServer\server directory.

3. Start Slimserver

4. Check a plugin named "Wave Input" is added to the "Plugins" menu on Slimserver client devices, and the "Plugins" and "Formats" pages of the server settings web pages.

Contents:
Bin\MSWin32-x86-multi-thread\wavin2cmd.exe	- streams from default windows audio device
Plugins\WaveInput\Plugin.pm			- Slimserver plugin
Plugins\WaveInput\WAVIN.pm			- "wavin:" protocol handler
Plugins\WaveInput\wavin-convert.conf		- config file

Stage 2b. To install WaveInput plugin in SC7

1. Stop SC.

2. Unzip the downloaded zip file into your SC's server\Plugins directory so that there is a server/Plugins/WaveInput directory with a 5 files (including WAVIN.pm) and a Bin and HTML directory.

3. Start SC

4. Check Settings/Advanced/Filetypes to see if there are "Wave Input" types enabled to run wavin2cmd.

Configuration

Configure Windows XP

In the following section the term "Stereo Mix" is used as the name for source of PC audio. The source called "Stereo Mix" may not be available on all soundcards but alternative names of sources such as "What U Hear", "Wave Out Mix","Audio Mix" and "Wave" are worth trying.

1. Open Control Panel

2. Open Sounds & Audio Devices.

3. Select Audio Tab

4. Check that the "Sound Recording default device" is set to the correct audio hardware which will be playing the audio you want out of Squeezecenter/Slimserver.

5. Click the "Sound Recording" Volume button - you will typically get the "Recording Control" window with sliders for ewach configured input device, typically: "Stereo Mix", "Cd Audio" , "Microphone" but the exact combination will depend on your hardware.

6. If you have a slider marked "Stereo Mix" goto step 8. Otherwise goto Step 7.

7. Normally the wavin2cmd will pick up audio from "Stereo Mix" so you need to get a "Stereo Mix" or similar in the "Recording Control". If there is no "Stereo Mix".

7a. Click "Properties" under "Recording Control" "Options" menu

7b. In the Properties box - make sure the correct Audio hardware is selected and the "Recording" radio button is selected.

7c. You will then have a list of items with check boxes - usually "Stereo Mix" is one of these and if so check its box.

7d. Now close window by clicking "OK" button.

7e. You should now have a "Stereo Mix" set of controls in the "Recording Control" window.

8. Check the "Select" box in the "Stereo Mix" column.

9. Set Volume at Max in Stereo mix. This volume will affect volume out of SC so set at max for initial configuration. It can be adjusted later when all is working.

10. Close the Recording Control window.

Configure Windows Vista / 7

In the following section the term "Stereo Mix" is used as the name for source of PC audio. The source called "Stereo Mix" may not be available on all soundcards but alternative names of sources such as "What U Hear", "Wave Out Mix","Audio Mix" and "Wave" are worth trying.

1. Open Control Panel (not in Classic View)

2. Open Hardware & Sound

3. Open Sound - you should get a window with 3 tabs Playback, Recording and Sounds.

4. Select Recording Tab

5. You should see the "Recording" tab where you can select the recording device. There will be a number of recording device in a list typically "Microphone", "Line in", "CD Audio" and "Stereo Mix" (see above for alternate names of "Stereo Mix").

6. If you have an entry called "Stereo Mix" goto step 8. Otherwise goto Step 7.

7. Normally the wavin2cmd will pick up audio from "Stereo Mix" so you need to get a "Stereo Mix" or similar in the "Recording Control". If there is no "Stereo Mix".

7a. In the "Recording" Tab - right click in a empty area of the tab and you should see two menus - "Show Disabled Devices" and "Show Disconnected Devices". Make sure both of these are selected (i.e. have a tick).

7b. If available "Stereo Mix" entry should appear. If it does nto appear try closing Control panel and repeat steps 1-4.

7c. If "Stero Mix" is disabled then right click the "Stereo Mix" icon and select the "Enable" menu.

7c. You will then have a list of items - "Stereo Mix" is one of these and it should be enabled (i.e. not greyed out)

8. Click on the "Stereo Mix" entry and then click "Properties" button on bottom or from right-click menu.

9. A window should open with a title something like "Stereo Mix properties". There will be a number of tabs such as "General", "Levels", "Enhancements" and "Advanced". The exact number of tabs will depend on your hardware & drivers. Select "Levels" and set the "Stereo Mix" level to max value (i.e. 100) as this controls the volume of the signal from PC. Once you have WaveInput working you may want to readjust this level. Click OK to save level.

10. Click OK to close the Recording Control window.

This link looks like it has good advice as the main issue is how to record audio. See Vista Recording Problem

User post - I had a similar experience and the mixer was not visible. I did the following: Control Panel > Sound > Manage Audio Devices > Recording (only Mic & Line In showing) Right click in the window, select "show disabled devices".

It has been reported that some manufacturers such as Dell have distributed sound card driver for Sigmatel audio which have omitted "Stereo Mix" - in which case it is worthwhile looking for a proper driver. See Sigmatel Stereo Mix on Vista/Dell

Windows 7 with Realtek HD Auido sound card - Windows Update will automatically install Microsoft drivers, while Realtek own drivers are required for "Stereo Mix" to be available among the recording devices.

Operation

There is a proper user interface on the 6.5 version of the Plugin with menu entries on WebUI and SB with displays. The WaveInput plugin was ported in a minimal manner for SC 7.0 and as such it has no user interface.

WaveInput 1.02 on Slimserver 6.5

Navigate to the "Wave Input" plugin page and press PLAY to select the audio input. You can stop, pause, play and save the Audio Input source as a favorite or playlist just like any other web link or song.

You can also use "wavin:0" as an URL in the Tune-in box.

WaveInput 1.02 on SqueezeCenter 7.x

Just create an entry in Favorites with an URL "wavin:0". Playing this favorites will connect PC sound to SB. Stopping this favorites (or clearing playlist from WebUI) will stop the app. If there are multiple input devices possible (as described in the "Using Different Devices" section below) then other entries besides "wavin:0" can be used.

Tuning & Tweaking

More input needed here from users who have played with the wavin2cmd settings.

FAQ

Q. I set the buffer of wavin2cmd to 8192, the number of buffers to 2 and I get something around one second latency

A. The settings you've chosen for wavin2cmd provide about 370ms at 44.1kHz, so the additional 630ms is likely the result of network buffering on each end, the encryption/conversion buffering, and the linux machine's audio output driver latency.

To get 300ms through-latency, you'll need to minimize the buffering wherever you can, and not use encryption/compression, since these add additional buffering and can use processor cycles needed for minimum latency driver performance (this goes up inversely proportional to the buffer size). If you need compression to minimize network traffic, you could try the flac codec.

Q. How is the buffer size set? Can it be done from the web interface?

Q. My server has built in sound playback and the only recording option I get in the Audio tab in control panel is "Realtek HD Audio rear input". So if I understand this correctly the only thing I can stream is the rear audio input jack. To be able to stream what I'm listening to (ie Yahoo Launchcast) I'd have to have a "loopback" option?

A. Pretty much. Microsoft requires soundcards with the Vista logo ensure the audio output cannot be recorded digitally using a loopback. This is the main reason to go with a non-logo, pro-level sound card.

The other option is to use something like VAC from NTONYX VAC.

Q. Does WaveInput work on Vista.

A. It works on some Vista systems. It looks like some sound card drivers omit the "Stereo Mix" or "Wave Input" recording sources.

Q. Doesn't work - get a Windows or socketwrapper error.

A. If you are using Inguz plugin disable it - WaveInput does not work with Inguz.

Q. I'm playing the output to stream.mp3 however its not working. The Slimserver page still says Audio Input but when I hit play it does nothing. The stop button it highlighted. But, If you were to type in the stream URL into WinAmp or WMP for example, the feed starts playing, though no sound, it says Audio Input for the title.

A. See this forum entry Forum entry on WaveInput on stream.mp3

Q. I tried several times to download the WaveInput plugin and it starts downloading then gives me "The compressed (zipped)file is invalid or corrupted" message and aborts the download. I can download and save it but it gives me the same error if I try to open it. Anyone have any suggestions?

A. For some reason IE has downloaded the zip file onto your system and then recompressed it again but into GZIP format. A format for which MS has not provided a decoder !!

If you get this messages - you have two choices

  1. Install Firefox and use Firefox to download the file.
  2. To unpack the IE downloaded file - rename the extension to GZ and then download something like WinRAR or WinZIP to unpack the zip file from the GZ file. Then use the zip file as described above.

Q. How to reduce the lag

A. ?? - This question can be answered if users add entries in Tuning & tweaking

Q. Where are the wavin2cmd parameters set? Can it be done via the url or does it have to be done on the command line?

How to do standalone test of wavin2cmd.exe utility

Sometimes to trace faults it may be worthwhile testing whether the wavin2cmd works separate from Slimserver/Squeezecenter

How to do standalone test of whether wavin2cmd is working with your Windows Audio configuration before using testing WaveInput plugin with Slimserver/SqueezswCenter.

The following is from memory so some details may not be quite correct. To check whether wavin2cmd is connected to PC sound. 1. Open a command prompt window (e.g open Run box and type "cmd")

2. CD to the Slimserver/Squeezecenter directory which has the wavin2cmd.exe executable - typically for SC7.0 C:\Program Files\SqueezeCenter\server\Plugins\Wavinput\Bin

3. Get some audio out on PC sound system you want to capture (e.g. start Browser on a Radio station)

4. run the following command

wavin2cmd.exe -w -o wavin:0 > audiocapture.wav

5. Wait for about one minute and then stop wavin2cmd.

6. Check the size of the file "audiocapture.wav" - it will be large if it is capturing audio even if silence.

7. Play the file "audiocapture.wav" (e.g using Windows Media Player) and check if you hear the audio that was playing on the PC.

8. If you don't hear anything - change the input or recording levels in the "Windows Audio" control panel and try steps 3-7 again.

It is possible you may have more than one possible input device so try the following command to list possible devices to record.

wavin2cmd.exe -l

In the above test you might need to change the "wavin:0" to another number to get the correct input. The "wavin2cmd.exe -l" command displays the valid range of inputs and hence the range numbers after "wavin:" that could be tested.

Using Different Devices

From a Joe Bryan forum post.

Here's a sample playlist that allows selecting specific inputs on the soundcard without having to reconfigure your default sound device. You can select an input by playing the appropriate source "song" within the playlist. You can even play the entire playlist and use the FWD/REW buttons to quickly switch the source.

This sample uses names appropriate for my system (based on an 18-input RME HDSP Multiface), but you can easily rename these to whatever you like, or even delete unused inputs from the list using the playlist editor.

#EXTM3U
#EXTINF:-1,iPod Input
wavin:1
#EXTINF:-1,Phono Input
wavin:2
#EXTINF:-1,CD Input
wavin:3
#EXTINF:-1,FM Radio Input
wavin:4
#EXTINF:-1,S/PDIF Input
wavin:9
#EXTINF:-1,2192 ADC Input
wavin:5
#EXTINF:-1,MediaMonkey (Digital loopback)
wavin:6
#EXTINF:-1,Wavelab (Digital loopback)
wavin:7
#EXTINF:-1,Windows (Digital loopback)
wavin:8
#EXTINF:-1,Windows (Analog loopback)
wavin:10

For SC 7.0 an OPML file format would be better

In essence, the link to each source is of the form "wavin:<n>", where "<n>" is the input channel on the device. The default input is "wavin:0" (this is selected with the Wave Input plugin and configured by Windows), and the 1st input is "wavin:1", etc.

Troubleshooting

Windows wave input devices only allow one application to use them at a time, so if you have problems, check if any other apps are using the soundcard.

The MP3 conversion settings are defined in the SlimDevices\server\Plugins\WaveInput\wavin_convert .conf file on your server. These were copied directly from the main convert.conf file, and use the main QUALITY and BITRATE settings configured for your server.

Wavin2cmd command line reference

Usage: wavin2cmd <opts> [wavin:<device-num>] 
    Streams audio from wavein device to stdout or a named pipe. 
    Streams are mono or stereo (interleaved) PCM with optional .wav header.  
    For named pipes (-p), streaming starts when client connects (opens pipe),  
    and stops when client disconnects (closes pipe). 
    For stdout (-o), streaming starts immediately, and stops when stdin is  
    closed. 
 
Supported opts: 
    -h or -?         prints this message 
    -d <device-name> (default is wave mapper) windows audio device name (use quotes if needed) 
    -i <device-num>  (default is 0 for wave mapper) windows audio device number (1-based index into list) 
    -l               display list of wavein device names and exit 
    -c <channels>    (default=2) number of channels, either 1 or 2 
    -s <samplerate>  (default=44100) sample rate in hertz (integer) 
    -b <samplebits>  (default=16) bits per sample (integer from 8 to 32) (samples are left-justified) 
    -m <bufferbytes> (default=32768) bytes per buffer 
    -n <buffercount> (default=4) number of buffers (need at least 1 per channel) 
    -v <errorlevel>  (default=0) error reporting level to debugger: 0=silent, 1=normal, 2=verbose (includes success) 
    -w               (default is raw) add wave header to output stream 
    -o               stream to stdout (cannot be used with -p) 
    -p <pipename>    stream to named pipe (cannot be used with -o),  
                     access this pipe as the local file \"\\\\.\\pipe\\<pipename>\"  
                     or the remote file \"\\\\<servername>\\pipe\\<pipename>\"