PDA

View Full Version : open multiple music files?



hamlet
03-09-2004, 05:34 AM
Does anyone have an example of how to make a music player open more than a single tune, i.e. multiple mp3's wav files, etc.? I have went through the help files and can't find the info i'm looking for, then again i'm new to 5.0.

Brett
03-09-2004, 07:22 AM
Look at the help file for the action Audio.Load. There you will see that the first argument is the channel to load the music into. You can load and play up to 7 audio channels (Professional Edition) at once.

TJ_Tigger
03-09-2004, 08:26 AM
hamlet

Are you wanting to open and play them at the same time or are you looking to open (i.e., queue) them in an external player like WMP or WinAmp.

If it is the latter you could also look at using a playlist.

Tigg

hamlet
03-09-2004, 06:33 PM
I dont want to play the tunes all at once, just want to be able to select multiple songs to play one after another in an audio player i making with ams 5.0. would also like to be able to open playlists as .m3u, .pls.

TJ_Tigger
03-09-2004, 08:13 PM
I would look at the following commands

Dialog.FileBrowse (http://www.indigorose.com/webhelp/ams50/Program_Reference/Actions/Dialog.FileBrowse.htm) --this will allow you to select files to play in a player. You might want to allow multiple select.

Dialog.FolderBrowse (http://www.indigorose.com/webhelp/ams50/Program_Reference/Actions/Dialog.FolderBrowse.htm) along with
Find.File (http://www.indigorose.com/webhelp/ams50/Program_Reference/Actions/File.Find.htm) to load all files from a folder.

Are you going to store your files in a list box or keep them in a table like they are from the above actions.

For loading playlists, since most playlists that I have seen are text files you can use the following

TextFile.ReadtoTable (http://www.indigorose.com/webhelp/ams50/Program_Reference/Actions/TextFile.ReadToTable.htm)

The above actions store the found files in tables, I would look at how to enumerate a table

for index,value in mytable do
--perform some actions here
end

HTH
Tigg

hamlet
03-09-2004, 09:57 PM
the syntax in 5.0 is different than that of 4. I have read about the FileBrowse and FolderBrowse, but it doesn't show the actual string and syntax. Forgive me i'm an amateur trying to learn. What i need is how to make it open multiple files (.mp3, .ogg., .wav) and then play through the playlist one after another (no popping up asking if you wanna hear same song again). Thus far, i have only been able to get it to open a single tune at a time, and then stop after playing that song. I want it to open a folder that user selects, remember last folder, then play song 1, song 2, song 3, etc. through all songs selected.

TJ_Tigger
03-10-2004, 02:39 PM
Here is a file that I have updated for you. I have posted this in the past and hopefully it should answer a lot of questions for you.

Here is a quick overview of what you will see:
There is a button (Linkin Park covers) that will load songs in a music directory from the project folder into the list box. The files are loaded from a playlist in the same directory as the .ogg files. This uses the TextFile.ReadtoTable function to load the songs. It would require some additional work to allow your user to select playlists and parse them automatically. But the basic code is there.

There is a "Load Folder" button that will prompt the user for a directory to load and remember the last folder chosen while the project continues to run. It defaults to the music directory on the first go around (defined in the On Show actions for the page). This button will search for .ogg and .wav files, but uses a table to define the file extension for which you want to search. I did not add .mp3 because I was playing the files with the built-in audio player which does not support .mp3. If you play the files in the media player you can add in the *.mp3 to search for those as well.

To play a song, double-click on the song to start. When one song finishes, it will go to the next song in the list and start to play, if it is the last song in the list it will go back to the beginning.

What you see here is very basic code provided for learning purposes. There is a lot that could be added or improved on this code. The ability to select to play in order or a random order, to loop once the end of the songs have been reached, load folders, individual songs, and playlists all from the same button.

I hope this helps you in what you are trying to do.

Tigg

hamlet
03-11-2004, 05:44 AM
thanx tigger, nice prog. But what i want is a music player i create to open multiple files. thanx anyway.

TJ_Tigger
03-11-2004, 08:22 AM
As I said above

What you see here is very basic code provided for learning purposes.

The project was provided to help you learn how to work with the code in AMS5 so you can take what you learn and build your music playere the way you want it to be built. The above project will play the songs found in the list box. You need to double-click on the song in the listbox to have it play in the built-in audio player, which to reiterate will not play .mp3s. You can however, play them in the MediaPlayer object, which is a free plugin that can be found on autorun.org.

Tigg

Raj Kulshrestha
11-26-2005, 12:16 AM
As I said above


The project was provided to help you learn how to work with the code in AMS5 so you can take what you learn and build your music playere the way you want it to be built. The above project will play the songs found in the list box. You need to double-click on the song in the listbox to have it play in the built-in audio player, which to reiterate will not play .mp3s. You can however, play them in the MediaPlayer object, which is a free plugin that can be found on autorun.org.

Tigg

Hi Tigger,

Could you please send me the attachments or coding for opening and playing multiple files. I created an MP3 player and set audio channel to play all channels. I can select multiple files, but the player only plays one song.

Thanks

Raj