
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Cross-platform audio device mapping library for macOS, Windows, and Linux with comprehensive device UID support for both input and output audio devices.
pip install audiomap
Windows:
pip install audiomap[windows]
Development:
pip install audiomap[dev]
Windows users need additional packages:
pip install audiomap[windows]
Developer installation:
pip install audiomap[dev]
from audiomap import list_audio_input_devices, list_audio_output_devices
# List all input devices
input_devices = list_audio_input_devices()
for device in input_devices:
print(f"Input device: {device['name']} (UID: {device['id']})")
# List all output devices
output_devices = list_audio_output_devices()
for device in output_devices:
print(f"Output device: {device['name']} (UID: {device['id']})")
from audiomap import AudioDeviceDetector
detector = AudioDeviceDetector()
# Get all devices with UIDs
all_devices = detector.list_all_devices()
print(f"Input devices: {len(all_devices['input'])}")
print(f"Output devices: {len(all_devices['output'])}")
# Display device information including UIDs
for device in all_devices['input']:
print(f"Input: {device['name']} (UID: {device['id']})")
for device in all_devices['output']:
print(f"Output: {device['name']} (UID: {device['id']})")
# Find specific devices by name
macbook_devices = detector.find_device_by_name("MacBook")
for device in macbook_devices:
print(f"Found device: {device['name']} - UID: {device['id']}")
# Get device statistics
stats = detector.get_device_count()
print(f"Total: {stats['total']} audio devices")
# List all devices with UIDs
audiomap
# List input devices only
audiomap --input-only
# List output devices only
audiomap --output-only
# JSON format output with UIDs
audiomap --json
# Find devices containing "MacBook"
audiomap --find "MacBook"
# Show device count only
audiomap --count-only
list_audio_input_devices()
Returns a list of all audio input devices with their unique identifiers.
Returns:
List[Dict[str, str]]
: Device list, each device contains:
id
: Device unique identifier (UID) - platform-specific formatname
: Human-readable device nameplatform
: Platform name ("Windows", "Darwin", "Linux")list_audio_output_devices()
Returns a list of all audio output devices with their unique identifiers.
Returns:
List[Dict[str, str]]
: Device list (same format as above)list_input_devices()
List all audio input devices.
list_output_devices()
List all audio output devices.
list_all_devices()
List all audio devices.
Returns:
{
"input": List[Dict[str, str]],
"output": List[Dict[str, str]]
}
get_device_count()
Get device count statistics.
Returns:
{
"input": int, # Number of input devices
"output": int, # Number of output devices
"total": int # Total number of devices
}
find_device_by_name(name, device_type="both")
Find devices by name.
Parameters:
name (str)
: Device name (supports partial matching)device_type (str)
: Device type, options: "input", "output", "both"pip install pycaw comtypes
sudo apt-get install alsa-utils
AudioMap provides comprehensive device UID support across all platforms:
Device UIDs (Unique Identifiers) are platform-specific strings that uniquely identify audio devices. Unlike device names which can change or be duplicated, UIDs provide a reliable way to target specific audio hardware.
devices = list_audio_input_devices()
for device in devices:
uid = device['id'] # Platform-specific unique identifier
name = device['name'] # Human-readable name
platform = device['platform'] # Platform identifier
print(f"Device: {name}")
print(f"UID: {uid}")
print(f"Platform: {platform}")
from audiomap import AudioDeviceDetector
from audiomap.exceptions import AudioDetectionError, DependencyMissingError
try:
detector = AudioDeviceDetector()
devices = detector.list_input_devices()
except DependencyMissingError as e:
print(f"Missing dependency: {e}")
except AudioDetectionError as e:
print(f"Detection error: {e}")
=== Audio Input Devices ===
Found 3 input devices:
1. MacBook Pro Microphone (UID: BuiltInMicrophoneDevice)
2. WH-1000XM6 (UID: 58-18-62-13-51-61:input)
3. BlackHole 2ch (UID: BlackHole2ch_UID)
=== Audio Output Devices ===
Found 4 output devices:
1. MacBook Pro Speakers (UID: BuiltInSpeakerDevice)
2. WH-1000XM6 (UID: 58-18-62-13-51-61:output)
3. BlackHole 2ch (UID: BlackHole2ch_UID)
4. Multi-Output Device (UID: ~:AMS2_StackedOutput:0)
git clone https://github.com/yourusername/audiomap.git
cd audiomap
pip install -e .[dev]
pytest tests/
python -m build
MIT License - see LICENSE file for details.
Issues and Pull Requests are welcome!
FAQs
Cross-platform audio device mapping with UID support
We found that audiomap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.