cause of pulseaudio file collisions in "nixos-rebuild switch"? - nixos

when I run nixos-rebuild switch, I get a bunch of messages about file collisions, for example
collision between `/nix/store/ngxigb4f3h819wslwfpg7gjb236911fg-pulseaudio-5.0/share/man/man1/pacmd.1.gz' and `/nix/store/bbdqbi3070jppr5rpydqyjsn3rb2xj8w-pulseaudio-5.0/share/man/man1/pacmd.1.gz' at /nix/store/9z6d76pz8rr7gci2n3igh5dqi7ac5xqj-builder.pl line 69.
they all appear to involve pulseaudio. Does this mean that I somehow have two pulseaudio packages installed? My /etc/nixos/configuration.nix has hardware.pulseaudio.enable = true; but doesn't reference pulseaudio in any other way.
Possibly it is somehow a conflict between the currently-running pulseaudio and the one post-configuration switch?

Collisions happen if two packages install the same file. If you're using unstable channel this issue was fixed for pulseaudio 4 days ago:https://github.com/NixOS/nixpkgs/pull/4683

Related

How to solve Raspberry Pi 3B & Bme280 Remote I/O error

Let me start off with the components used:
GPIO extension board to connect the raspberry pi to components
Bme280
Pi 3B
Problem description:
This problem was intermittent at first. We were receiving reading and the error occured out of nowhere, made adjustment to the sensor(taking out and putting it back in) which solved it but when we touch the sensor the error showed up again.
We decided to change the sensor and the problem turned from intermittent to persistent. Now we have this as permanent issue.
We removed the package for BME280 and SmBus2 and decided to reinstall it again.
RPI Bme280: https://pypi.org/project/RPi.bme280/
I followed this BME280 installation guide, however when prompting for 'i2cdetect -y 1' there were lines but no number showing up.
What has been confirmed so far:
Patching up of circuits was fine, tested with my lecturer pi and it
works fine.
Codes is fine, we even use the sample code provided by RPi.bme280
I2c was enabled everytime
Please help me because I am really lost. I needa submit this by next week so any help is appreciated.
Problem pic --> Picture of the problem
I've tried to respond, but there is a few pitfalls in SMBus and i2c, so to break the question into smaller bits I've quoted your original message with an indent. The response is provided beneath.
This problem was intermittent at first. We were receiving reading and the error occurred out of nowhere, made adjustment to the sensor(taking out and putting it back in) which solved it but when we touch the sensor the error showed up again.
I locked onto the statement, "Touched the sensor". Is there a chance the BME280 experienced an ESD discharge? And therefore is now partially or fully broken?
Are you using an ESD safe room? or at least ESD bracelet. You will not notice small ESD discharges, and for small electronics even a sub 1000V discharge can cause damage instantly or over time. (Fundamentals of Electrostatic Discarge - incompliancemag.com)
I followed this BME280 installation guide, however when prompting for 'i2cdetect -y 1' there were lines but no number showing up.
The I2Cdetect -y 1
Will send a ReadBit message to each possible slave 0-127. Then listens for the ACK on the slave address.
The message is very simple, but does the trick for detecting working i2c slaves.
As you stated there is no "Lines", i would suggest the slave either has issues responding, if the BME280 has the correct 3v3+GND supplied.
As another possability, could you redo this step dtparam=i2c_arm=on,i2c_baudrate=400000
(Set the baudrate way down to 10000 /10k. Should this solve the issue and you need higher bandwidth, attempt on "50000 /50k" or "100000 /100k") This is just to eliminate the possibility the slave cannot opperate on this high frequency. 400k Baudrate for SMBus is high for a prototype/testing scenario. Very small amounts of interference can corrupt the data over SDA.
Another possibility is the Sink-Current which i've learned the hard way is not the same on i2c and SMBus over i2c.
Is you Pull-up resistor appropriate for the limited sink-current?
The SMBus specifies a minimum sink current of 100µA, and a maximum of 350µA, compared to 3mA for the I²C bus (Ampere=Voltage/Resistance Ohm).
Now to the Software issue.
From your supplied picture on imgur.
File "newcodes_''''''''''''''.py" line 2, in
Your compiler cannot find "bme" where you attempt to import bme280. Reference/path issue?
This can be the cause for other issues further into the code calls.
I don't know what SW you are writing the code in, but if there is an option to insert a breakpoint and run a debug build. I would suggest starting there :)
Alright I have resolved the issue, I changed the wire from jumper wire to hard wire. Thank you guys for your response. I appreciate all of them :D

LIRC and audio bugging each other out on Raspbian

