Editing Audio Source

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 17: Line 17:
==== OSX ====
==== OSX ====


On OSX, Audio Sink will return only zeros unless the GNU Radio binary is launched from an application that has been granted permission to use the microphone. For example, if you are launching GNU Radio Companion from the iTerm command line, go to System Preferences -> Security & Privacy -> Privacy -> Microphone and check the box for "iTerm2".
On OSX, go into the System Preferences, click on "Sound", and then the "Input" tab. The listings under "Name" contain the exact device names currently available; if a new audio source is attached to the computer then a new name will appear -- for example "Line In" for some Macs. Since most such device names contain spaces, make sure to put quotes around the name argument, for example:
 
Once the application has permission, leaving the 'Device Name' blank will connect to the current default audio input device. To see or change the current device, go into the System Preferences, click on "Sound", and then the "Input" tab.
 
The listings under "Name" contain the exact device names currently available; if a new audio source is attached to the computer then a new name will appear -- for example "Line In" for some Macs. Since most such device names contain spaces, make sure to put quotes around the name argument, for example:


     spectrum_inversion.py -I "MacBook Pro Microphone"
     spectrum_inversion.py -I "MacBook Pro Microphone"
Line 27: Line 23:
==== Linux ====
==== Linux ====


On Linux, the device is selected via ALSA, typical choices include:
On Linux, typical choices include:
* <code>default</code> (selected if left empty)
* pulse
:This will use the default device. Note that in most desktop systems this is actually managed by PipeWire or PulseAudio, to check this, you can execute <code>arecord -L | grep -A1 ^default</code>.
* hw:0,0
* <code>hw:0,0</code>
* plughw:0,0
:This will select the hardware card 0, device 0. To check the list of available cards/devices, issue the command <code>aplay -l</code> (note that <code>-l</code> is lower case here).
* /dev/dsp
* <code>plughw:0,0</code>
:This is the same as <code>hw:0,0</code> but enables software processing, which allows e.g. using a sample rate not natively supported.
* <code>pipewire</code> (to explicitly use PipeWire)
* <code>pulse</code> (to explicitly use PulseAudio)
 


For ALSA users with audio trouble, follow this procedure:
For Linux ALSA users with audio trouble, follow this procedure:
* from a terminal window enter:
* from a terminal window enter:
<code>arecord -L</code>
<code>arecord -L</code>
Line 49: Line 40:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from the list which matches your device.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from the list which matches your device.
* use the first line of that entry (e.g. "hw:CARD=Device,DEV=0") as the device name (without the quotes).
* use the first line of that entry (e.g. "hw:CARD=Device,DEV=0") as the device name (without the quotes).
* For issues or debugging, see [[ALSAPulseAudio]].
==== Windows ====
On Windows, go into the Settings, cllck on "System", click on "Sound", and then the "Input" tab. The listings under "Name" contain the exact device names currently available; if a new audio source is attached to the computer then a new name will appear. Since most of the device names contain spaces, make sure to put quotes around the name argument, for example:
    "Microphone (Realtek High Definition Audio)"


=== OK to Block ===
=== OK to Block ===
Line 62: Line 45:
On by default, which should be used when this sink is not throttled by any other block.
On by default, which should be used when this sink is not throttled by any other block.


== Example Flowgraphs ==
== Example Flowgraph ==
 
=== Audio Source to RTTY decoder ===


This flowgraph shows the Audio Source block feeding a radioteletype (RTTY) decoder.
This flowgraph shows the Audio Source block feeding a radioteletype (RTTY) decoder.


[[File:RTTY_rcv.png|800px]]
[[File:RTTY_rcv.png|800px]]
=== Sound detector and notifier ===
This flowgraph takes audio from the audio source, squares it, to get something proportional to the instantaneous power, then low-pass filters it to approximate an averaged-out power, applies a  [[Threshold]] to it. The latter starts outputting 1s as soon as the smoothed power crosses 10% of the maximum power, and turns back to generating 0s when it falls below 5%.
The resulting stream of 1s and 0s is multiplied with a 440 Hz tone and then fed into an [[Audio_Sink|Audio Sink]], allowing the user to hear a tone for as long as there's enough sound at the input.
[[File:Audio_passthrough.png|800px]]
[[File:Audio_passthrough.grc|Original Flow Graph]]

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)