LOS ANGELES — Playing a skilled jazz pianist in the acclaimed “La La Land,” Ryan Gosling is seen actually working the keyboards, an aspect of the role that didn’t come easily.

Though he was no stranger to pianos before he was cast in “La La Land,” Gosling only played a little by ear, “nothing like the ability to play the jazz piano you see in the film — especially the Thelonious Monk or some of the other pieces I had to play,” he said.

Preparing to play Sebastian the jazz musician “was a lot of work,” Gosling said, “but also was a great opportunity. I had always wanted to play piano well — so I got to learn a lot, and made strides toward that goal. It took three hours a day of practicing for three months. It was a lot of practicing, but it was well worth it.”

The actor admitted he didn’t know very much about jazz before signing on to “La La Land,” a likely Oscar contender nominated for seven Golden Globes, including best picture and best actor for Gosling in the musical/comedy categories. One of the things that helped him brush up was “a great documentary that I watched on PBS, on jazz by Ken Burns. It was really wonderful and helped me a lot to understand a lot of things about the jazz world.”

One particular scene that has been resonating with critics and audiences as well depicts Gosling and his love interest, Mia (Emma Stone), in a lovely dance sequence in the moonlight — reminiscent of the waltzes executed by Fred Astaire and Ginger Rogers, back in the day.

“That one scene represented three months of hard work,” said Gosling. “First we worked separately for about two months, and then together for another month. Leading up to the actual shoot, we would go to the actual location for a few nights to practice.

“It wasn’t until we were shooting the scene for real that I allowed myself to look back and think about how far we had come to make that dance sequence work.”

However, the scene that will stick with him the most is one in which nether Gosling nor Stone have much to do.

“It was fun for me because I just to sit in my car and watch. I’m talking about that huge dance routine on the freeway,” he said. “The dancers really had it tough, but it was so worthwhile. They worked on the choreography for many months and then ended up filming on the hottest day of the year on a freeway they had rented out for us to use. As I watched all those great dancers dancing on the cars, I loved the fact I had a front-row seat to it all — and didn’t run the risk of messing it up!”