I'm having a problem with LIRC breaking audio on the OS scale after firing a command.
For example, I'd do:
irsend send_once Samsung_BN59-01224C KEY_VOLUMEUP --count=5
and afterwards, play an audio file, and the program governing that file would seize up and not play any sound. Same goes for a script I've written that uses the pygame library for python.
What's worse is that LIRC also stops firing correctly after this bug occurs. I can see infrared light being shot out of the diode, but there might be something off with the timing.
This happens both ways, so, after playing an audio file, LIRC will stop working but further playing of audio is possible.
The following extremely rarely but sometimes I'm able to play audio after LIRC finishes a command, and the result is heavily pitched down version of the original sound that cuts out after around a second or so.
Tested with different remotes, same results occur. I'm not sure if the fix that a user proposed in this thread could cause this (https://github.com/raspberrypi/linux/issues/2993) but I'm putting it out there that I used it, since unmodified LIRC has problems with both the receiver and transmitter turned on in /boot/config.txt. The rest of my installation is standard.
Fixed this by reverting the fix I posted in the last paragraph. Apparently using PWM for Infrared causes issues with onboard audio on raspbian. I commented out the lines responsible for the receiver and left the gpio-ir-tx option uncommented. Works fine with just the transmitter on.

Python3 scapy/kamene extremely slow

I was trying to use Pcap.net for some PCAP file analysis, which took around five seconds to loop through all available packets in a 1GB pcap file.
I'm now trying to use Scapy on Python3, which for whatever reason is called Kamene, but it's taking literally forever to parse the file, and CPU activity hits 100%, so I'm clearly doing something wrong. Here's the code:
from kamene.all import *
packetCount = 0
with PcapReader("C:\\Testing\\pcap\\maccdc2012_00000.pcap") as reader:
for packet in reader:
packetCount += 1
print(packetCount)
When running that, I get:
WARNING: No route found for IPv6 destination :: (no default route?).
This affects only IPv6
<UNIVERSAL><class 'kamene.asn1.asn1.ASN1_Class_metaclass'>
That UNIVERSAL message just gets repeated over and over, and after running for five minutes, I gave up. Does anyone have any idea on what is going on? Am I being dumb?
I've tried this on both Ubuntu and within Visual Studio on Windows (both virtualised)
First,l of all, you’re not using Scapy :/
from https://scapy.net
An independent fork of Scapy was created from v2.2.0 in 2015, aimed at
supporting only Python3 (scapy3k). The fork diverged, did not follow
evolutions and fixes, and has had its own life without contributions
back to Scapy. Unfortunately, it has been packaged as python3-scapy in
some distributions, and as scapy-python3 on PyPI leading to confusion
amongst users. It should not be the case anymore soon. Scapy supports
Python3 in addition to Python2 since 2.4.0. Scapy v2.4.0 should be
favored as the official Scapy code base. The fork has been renamed as
kamene.
Uninstall kamene and pip install scapy or pip3 install scapy (or get it from github) might help.
Once you've done that, you will find tips on how to speed up Scapy starting from 2.4.4 in the Performance section of the doc
That being said, Scapy isn’t designed to support very large amount of data (but rather aimed at being easy to implement). It will probably take some time to handle 1GB anyways :/ (Also, Python is slower than other languages (C) on such matters as packet dissection. You probably will never match Wireshark speed in Python)

Which version of linux has support for Dolby Advanced Audio v2?

I am using LENEVO G500 Laptop and my sound card has support for Dolby Advanced Audio v2 that works nicely in Windows OS (i.e. Windows 7, 8 and 8.1). However I have failed to enable Dolby sound effect in my Linux OS (have tried it with Linux Mint 17, Fedora 20).
Does anyone have an idea which linux version has support for this feature or how I can enable in a linux OS.
I would appreciate if you could direct me to the right direction.
Thanks.
I've googled out a very good advise on forums that helps me to achieve a Dolby like sound on my Kubuntu 19.04 with Lenovo g780.
Install PulseEffects https://github.com/wwmm/pulseeffects
(repos with deb files are here: https://github.com/wwmm/pulseeffects/wiki/Package-Repositories#debian--ubuntu)
Restart the user session or reboot after this, because PulseAudio will be upgraded, and it may cause problems if you don't restart.
Run PulseEffects and close it. It'll create all settings dirs on first launch. They required for next step.
Install PulseEffects-Presets from here: https://github.com/JackHack96/PulseEffects-Presets
(I've used the suggested script that automatically downloads them to PulseEffects import dirs, it will require flatpak that could be got from repos with sudo apt install flatpak)
Launch PulseEffects again. Select Convolver. Enable it. Click on wave button. You'll see a list of presets. Enable:
Dolby ATMOS ((128K MP3)) 1.Default.irs
Close the dialog and that's it. You can toggle Convolver in PulseEffects on and off while playng music to compare results. You may play with other presets as well.
For improving sound on a notebook or a tablet PulseEffects help pages come with a tuorial about how to achieve this.
App can be minimized to tray on GTK-enabled desktops with an additional application: https://github.com/boomshop/pulseffectstray
It's better enable autostart in app settings (it will copy it's desktop file to ~/.config/autostart with --gapplication-service command line. So next time start without GUI).
It is possible to get reasonably close to the Dolby Advanced Audio output on Linux.
TLDR:
Record the result of playing a -0dBFS impulse in Windows with all effects enabled. Save that as a wav file and use it as input to the PulseEffects Convolver.
Step-by-step:
Install Audacity in Windows.
Configure Audacity to use WASAPI
Select the loopback device as input
Select your laptop speakers as output, making sure all Dolby Advanced Audio effects are enabled.
Start recording
Play an impulse audio file (you might need to do this twice, Audacity often doesn't pick up the first impulse.
Zoom in and select the area around the recorded impulse (see screenshot below)
Export the selection as a WAV file and change the extension to irs
Import this irs file into the Convolver.
Some notes:
Audacity isn't required, presumably any software capable of recording from the output device will be fine.
To avoid any changes introduced by sample rate conversion, set the sample rate of the output and input devices in Windows to be the same.
When recording, in Step 5, Audacity would not record unless audio was playing. This is probably due to using WASAPI. Just start recording, play the impulse and if you don't see it in the recording output as a single spike, play it again.
The screenshot is quite heavily zoomed in so that you can see the area where there is data. When selecting what to export, try to make sure the selection is roughly centered around the central peak. It doesn't have to be perfect.
As a useful check to make sure what you are recording has been processed by Dolby Advanced Audio, you can disable all effects on the output device in Windows and record the impulse a second time. This should show up as a single peak sample and not the symmetric pattern.
After a bit of research I found this explanation that seems to have satisfied my query. It generally says ...
There isn't going to be an easy fix for this, unless Dolby releases a Linux driver or publishes more information on what exactly their software is doing (which is unlikely).
Haswell-ThinkPad-problems, linux-low-audio-quality
Beware that recently PulseEffects has changed it's name to EasyEffects, but PulseEffects-Presets hasn't updated it's config files to cover this change; Therefore this answer might not be applicable anymore.

(How) Can I get a stream of all sounds recorded from the microphone that my computer did not produce? (using PulseAudio or something else)

I've been playing around with some speech-to-text and text-to-speech systems, and am running into the problem that when the computer makes sounds that it can recognize, it starts taking commands from itself. To avoid this, I'd like a stream of all sounds picked up by the microphone that were not produced by the computer itself.
I see that PulseAudio has an echo cancellation module, but so far I have been unable to distinguish between its output and the raw microphone output: it still contains all the sounds picked up by the microphone that came from the computer speakers. I wonder if the default echo canceller is doing the opposite of what I want (i.e., it removes sounds heard by the microphone from being sent to the speakers).
Any idea how I can do this (preferably with pacmd)? I have thoroughly confused myself trying to specify non-default sources for the echo canceller, and have wandered into loopback modules and other things that are probably irrelevant. I know very little about PulseAudio, haven't found a good introduction to it (I've looked through much of the PulseAudio documentation but didn't see anything relevant), and might just be missing something simple. I feel frustrated that echo cancellation apparently doesn't work, I can't find documentation on it, and I can't find examples of it working from other people.
Thanks in advance for the help!
Other details that might be relevant: I'm running Ubuntu Saucy on a Lenovo Thinkpad T410. I'm using the built-in microphone and speakers (so, I'm pretty sure they're using the same sound card and I won't have clock drift issues). My actual application gets its sound through GStreamer, but GStreamer gets it from PulseAudio, and I don't think GStreamer itself has AEC capabilities. If there's a different way of doing this, I'd gladly switch to that.
Ah, I've got it! Merely loading the echo cancellation plugin isn't enough; you then need to start using it. In particular, it will only cancel echos of sounds passed into it, and if no sounds go through it, nothing will be cancelled. So, open /etc/pulse/default.pa and add the line
load-module module-echo-cancel
towards the bottom (I put it right after the line that loads module-filter-apply). Then, restart the PulseAudio daemon by running (as a non-root user) pulseaudio -k. Next, run pacmd to get a command line interface to PulseAudio, and give it the commands list-sources and list-sinks. Note the indices of the echo canceller in the responses. Edit /etc/pulse/default.pa again, and uncomment the two lines at the end about set-default, replacing the words input and output with the indices of the echo canceller's source and sink. Finally, restart PulseAudio again with pulseaudio -k (again, run as a non-root user).
Now, by default all sounds to be output get sent through the echo canceller before heading to the speakers, and all sounds to be input get pulled from the echo canceller after coming in through the microphone, and things actually work. You can verify that it's working by running pavucontrol and looking at the sound levels on the Input Devices screen (try playing some music and speaking, and note that the echo cancelled input shows normal sound levels when you speak but very low levels (verging on nothing) when you're silent but the music is playing).
This answer mostly comes from this post, which I wish I'd found weeks ago.

Resources