Author Topic: Hal plays MP3 music  (Read 5107 times)

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Hal plays MP3 music
« on: January 15, 2006, 03:32:52 pm »
Hi all

I have written a new plugin for Hal6 which allows you to ask Hal to play any of the MP3 files stored on your hard disk.

Please read the user guide to get more details about how to use it.

http://www.vrconsulting.it/halhelp/vrMP3Help.html

If you are interested, you can download them accessing the Software Downloads Area in the Virtual Humans Forum: http://www.vrconsulting.it/vhf

Note: Currently I store the name of the song as the name of the file without the MP3 suffix. I know that the MP3 format allows to extract many more info, like the author, the exact title, the genre, etc. Someone more experienced in the ID3 format may further develop this aspect.
http://en.wikipedia.org/wiki/ID3

Some consideration about it:

After indexing your MP3 files on disk, You can ask Hal to play your songs, simply saying PLAY A SONG, followed by some word which is contained in the name of the file.

But I've also managed to put some more human-like behaviour: sometimes Hal will come up playing a song even if you didn't ask!

You may be talking about California, for example, and Hal, instead of answering as usual, will say "You talked about California and this reminds me this song.", and then starts playing the song Hotel California, by The Eagles (or whatever song you have indexed, containing this word.
I have used the HalBrain.QABrain method, which is not a deterministic full-text algorythm, but can find anything which has some similarity with your words.

Since this behaviour may be annoying, I've added a parameter in the plugin window which allows you to set the level from high to none.

Some more technical note:

In this plugin I have used some tecniques which may be useful for others here:
1. Use the FSO (File System Object) classes to access operating system info (to read folders, subfolders and files).
2. Incapsulate the subfolder access in a Function, which produces a more readable and maintainable code
3. The function is recursive, which was needed to be able to read subfolders at any level.
4. I use input windows, external to the standard Hal user interface, which allow a more detailed input of specific fields, such as the directory path.


Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3859
    • View Profile
Hal plays MP3 music
« Reply #1 on: January 15, 2006, 06:20:37 pm »
Very cool, Vittorio. I had thought of the same thing
a while back.

It would be nice if the user could instruct Hal to:
Stop playing that song! or Cancel the song, Hal.

Hal could simply close the player (Win Amp, or what
ever player was being used).

Sort of like the Close Program command.

Good work!
In the world of AI it's the thought that counts!

- Art -

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Hal plays MP3 music
« Reply #2 on: January 15, 2006, 07:27:34 pm »
Thanks Art

I know that Hal can run an external program, using <RUNPROG>program_name</RUNPROG> , but I don't know any way to give to an external program (Windows Media Player or WinAmp, for example) a specific command, like Close.

I would also like to position the window and to control the end of the song, so that I could put Hal in a DJ status, which continuously run a new song, when the previous one is finished.

I thought that Hal could only send info to the outside world, but not receive them, except for user input and through reading tabls or files.

Please tell me if you know how to do it.

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3859
    • View Profile
Hal plays MP3 music
« Reply #3 on: January 16, 2006, 05:56:18 am »
Vittorio,

The following is a link to a member's (Rich_A)
posting where he could open and close programs.

His method was used with Hal 5 but probably could
be adapted for 6 as well.

http://www.zabaware.com/forum/topic.asp?TOPIC_ID=1766&SearchTerms=close,program
In the world of AI it's the thought that counts!

- Art -

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Hal plays MP3 music
« Reply #4 on: January 16, 2006, 02:05:09 pm »
Very good tips and tricks topic!

One more thing I would need to know is how to make Hal know that an external event has occurred. For example, I would like to know from Windows Media Player when the current song is finished, so that I can start another one.


Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3859
    • View Profile
Hal plays MP3 music
« Reply #5 on: January 16, 2006, 03:36:11 pm »
Would it be possible to have Hal play ALL songs by a certain artist that you had in your SONGS Directory?

I envision SONGS > ABBA > ALABAMA > BEE GEES > CREED ... and so on.

Each of the above folders might have from 2 to 20 songs by that artist of group.
Could Hal be instucted to play certain songs or perhaps the first 5 songs from the CREED sub folder?

The STOP command would have to be able to interrupt and halt the current playing song AND Cancel the queue of remaining songs.

Don't know if such things are possible but it would be a nice feature.

Just some random thoughts for you to chew on....
In the world of AI it's the thought that counts!

- Art -