Return to Level1Techs.com

A QT Transcription Audio Player

So far, i’ve been missing this app specifically and couldn’t dig something up. I’m a guitarist and learning songs by ear needs some specialized tools. Mainly a player that can play 1 song, change tempo and/or pitch quickly and often and allow for flexible infinite repeat of selected sections. I might add other features, but that’s the core.
I’ve not started yet, but will later today. I have no QT Workflow set up, but with Plasma being my Desktop of choice whenever i need something stable, it’s to logical choice. I really don’t want this to be a electron app.
I’m also not sure what i’m getting into when dealing with Audio Playback in Linux. We’ll see i guess.

That’s it so far. I’ve got experience with similar tools on Windows, so have a decent idea of a featureset i’d want. Now i just need to figure out how to make a working Linux Application out of it, package it as a flatpak or such and we’re done here. I’m 100% sure that this will blow past december, but i just want to get started with it.

8 Likes

Really cool idea. I play somewhat leisurely too, keen to give your creation it a shot!

1 Like

Subscribed.

1 Like

No Code so far. Spend my hour today figuring out, that QT Creator won’t work on KDE Neon… Installed KDevelop and made a sample Project that runs.

I initialized the repo though:

So, first code tomorrow. Still undecided on what combination of toolkit, language and toolchain would be optimal. And i really want QT Creator to work. I think the GUI Designer is much more intuitive than KDevelop. Might just intall Manjaro for that.
Other than that it’ll be a lot of trying to figure out how to translate my Win32 UI knowledge into QT. I really hope i can make a sample app with one button that plays audio tomorrow.

2 Likes

Sooo, it’s not much, but i spend the evening catching up on the hour didn’t do on december first. Added the second from today, so i’m now even.

There’s code in the repo!!! So stoked.
I made a quick manjaro install on my spare 500G SSD to get QTCreator working. This worked out of the box as planed.
Set up git and a new Project and went at it.
In it’s current state, we get a running application with a single button that can play a local file. The path to it is still absolute, as relative paths didn’t work for me. But non the less, progress was made and it included actual code and a LOT of research on basic QT.

I’m not 100% if this will help in the long run, as i’m not sure if QMediaPlayer supports playback rate or pitchshift. If it does, the rest should be pretty “straight forward”.

I now need to catch up on Signals and Slots. The next “milestones” would be,

  • getting the Readme Up-To-Date with a ToDo List
  • changing the play icon to pause when playing
  • a volume slider
  • a Progress bar
  • some type of File Selector
  • Research on Playback options (Looping sections, Playback Rate, Pitch Shifting)
  • Getting some kind of Visual representation of the Audio instead of a simple progress bar.

If there’s anyone with QT programming experience, i’ll take any hint or nugget of info here :wink:
For all the rest, Feedback is appreciated and happy devember.

5 Likes

So, did my hour today. Not Screenshots and i’m not able to sync the repo yet, as my Manjaro crashed. All progress is saved, but not uploaded yet. Will do tomorrow.

Some Progress was made. With the implementation of QMediaPlayer i was able to get Volume control to work. Sadly, the setPlaybackRate function doesn’t work for mp3’s, so that’s a dead end.

I now switched to QAudioDecoder, as this might offer the option to apply audio effects to the stream. For mp3 lame is needed, not sure how to package that (dependencies i’d think) and i’m only up to a GStreamer error, but that’s for tomorrow to figure out.

5 Likes

Did you like your experience with Qt Creator? Some of use use it at work here, I stick with emacs, but lately been trying to ditch the ancient baggage that it is. I was looking into VS Code, very customizable and easy to configure. Not that it applies to your specific case of UI builder. Sorry for off-topic I guess, just want to know how it feels as a C++ IDE.

1 Like

To be honest, i’d really only use it if you need the UI Builder tool. It’s a great IDE but to “big” for my taste. I’d personally also go with either VS Code or plain vim.
The Upside is, that it does a decent job at showing errors and explaining their cause. That’s helped me multiple times already in this project, as i’m not too good when it comes to c++.

So yeah, overall great experience, just a little to heavy for simple code editing.

2 Likes

Man this is WAY harder than expected…
Spend a bit over an hour today trying to get QAudioOutput and QAudioStream to work. I think i’m close but am still hitting some gstreamer warning and no audio output.

All the Signals and Slots stuff is still confusing as hell and most of the time i’m not even sure where stuff really goes. I guess i should take a step back and read up on how .h and .cpp files work, what does what and where i need to put stuff.
Just copy pasting SOF solutions isn’t working here.

What ever, code is up on github and i’ve got boxes to unpack, so that’s it for today. If anyone wants to look at my mess and maybe clue me in on how the files work in c++ projects, i’d be eternally gracefull.

On another note: I’m debating starting a second Project: a QT Frontend for Taskwarrior. It feels like this would let me work more with UI and the “Backend” stuff would be mostly text and json processing. Interested to hear what you think. Work on a second project to learn a different part, or focus on the current problem at hand and get that working first?

3 Likes

I’d be happy to help with any QT questions you have. My #devember2k18 project was with QT but I’ve been using QT for quite a few years both personally and professionally.

Is it just signals and slots you are having trouble with? I could put together a small demo app for you if it would help?

EDIT

