Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Rotary Encoder volume adjustment. #122

Open
chrisfromwa opened this issue Jun 11, 2018 · 17 comments
Open

Feature Request: Rotary Encoder volume adjustment. #122

chrisfromwa opened this issue Jun 11, 2018 · 17 comments
Assignees
Labels
future-enhancement Issues of this kind will have lower priority hardware Problems related to hardware pre-alpha52 pre-alpha52

Comments

@chrisfromwa
Copy link

Hello,
I was told to submit feature requests here, if this is not the correct area my apologies.

I have just learned of CrankShaft, and really liking what I see.
My goal with this, is to replace the stereo I currently have in my car.
I have a Raspberry PI3, and just purchased a WaveShare 7inch touch screen. This part all works perfectly!

Next is the audio portion, I purchased a HIFI Berry DAC pro, and able to get audio to my amps, but I have no way to control the volume level.

My Feature request:

  1. Enable a way to use a Rotary Encoder to adjust the volume and mute if the knob is pushed.
  2. When the volume level is changed, a popup display appears that show the current level of the volume
  3. When the PI is shutdown, and restarted. The previous volume level is remembered

I really hope this can be implemented, as this is something stopped me from going further in my custom install.

Thanks!
Chris

@Maju3
Copy link

Maju3 commented Jun 11, 2018

I agree with all of this.
Just for point 3:
What do you think about a setting for "start up volume"?
Just think about when you hear music very loud and then you shutdown the pi.
On next boot the volume would blow your ears;)

@chrisfromwa
Copy link
Author

That would work OK for me.

Another option, I remember back in the day. Alpine had a feature where if you had your volume say at 35 and shut off the car. The next time you started it up, it would start at 0 and gradually go back up to 35. It was a neat thing we all liked back then.

But I'm also OK with it starting at a startup volume

@Maju3
Copy link

Maju3 commented Jun 11, 2018

Oh you mean fading volume.
That would be very cool :)

@john-TC
Copy link

john-TC commented Jun 12, 2018

+1 for this feature

@x13-me
Copy link

x13-me commented Jun 15, 2018

In terms of implementation, this is very easy to do, just hook into Alsa's volume control

amixer -D pulse sset Master $1%+ where $1 is your chosen increment

As for the interface, you'd need to draw over the top layer, preferably somewhere away from the main viewport, i.e. in the "status bar", I'm not sure how to do that, but I'm sure someone else can figure it out, fork the code, then make a pull request.

@htruong what do you think of it?

@chrisfromwa
Copy link
Author

j-ak-e,
Thanks for your response. Could you go into a little more detail how we could get this working?
I'm new to the PI and CrankShaft.

Would love to see instructions for this added to the WIKI like volume buttons are.

@htruong htruong added future-enhancement Issues of this kind will have lower priority hardware Problems related to hardware labels Jun 23, 2018
@chrisfromwa
Copy link
Author

I'm now using Crankshaft NG
@hawkeyexp Could this be added into consideration for an added feature?

Summary

  1. Enable a way to use a Rotary Encoder to adjust the volume and mute if the knob is pushed.
  2. When the volume level is changed, a meter bar appears that displays the current volume level.

This is the one major item that is stopping me from replacing the entire head unit currently in the car.

@Richard6360
Copy link

should be easy as there are gpio pins for volume already, you only need to take up and down pulses from the rotary encoder for this to work i think. (dont know for sure i never used rotary encoders but i want too)

@inspector71
Copy link

Adding myself to the list of those interested in this option.

@byransays
Copy link

byransays commented Aug 29, 2018

I'm currently using a rotary encoder and a script I found on the internet that I've adjusted for the USB sound card. I just had surgery but when I get home I can post my setup for others.

edit: as promised, here is the site I used as reference: http://blog.amnuts.com/2017/01/11/rotary-volume-control-for-the-raspberry-pi/

in doing so, I used his code to make a python script for the USB sound card(likely it will be amixer "2" but you will have to make sure its that on your setup from the drop down menu in the settings). If you plan on using the built in audio then you may need to make adjustments with the amixer card number and the numid number. The page will help you figure all that out.

Once you have the file saved in the crankshaft folder in the boot partiton(mine is saved as volumecontrol.py) I added in "sudo python /boot/crankshaft/volumecontrol.py &" in the startup.sh file in the crankshaft folder.

It works well, but sometimes it seems like the built in audio changes on boot to a different card number, so the USB sound card isnt always card number 2 and it doesnt work. Generally a simple reboot fixes it.

Attached you will find my files.

volumecontrol.zip

@inspector71
Copy link

inspector71 commented Aug 30, 2018 via email

@n3ptr
Copy link

n3ptr commented Oct 1, 2018

I would like to +1 this idea.
putting together a system using crankshaft, and I'm morally opposed to push-button volume controls when space allows for a rotating knob.

Also, I hope that surgery went well, best wishes.

@inspector71
Copy link

inspector71 commented Oct 1, 2018 via email

@meekys
Copy link

meekys commented Dec 18, 2018

Hi all,
I've run into the same issues as the original poster.
I'm not (currently) running CrankShaft, just OpenAuto directly in Raspbian, but it should work (in theory at least)

For the hardware side of things, I was inspired by this, which just generates the volume up/down key-press events.
https://www.instructables.com/id/Digispark-Volume-Control/

And then I wrote the following which gives a nice overlay when the volume changes.
https://github.com/meekys/vol_overlay

I'm looking at switching over to Crankshaft soon, so hopefully I'll be able to confirm whether this 'just works' soon enough. Awesome project!

@hawkeyexp
Copy link
Collaborator

After christmas i will start to include a implemtation for csng :-)

@Zulu0001
Copy link

Zulu0001 commented Mar 9, 2019

hawkeyexp, you are doing a great job!!

I'm interested too in either this feature or an on screen slider while in AA

@matt2005 matt2005 added the pre-alpha52 pre-alpha52 label Oct 1, 2020
@matt2005
Copy link
Contributor

@chrisfromwa Rotary volume should work in alpha 6, there is a volume slider on the bottom on the main screen. Is this what you were after?

@matt2005 matt2005 self-assigned this Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future-enhancement Issues of this kind will have lower priority hardware Problems related to hardware pre-alpha52 pre-alpha52
Projects
None yet
Development

No branches or pull requests