05-28-2024 11:24 AM
Hello, I need to create the following program:
Gather 18 wav files in three folders, each folder will be considered as a playlist. Design a front panel with the theme of an audio player that includes:
In general, the front panel should be customized to look like an audio player.
I have already managed to create the graphs and the array indicator that shows the names of all the songs, but I still can't get the slider and the buttons to work. Any help is greatly appreciated.
05-28-2024 11:51 AM
You didn't post any code or ask a specific question. I assume this code should also be able to actually play the songs out of the PC audio? Not just visualization?
What kind of programming pattern are you thinking of?
05-28-2024 11:58 AM
This is my code so far. But I can't get it to play all the files. I have a main folder and three subfolders within it, and within those three subfolders, I have 6 wav audio files in each one (18 in total). However, I don't know how to make it play all 18 audios in sequence.
05-28-2024 12:17 PM
I'm still using LabVIEW 2019 so I can't open your code, but I'm sure others will take a look.
If you want to maximize the help on this forum, you can always back-save your code to older versions. 2018 is a good choice.
File > Save for Previous... and select 2018 or so.
05-28-2024 03:21 PM
This is my block diagram so far. I managed to adjust the maximum value of the slider with a property node, but i dont know how to make it move according to the time of the song. When i run it, the slider doesnt move at all
05-28-2024 05:49 PM
You are new to the Forums, so you haven't seen responders yelling "Attach VIs, not pictures! We can't test, debug, modify a Picture ...". Of course, many of us aren't using the most recent version(s) of LabVIEW, so you need to "Save for Previous Version" and specify LabVIEW 2019 or 2021 for a better chance of getting an "expert" to look at (and maybe fix) your code. But no pictures, please.
Bob Schor
05-28-2024 06:24 PM
Sorry, it was my first time asking something here. I just started using labview. This is the vi for 19.0 version
05-28-2024 09:09 PM
I think your main problem is that you didn't quite get the operation of Recursive File List. I also am not quite sure about the structure of your data. Here's what I think you have:
Assume the above file scheme is correct. Start with a Path to the Top Level Folder (what I call the Folder of Folders). Pass this into "List Folder" -- you want to "construct" the paths to the three sub-folders. List Folder gives you (as outputs) Path Out (which is "Folder of Folders") and an Array "Folder Names" (which should be the strings "Folder 1", "Folder 2", and "Folder 3").
You now want to process the "Array of 3 folders". What do you do when you want to process the elements of an Array? Right, you drop a For Loop. Wire in "Path Out" (which comes in on an "ordinary" tunnel) and the array "Folder Names" (which becomes an Indexing Tunnel, automatically). What do you wire to "N"? Nothing, having an Array input makes N process each element of the Array. [Oops -- I forgot to mention you should also wire the Error Line into the For loop].
So now you are "inside the (first) For Loop", with a Path to a Folder, and the name of a sub-Folder of that folder. How do you put the two together to get the name of the "Folder of 6 Files"? [Hint -- it's on the File menu, and will give you another Path to the sub-Folder.
So you have the path to the sub-Folder. What do you want? You want the files in the sub-Folder. Pass the path to List Folder, where you want the files in this sub-Folder. You want to process the Array of Files, knowing the sub-Folder where they are found. What do you do? [Sound familiar?]. I hope you say "Drop another For Loop, bring in the sub-Folder, the Array of Files, and the Error Line, combine to get a path to the File in the sub-Folder, and play it. Maybe put a 3-second Wait after you play the file, after which it will play File 2, then 3, then 4, then 5, then 6, and that finishes the innermost For for the first sub-Folder, then you'll do the 6 files of the second sub-folder, and so on.
Give it a try.
Bob Schor
05-29-2024 12:18 PM
Help, I need to create a program that plays the audio files within a folder, and with buttons, it performs the following actions: Play (plays the current track or resumes playback after a pause), Pause (stops the playback sequence until the user presses the pause or play button again), Stop (stops the playback sequence, after which only pressing play will resume playback from the first song in the playlist, i.e., from the folder).
I have an idea for the state machine design, but I'm not quite sure how to implement it. First, the user runs the program, and the audio files start playing automatically in the order they are in the folder, and when the audio finishes, the program execution ends (this part is already done).
Here the state machine with its case structure and event structure comes into play. State 1 is playback, and the program remains in this state until a change occurs. If the play button is True, the program does nothing because the audio is already playing; if the play button is False, the program does nothing. If the pause button is pressed and it is True, the audio playback is paused, and the program changes to state 2; if the pause button is False, the program does nothing. If the stop button is pressed and it is True, the audio playback is paused, and the program changes to state 3; if the stop button is False, the program does nothing.
State 2 is pause. If the play button is pressed and it is True, the program plays the song and returns to state 1; if the play button is False, the program does nothing. If the pause button is True, the program does nothing; if the pause button is pressed and it is False, the program plays the song and returns to state 1. If the stop button is pressed and it is True, the program changes to state 3; if stop is False, the program does nothing.
State 3 is stop. If the play button is pressed and it is True, the program should return to the beginning of the playlist, i.e., it should play the first audio from the beginning; if the play button is False, the program does nothing. In this state, it does not matter if the pause and stop buttons are true or false, as the only button that can resume the program is play.
That's my idea, but I don't know how to implement it in an event-driven state machine. My main question is not so much about how to change from one state to another, it's more about how to pause and resume playback. From which sound -> output function can this be obtained? I was thinking of the info function that tells me if the audio is playing. Or connecting it to the stop function in some way to my case to stop the execution, but I already tried it, and it doesn't work for me. Any help is appreciated.
05-29-2024 02:28 PM
I try to implement my idea, but now the sound doesnt play and nothing happens when i press play, pause or stop. Please help me, I dont know what else to do
This is the 19.0 version of my code