|
|
(4 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| <!-- ALSAPulseAudio.mediawiki --> | | <!-- QT_GUI_Chooser.mediawiki --> |
| == Working with ALSA and Pulse Audio ==
| | This block creates a variable with enumerated options. The gui widget is implemented as a combo box or radio button group. When the label is left blank, the option will be used as the label. Set the number of options to "list" to enter a single list of options and labels. |
|
| |
|
| * Sound cards don't support arbitrary sampling rates. If your audio is choppy, check the rate of your audio sink or source: 44100 Hz works under all audio cards known, 48000 Hz on most, others may not.
| | See [[GUI Hint]] for how to position the GUI within your window. |
| * Don't clip: The maximum amplitude in your signal '''must not''' exceed 1.0.
| |
| * Set "OK to Block" to "No" when the flowgraph is throttled by another hardware device.
| |
|
| |
|
| == Talking to ALSA == | | == Example Flowgraph == |
|
| |
|
| The GNU Radio Audio Sink and Source blocks use ALSA (unless ALSA support was disabled during build time). ALSA has been the standard sound API under Linux for a decade or more, so basically all programs that produce Audio know how to deal with it. Alternately one can use a ''sound server'' like PulseAudio that takes care of dealing with all the low-level details for the application.
| | This shows the QT GUI Chooser block and how it looks in the output. |
|
| |
|
| PulseAudio also provides a "fake" ALSA device to make ALSA applications talk to PulseAudio instead of directly with the hardware driver, allowing one central volume control, etc. However, PulseAudio's device isn't always perfect. PulseAudio is capable of resampling internally, but the results aren't always predictable. For GNU Radio applications, it's often desirable to use the raw device.
| | [[File:FunCube_AM_out.png|800px]] |
| | <br><br> |
|
| |
|
| You can obtain a list the playback devices (for an Audio Sink) using the <code>aplay</code> program.
| | <b>Note:</b> <code>Added field for 3.8.1 in July 2020</code> The "Option 0 (Default)" field has been split into two fields: "Default option" and "Option 0". Whereas the old format forced the default value to be entered as Option 0, the new format allows any of the options to be the default value. Here are what the parameters of the Chooser look like before and after: |
|
| |
|
| * from a terminal window enter:
| | [[File:FunCube_AM_prop.png|387px]] [[File:QT_GUI_CHOOSER_prop.png|303px]] |
| <code>aplay -L</code>
| |
| * a long list of options will be displayed, such as:
| |
| <pre>
| |
| default
| |
| Playback/recording through the PulseAudio sound server
| |
| null
| |
| Discard all samples (playback) or generate zero samples (capture)
| |
| pulse
| |
| PulseAudio Sound Server
| |
| hdmi:CARD=HDMI,DEV=0
| |
| HDA ATI HDMI, HDMI 0
| |
| HDMI Audio Output
| |
| hw:CARD=Generic,DEV=0
| |
| HD-Audio Generic, ALC662 rev3 Analog
| |
| Direct hardware device without any conversions
| |
| plughw:CARD=Generic,DEV=0
| |
| HD-Audio Generic, ALC662 rev3 Analog
| |
| Hardware device with all software conversions
| |
| ... | |
| </pre>
| |
| * find the entry such as:
| |
| <pre>
| |
| hw:CARD=Generic,DEV=0
| |
| HD-Audio Generic, ALC662 rev3 Analog
| |
| Direct hardware device without any conversions
| |
| </pre>
| |
| in the list which matches your desired device. | |
| * use the first line of that entry (e.g. "hw:CARD=Generic,DEV=0") as the device name (without the quotes).
| |
|
| |
|
| For audio input devices, use:
| | [[Category:Block Docs]] |
| | |
| <pre>arecord -L</pre>
| |
| to obtain a similar list.
| |
| | |
| == Monitoring the audio input of your system with PulseAudio ==
| |
| | |
| <p><b>IMPORTANT: this procedure only applies to an Audio Source block!</b></p>
| |
| | |
| PulseAudio has its own monitor "ports". You can list all PulseAudio monitor sources by running:
| |
| | |
| <pre>pactl list|grep "Monitor Source"|sed 's/^[[:space:]]*Monitor Source: //g'</pre>
| |
| | |
| This will give you one or more lines containing something like
| |
| | |
| <pre>alsa_output.pci-0000_00_03.0.hdmi-stereo.monitor
| |
| alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
| |
| alsa_output.pci-0000_06_00.1.hdmi-stereo.monitor</pre>
| |
| | |
| Select the right name; assuming we use the analog input, the second line would be the right.
| |
| | |
| === Add ALSA Pseudodevice for monitor ===
| |
| | |
| Now, we need to edit (or create, if it doesn't already exist) <code>~/.asoundrc</code>.<br />
| |
| Add
| |
| <pre>
| |
| pcm.pulse_monitor {
| |
| type pulse
| |
| device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
| |
| }
| |
| | |
| ctl.pulse_monitor {
| |
| type pulse
| |
| device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
| |
| }
| |
| </pre>
| |
| of course, replacing the <code>device</code> name with the correct one from the previous step.
| |
| | |
| === Using the newly created device ===
| |
| | |
| In the Audio Source block, use <code>pulse_monitor</code> as the device name:<br />
| |
| | |
| [[File:PulseAudio-ALSA-Monitoring.png|PulseAudio-ALSA-Monitoring.png]] | |
This block creates a variable with enumerated options. The gui widget is implemented as a combo box or radio button group. When the label is left blank, the option will be used as the label. Set the number of options to "list" to enter a single list of options and labels.
See GUI Hint for how to position the GUI within your window.
Example Flowgraph
This shows the QT GUI Chooser block and how it looks in the output.
Note: Added field for 3.8.1 in July 2020
The "Option 0 (Default)" field has been split into two fields: "Default option" and "Option 0". Whereas the old format forced the default value to be entered as Option 0, the new format allows any of the options to be the default value. Here are what the parameters of the Chooser look like before and after: