Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sheerpython

Setting up a second keyboard as a soundboard on linux

Recommended Posts

Posted · Original PosterOP

Hello i have been trying to setup a second keyboard as a soundboard in manjaro for the past two days but i can't figure it out.

What i have tried is using actkbd to detect the keypresses only on the second keyboard and then running the play command from sox to try and play sound like this:

30:::play /soundboard/sound.mp3

But when trying this i get the error:

ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave

First i tought it was a problem with it running in root so i changed the command to:

30:::sudo -u roy play /soundboard/message.mp3

But with this the exact same error occurred. On which I have been stuck, when I run 'play /soundboard/sound.mp3' manually in my terminal it works without any problems. I have also tried other sound playing libraries but they are giving me the same error as the one above. Trying it with a small piece of python also didn't fix the problem : /. I hope someone here knows a potential solution to the problem I am having, and is able to help me / try to help me with it.

 

Greetings,

Roy

Link to post
Share on other sites
1 hour ago, Sheerpython said:

That's a really old project (the last commit is from 6 years ago and the readme mentions Linux 2.6), I wouldn't really trust it. Also running audio operations as root or with sudo (even when sudoing as a regular user) is ultra sketchy, avoid it. If you must use a dedicated daemon try this instead, at least it's actively maintained.

 

What version of Manjaro are you using? Most desktop environments have a pretty good shortcut manager bundled with them, try using that instead.


...is there a question here? 🤔

sudo chmod -R 000 /*

What is scaling and how does it work? Asus PB287Q unboxing! Console alternatives :D Watch Netflix with Kodi on Arch Linux Sharing folders over the internet using SSH Beginner's Guide To LTT (by iamdarkyoshi)

Sauron'stm Product Scores:

Spoiler

Just a list of my personal scores for some products, in no particular order, with brief comments. I just got the idea to do them so they aren't many for now :)

Don't take these as complete reviews or final truths - they are just my personal impressions on products I may or may not have used, summed up in a couple of sentences and a rough score. All scores take into account the unit's price and time of release, heavily so, therefore don't expect absolute performance to be reflected here.

 

-Lenovo Thinkpad X220 - [8/10]

Spoiler

A durable and reliable machine that is relatively lightweight, has all the hardware it needs to never feel sluggish and has a great IPS matte screen. Downsides are mostly due to its age, most notably the screen resolution of 1366x768 and usb 2.0 ports.

 

-Apple Macbook (2015) - [Garbage -/10]

Spoiler

From my perspective, this product has no redeeming factors given its price and the competition. It is underpowered, overpriced, impractical due to its single port and is made redundant even by Apple's own iPad pro line.

 

-OnePlus X - [7/10]

Spoiler

A good phone for the price. It does everything I (and most people) need without being sluggish and has no particularly bad flaws. The lack of recent software updates and relatively barebones feature kit (most notably the lack of 5GHz wifi, biometric sensors and backlight for the capacitive buttons) prevent it from being exceptional.

 

-Microsoft Surface Book 2 - [Garbage - -/10]

Spoiler

Overpriced and rushed, offers nothing notable compared to the competition, doesn't come with an adequate charger despite the premium price. Worse than the Macbook for not even offering the small plus sides of having macOS. Buy a Razer Blade if you want high performance in a (relatively) light package.

 

-Intel Core i7 2600/k - [9/10]

Spoiler

Quite possibly Intel's best product launch ever. It had all the bleeding edge features of the time, it came with a very significant performance improvement over its predecessor and it had a soldered heatspreader, allowing for efficient cooling and great overclocking. Even the "locked" version could be overclocked through the multiplier within (quite reasonable) limits.

 

-Apple iPad Pro - [5/10]

Spoiler

A pretty good product, sunk by its price (plus the extra cost of the physical keyboard and the pencil). Buy it if you don't mind the Apple tax and are looking for a very light office machine with an excellent digitizer. Particularly good for rich students. Bad for cheap tinkerers like myself.

 

 

Link to post
Share on other sites
Posted · Original PosterOP

Thank you for responding : )

I am running Manjaro 18.1.5 and I have just tried running sxhkd which i got to play sound when pressing a key. The problem with this daemon is that it doesn't work keyboard specific. It's listening on both keyboards and i can't find a way to make it listen to just one. I also looked at the build in shortcut manager but that also doesn't seem to support it. Did i possibly miss something at the sxhkd deamon?

Link to post
Share on other sites
45 minutes ago, Sheerpython said:

Thank you for responding : )

I am running Manjaro 18.1.5 and I have just tried running sxhkd which i got to play sound when pressing a key. The problem with this daemon is that it doesn't work keyboard specific. It's listening on both keyboards and i can't find a way to make it listen to just one. I also looked at the build in shortcut manager but that also doesn't seem to support it. Did i possibly miss something at the sxhkd deamon?

You could try a custom mapping using xmodmap and bind all keys on the second keyboard to unused unicode symbols, then map those symbols to the shortcuts you want. I think sxhkd can't tell the difference between the two keyboards because it uses symbols rather than keycodes but this workaround should allow you to use it anyway.


...is there a question here? 🤔

sudo chmod -R 000 /*

What is scaling and how does it work? Asus PB287Q unboxing! Console alternatives :D Watch Netflix with Kodi on Arch Linux Sharing folders over the internet using SSH Beginner's Guide To LTT (by iamdarkyoshi)

Sauron'stm Product Scores:

Spoiler

Just a list of my personal scores for some products, in no particular order, with brief comments. I just got the idea to do them so they aren't many for now :)

Don't take these as complete reviews or final truths - they are just my personal impressions on products I may or may not have used, summed up in a couple of sentences and a rough score. All scores take into account the unit's price and time of release, heavily so, therefore don't expect absolute performance to be reflected here.

 

-Lenovo Thinkpad X220 - [8/10]

Spoiler

A durable and reliable machine that is relatively lightweight, has all the hardware it needs to never feel sluggish and has a great IPS matte screen. Downsides are mostly due to its age, most notably the screen resolution of 1366x768 and usb 2.0 ports.

 

-Apple Macbook (2015) - [Garbage -/10]

Spoiler

From my perspective, this product has no redeeming factors given its price and the competition. It is underpowered, overpriced, impractical due to its single port and is made redundant even by Apple's own iPad pro line.

 

-OnePlus X - [7/10]

Spoiler

A good phone for the price. It does everything I (and most people) need without being sluggish and has no particularly bad flaws. The lack of recent software updates and relatively barebones feature kit (most notably the lack of 5GHz wifi, biometric sensors and backlight for the capacitive buttons) prevent it from being exceptional.

 

-Microsoft Surface Book 2 - [Garbage - -/10]

Spoiler

Overpriced and rushed, offers nothing notable compared to the competition, doesn't come with an adequate charger despite the premium price. Worse than the Macbook for not even offering the small plus sides of having macOS. Buy a Razer Blade if you want high performance in a (relatively) light package.

 

-Intel Core i7 2600/k - [9/10]

Spoiler

Quite possibly Intel's best product launch ever. It had all the bleeding edge features of the time, it came with a very significant performance improvement over its predecessor and it had a soldered heatspreader, allowing for efficient cooling and great overclocking. Even the "locked" version could be overclocked through the multiplier within (quite reasonable) limits.

 

-Apple iPad Pro - [5/10]

Spoiler

A pretty good product, sunk by its price (plus the extra cost of the physical keyboard and the pencil). Buy it if you don't mind the Apple tax and are looking for a very light office machine with an excellent digitizer. Particularly good for rich students. Bad for cheap tinkerers like myself.

 

 

Link to post
Share on other sites
Posted · Original PosterOP
15 hours ago, Sauron said:

You could try a custom mapping using xmodmap and bind all keys on the second keyboard to unused unicode symbols, then map those symbols to the shortcuts you want. I think sxhkd can't tell the difference between the two keyboards because it uses symbols rather than keycodes but this workaround should allow you to use it anyway.

I looked at the post you send me and i think you meant XKB instead of xmodmap but the question that i currently have is, is there a way i can just put the second keyboard in russian or chinese? (Something I will never use)

Link to post
Share on other sites
9 hours ago, Sheerpython said:

the question that i currently have is, is there a way i can just put the second keyboard in russian or chinese? (Something I will never use)

...maybe? I mean in theory sure, I don't know if there's a program that lets you do it automatically though. You could use XKB (I did mean that and not xmodmap) and use a python script to generate the correct bindings. Maybe there are premade mappings you can copy, all you'd have to to would be to change the regex to match your device.


...is there a question here? 🤔

sudo chmod -R 000 /*

What is scaling and how does it work? Asus PB287Q unboxing! Console alternatives :D Watch Netflix with Kodi on Arch Linux Sharing folders over the internet using SSH Beginner's Guide To LTT (by iamdarkyoshi)

Sauron'stm Product Scores:

Spoiler

Just a list of my personal scores for some products, in no particular order, with brief comments. I just got the idea to do them so they aren't many for now :)

Don't take these as complete reviews or final truths - they are just my personal impressions on products I may or may not have used, summed up in a couple of sentences and a rough score. All scores take into account the unit's price and time of release, heavily so, therefore don't expect absolute performance to be reflected here.

 

-Lenovo Thinkpad X220 - [8/10]

Spoiler

A durable and reliable machine that is relatively lightweight, has all the hardware it needs to never feel sluggish and has a great IPS matte screen. Downsides are mostly due to its age, most notably the screen resolution of 1366x768 and usb 2.0 ports.

 

-Apple Macbook (2015) - [Garbage -/10]

Spoiler

From my perspective, this product has no redeeming factors given its price and the competition. It is underpowered, overpriced, impractical due to its single port and is made redundant even by Apple's own iPad pro line.

 

-OnePlus X - [7/10]

Spoiler

A good phone for the price. It does everything I (and most people) need without being sluggish and has no particularly bad flaws. The lack of recent software updates and relatively barebones feature kit (most notably the lack of 5GHz wifi, biometric sensors and backlight for the capacitive buttons) prevent it from being exceptional.

 

-Microsoft Surface Book 2 - [Garbage - -/10]

Spoiler

Overpriced and rushed, offers nothing notable compared to the competition, doesn't come with an adequate charger despite the premium price. Worse than the Macbook for not even offering the small plus sides of having macOS. Buy a Razer Blade if you want high performance in a (relatively) light package.

 

-Intel Core i7 2600/k - [9/10]

Spoiler

Quite possibly Intel's best product launch ever. It had all the bleeding edge features of the time, it came with a very significant performance improvement over its predecessor and it had a soldered heatspreader, allowing for efficient cooling and great overclocking. Even the "locked" version could be overclocked through the multiplier within (quite reasonable) limits.

 

-Apple iPad Pro - [5/10]

Spoiler

A pretty good product, sunk by its price (plus the extra cost of the physical keyboard and the pencil). Buy it if you don't mind the Apple tax and are looking for a very light office machine with an excellent digitizer. Particularly good for rich students. Bad for cheap tinkerers like myself.

 

 

Link to post
Share on other sites

Use xinput to list devices, on manjaro you need to install xorg-xinput, then do setxkbmap -device xinput_device_id ru

That will set it to russian but you can get a keymap list with localectl list-x11-keymap-layouts

 

autokey(aur) has a gui and can run scripts /  commands on key input.

system.exec_command("command")


OS: Manjaro Linux CPU: Ryzen 3600 @ 4.2 Ghz 1.32v Motherboard: Asus Crosshair VI Hero X370 RAM: 2x8GB Corsair Vengeance RGB Pro @ 3600 CL16 GPU: AMD Radeon 5700XT

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×