I just had a look through your code and it looks like you are using automatic slot connections. I’ve always felt that that method wasn’t very intuitive because it’s based on naming methods and widgets in a very specific way.

You can also connect slots manually or visually through the UI designer. Personally I’ve always preferred either manual connection of using the UI designer (for trivial connections).

Let me know if a demo app showing the 3 different methods would help and I will put one together.

/EDIT

Shecks

4 Likes

Not gonna lie, but a “as simple as can be” demo would be awesome. Most QT Example projects are rather complicated already.

As far as i understand it now, Signals and Slots are basically inputs and outputs of objects. A Signal communitcates outwards, that something about that object changed, a Slot is an action happening to that object.

So, for a more specific example, i have a mediaPlayer Object. I can have a Signal that’s communicating outwards, that my Mediafile is playing. I could then have a Slot on a Slider for it’s position. If i connect them in the correct way, the sliders position could change based on the Media’s playback time.
That’s very simplified of course, but that’s my current idea of it. Feel free to correct me here.

So yeah, i’d take a sample project to further help my understanding of this. I’ll also take a look at your 2018 project. I’m pretty sure though, that my audio playback issue isn’t directly related to that.

2 Likes

No problem, I’ve created a repo on GitHub here that I will use for some Qt demos.

For the moment I have started a simple project for some signals and slots demos. I was trying to come up with an idea for for a simple application that I could use to demonstrate a couple of different things and thought that a little RGB colour picker would cover the signal/slot basics and shouldn’t have much code so will be easy to understand.

rgb-picker-demo-2-006

I have split the demos up into steps and each subsequent step will build on the previous one.

Step 1 is here

The first step is pretty much just what Qt Creator provides when you create a new Window based Qt Widgets application. I have just added some comments in the code to explain a little about the files that Qt generates and how the Qt Meta Object Compiler generates C++ from the Qt Designer UI files.

Step 2 is here

In step 2 I created a simple UI in Qt Designer and show how to connect signals and slots using the Qt Designer “Signal and Slot Editor”. This is useful for simple UI connections when you just need values to update or to trigger basic changes to the UI. No code needs to be added as Qt will generate the required connections for us.

Step 3 is here

I’ve added code to demonstrate the different ways to manually make connections between QObjects using the QObject::connect() method.

Step 4 is here

I’ve added code to show how to manually connect signals to custom slots defined on the MainWindow class. And how to reaction to signals from multiple UI widgets.

rgb-picker-demo-4-001

Anyway, take a look and let me know if this is helpful, if there are any other details I can help with or parts the I have missed.

Hope that helps.

Shecks

4 Likes

First off, this was massively helpfull. I didn’t grasp 100% of it yet, but i’m working through it. So far nothing needs to be added for me. I’ll let you know if i need anything more.

For anyone else, i’ll take a day off. We are moving and getting our old Apartment into shape is taking much more time than anticipated.
I’m working on getting into what @Shecks posted above, but didn’t find time to work on my own code.
I’ll see if i can sqeeze in my hour tomorrow. I’m really sorry, but real life comes first sometimes…

2 Likes

I’m really sorry for a lack of Updates in the past days. Life is a bit upside down atm with trying to manage two apartments, getting one ready for cats in under a week and having to do my normal job too.
I’m splitting my times up but am getting in my hour daily. There just hasn’t been anything to update about really. I’m still trying to get QAudioStream to work without success and can’t even play a music file at all. I’m getting a better understanding of how QT is supposed to work but have a hard time putting that into practice.

Adding to that, i’m probably just done with Plasma for good. I always come back, because customizability and blur or such, but in the end, it never worked for my production machine for me personally.
I’m really not sure what it is, but Plasma just starts to feel finicky after some time. Not as “stable” and coherent as gnome does. So, for my main work machine i went back to my tried and tested Fedora plus gnome setup. It’s not as flexible or sexy, but it works like i expect it too 100% of the time. I’m starting to feel like the gnome devs might be onto something with stripping stuff out of the DE…

So, the requirement for the App still is there and Devember is going on. I’m now debating moving to another platform. GTK certainly isn’t something i’m getting into in a few days. I’m really not sure what to do here.
Electron might not be my first choice, but might allow me to actually finish this project in December.

I’m open for input on this. I might also keep working on this as a qt app and just run it under gnome. Not sure how great of an idea that is though. Plus i’m not feeling like i’m getting anywhere with QT.

So yeah. Overall, pretty stuck and down after the initial hype. I’ll keep pushing. Just not sure in which direction yet.

3 Likes

I can’t help with advice but good on you for sticking with it. Keep mulling it over and an answer will come to you. Maybe not all the bells and whistles but if it works…who cares what it looks like. You can put in the bling later.

2 Likes

Is it QAudioStream specifically you are having trouble with or how to hook up the components to the UI?

I know you’re not using QMediaPlayer becasue your app needs more control over the audio playback but I’ve added another demo to my qt-demos repo that shows how to use QMediaPlayer for MP3 playback. It’s not exactly the same as what you are doing but it might be useful as a starting point.

audio-player-001
Note: The rewind and fast forward buttons don’t work yet :cowboy_hat_face:

It’s not much more difficult than the signals/slots demos (just a few more connections being made).

You can find the repo here if you are interested.

Shecks

1 Like