How do I change the dimensions of AKKeyboardView ?

76 views
Skip to first unread message

wooc...@gmail.com

unread,
Jan 10, 2017, 4:09:21 AM1/10/17
to AudioKit Users Group


Was this made for piano players who bite their fingernails ? No, but I sure would like them keys to grow a bit longer.


How do I change the dimensions of AKKeyboardView ? I can change the width by decreasing the StackView.widthAnchor.constraint. But I can’t increase the height by increasing the stackView.heightAnchor.constraint. Is there another way to make the keys longer ?


Here's my code


        let stackView           = UIStackView()
        stackView.axis          = .horizontal
        stackView.distribution  = .fillProportionally
        stackView.alignment     = .center
        stackView.translatesAutoresizingMaskIntoConstraints = false

        let keyboardView        = AKKeyboardView()
        keyboardView.delegate   = self
        
        stackView.addArrangedSubview(keyboardView)

        stackView.widthAnchor.constraint(equalToConstant: view.frame.width * 0.85).isActive = true
        stackView.heightAnchor.constraint(equalToConstant: view.frame.height * 2.0).isActive = true





Aurelius Prochazka Ph.D.

unread,
Jan 10, 2017, 4:12:11 AM1/10/17
to AudioKit Users Group
You're sticking it in a stack view that is trying to define the height.  The playgrounds and the synth audiobus example both have keyboards that scale properly.  So, it's you. :)

In any event, I'm rewriting the keyboard view and it will be better soon.

Aure

wooc...@gmail.com

unread,
Jan 10, 2017, 2:13:30 PM1/10/17
to AudioKit Users Group
Aure, do you mean SenderSynth ? That's was the starting point for my code. I made a few changes which is probably where things went a bit strange. For your information, the image in the previous post was rendered on an iPhone 7. And here's the same code on an iPhone 5. 

As you're planning to rewrite the keyboard view, it might be worth mentioning two things I am about to try. 


Firstly I am going to try and scroll between octaves as soon as I work through an example of scroll view. Scrolling left and right to lower and upper octaves seems very intuitive from a user's perspective. I have not started on this yet. 


Secondly, I am also keen to detune the keyboard. I have already written and tested code to generate a detuned 10+ octave MIDI map with frequencies generated from Scala scl and kbm files and that is what I am trying to hook up at the moment. AKKeyboardView would become a microtonal keyboard capable of playing any of the 4000+ traditional and experimental scales found in the Scala scales archive. If you don't already have a way to do this in AudioKit and would be interested, let me know and I'll try and put it on the GitHub.

Reply all
Reply to author
Forward
0 new messages