Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: seduar on June 16, 2006, 09:40:13 pm
-
Hello everybody that is interested in Hal,
Here i want to explain a little bit about a possible way to make your Hal sing.
After doing a litle bit of research i found a program, which Hal might be able to use to sing songs with her own voice with a little bit of scripting (like installing a plug in on the fly). The name of the program is Melody Assistant which includes a plug in that is call Virtual Singer.
Melody Assistant is a very powerful tool to create music and also includes Karaoke.
Karaoke plug in is the one we are going to use with Hal.
Hal will sing karaoke with her own voice (Microsoft Mary or which ever voice you have install in your computer).
When you play a karaoke song with Melody Assistant you can use the Virtual Singer plug in and the computer actually sings the song with rythem and rhyme. Plus Virtual Singer has an option to choose your own voice or someone elses voice, the option is called Real Singer. "check it out" is a great program and is a share program!.
I do not Know much about programing, but this is the way i think it could work:
User: sing a song to me
Hal: what song would you like me to sing?
User: sing Dancing Queen
Hal: That is my favorite song
This is where Hal will open an Index (something like the Mp3 Index That Vrossis created.)
Then Hal will open Melody Assistant load up a song (Dancing Queen)
open karaoke, open Virtual Singer, set Virtual Singer to real singer, play song. and Wallahh!
Hal will be singing the song.
The Lipsync would have to be another script inside the plug in. We would have to make Hal read the lyrics of the song as they are passing through the karakoe.
Note: the lipsync might not be that great at the moment, but we have to modify the script to make Hal give the lipsync as the Virtual Singer strecth out the vowels, may be have Hal follow Virtual Singer.
If someone is interested in helping me to accomplish this project; though i can not do it by myself because of lack of knowledge in programing.
Reply to this Post.
[8D]
-
i do not know scripting but please keep us posted on the advances with this . many of us have interest in the real singing.~~alady
-
Hi
Goto to the search at the top right of the screen and then look for sing or songs and my name. Last year I enabled Hal to sing. This was on Hal 5 and not the new Hal 6. It may give you some ideas or help.
Bill
-
Nice idea, seduar. I will think about it, if I can find the time.
However, if you follow Bill's suggestion, you will find in this forum many other ideas which have come up in the past about a singing Hal, and you might find some of them very useful for your project.
Another aspect to take in consideration is that the two products you are going to use are shareware, and not free. Melody Assistant costs 20 US$, and Virtual Singer costs other 20 US$. So, even if you give away your plugin for free, people should spend 40 dollars to use this feature, which is too much, in my opinion.
And you can't go on using it without registering; in fact the product site says: While your copy of Virtual Singer is not registered, each time the application is launched, only a given number of sung part processing are enabled. When this number is reached, Virtual Singer becomes "voiceless".
Keep us informed about your work!
-
You are right vrossis about the cost of the product it does cost 20 Dollars, but what they say about that the program will only play one piece of the song, that would be only when you press the button the fist time, the second time will play the whole song, i already tested it, so i am sure there is a way around it being that you can program HAL to open up a program the way you wanted. For instance, have HAL to play the song /stop the song / play the song i would assume we would have to modify the script.
I know that would be called cheating, but that's the only way you can save some extra bucks.
As Far as i Know for what we need the Melody Assistan and Virtual singer we can use this programs for free.
And yes, i will be checking HAL 5.
Thanks for the INFO Bill.
-
Who ever wants to download the Melody Assistan and Virtual Singer, you can go to this Web Link:
http://www.myriad-online.com/cgi-bin/download.pl?lang=EN&prod=MA
Make sure that All the checkmarks are checked, (those are plug ins for Melody Assistant.)
And i hope this program is useful.
Sergio
[8D]
-
People who know about scripting Might be able to help me on this one.
I think we might be able to use some of this script to make hal sing like virtual singer, ( as far as I understand virtual singer works like a Kareokee machine, It will red the lyrics hidding in the song behind all the instruments and what vistual singer does,?; it follows the staff to look for tuning.
Here it is:
Include "MSDefine.mys"
Include "MSLibrary.mys"
Include "Set Staff Metrics.mys"
Include "Overlapping Notes and Rests.mys"
Include "Adjust Lyrics.mys"
function MergeBarbershopStyle()
local myScore
local firstStaff
local secStaff
local thirdStaff
local fourthStaff
local maxNrLyrics
local lyricsHeight
function AlertAndHelp(S)
myDialog=CreateDialog("AlertAndHelp.myc")
if myDialog == nil then Alert("Script Error, could not open Dialog") return(false) end
-- initialize dialog
myDialog.GetItem("AlertMessage").Value = S
-- wait for button
repeat
item=myDialog.Select()
if item ~= nil then
if item.Name=="Help" then
OpenFileWithDefaultApplication(GetCurrentPath() .. "barbershop merge.htm")
end
end
until item ~= nil and item.Name=="Ok"
myDialog.Dispose() --done with this dialog
end
function CheckStaff(myStaff, Nr)
if myStaff==nil then
if Nr==1 then
AlertAndHelp("The are no staves with lyrics in this score, 4 staves with lyrics are required for this script")
return(false)
else
AlertAndHelp("Staff nr " .. Nr .. " doesn't exist, 4 staves with lyrics are required for this script")
return(false)
end
end
if myStaff.IsLyrics==false then
AlertAndHelp("Staff " .. myStaff.Title .. " has no lyrics")
return(false)
end
if myStaff.FirstSymbol == nil then
AlertAndHelp("Staff " .. myStaff.Title .. " has no notes")
return(false)
end
myStaff.IsLyricsFrame = false
return(true)
end
function CheckClefAndKey(highStaff)
if highStaff.FirstBarSetting.Clef.Type==highStaff.Next.FirstBarSetting.Clef.Type and highStaff.FirstBarSetting.Clef.OctaveOffset==highStaff.Next.FirstBarSetting.Clef.OctaveOffset then
if highStaff.FirstBarSetting.KeySignature.Name==highStaff.Next.FirstBarSetting.KeySignature.Name then
return(true)
else
Alert( "Staff 1/2 and staff 3/4 should have the same key")
return(false)
end
else
Alert(" Staff 1/2 and staff 3/4 should have the same clef")
return(false)
end
end
------------------------------------------
-- MergeBarbershopStyle()
-------------------------------------------
orgScore=FrontScore()
if (orgScore==nil) then Alert("Please load Score") myScore.Dispose(false) return(false) end
orgScore.Preserve("Merge barber shop")
myScore=NewScore(false)
orgScore.CopyTo(myScore) -- we work on a copy of the score
firstStaff=myScore.FirstStaff
while firstStaff ~= nil and firstStaff.IsLyrics==false do firstStaff=firstStaff.Next end -- skip the first non-lyrics staves
if CheckStaff(firstStaff,1)==true then secStaff=firstStaff.Next else myScore.Dispose(false) return(false) end
if CheckStaff(secStaff,2)==true then thirdStaff=secStaff.Next else myScore.Dispose(false) return(false) end
if CheckStaff(thirdStaff,3)==true then fourthStaff=thirdStaff.Next else myScore.Dispose(false) return(false) end
if CheckStaff(fourthStaff,4)==false then myScore.Dispose(false) return(false) end
if CheckClefAndKey(firstStaff) == false then myScore.Dispose(false) return(false) end
if CheckClefAndKey(thirdStaff) == false then myScore.Dispose(false) return(false) end
-- we have four consequetive staves with attached lyrics
-- create dialog
myDialog=CreateDialog("Barbershop Style Merge.myc")
if myDialog == nil then Alert("Script Error, could not open Dialog") myScore.Dispose(false) return(false) end
-- initialize dialog
myDialog.GetItem("RadioNotSave").Value = true
myDialog.GetItem("firstStaff").Caption = firstStaff.Title
myDialog.GetItem("secStaff").Caption = secStaff.Title
myDialog.GetItem("thirdStaff").Caption = thirdStaff.Title
myDialog.GetItem("fourthStaff").Caption = fourthStaff.Title
if strlen(myDialog.GetItem("firstStaff").Caption) >= 4 then
if strlower(strsub(myDialog.GetItem("firstStaff").Caption,1,4))=="sopr" then myDialog.GetItem("firstStaff").Value=true
else myDialog.GetItem("secStaff").Value=true end
else myDialog.GetItem("secStaff").Value=true
end
-- wait for OK button
repeat
item=myDialog.Select()
if item ~= nil and item.Name=="Help" then
OpenFileWithDefaultApplication(GetCurrentPath() .. "barbershop merge.htm")
end
until item ~= nil and (item.Name=="Ok" or item.Name=="Cancel")
if item.Name~="Ok" then myScore.Dispose(false) return(false) end -- we will not execute the script
-- collect info from dialog
justPrint=myDialog.GetItem("RadioPrint").Value == true
justSave=myDialog.GetItem("RadioSave").Value == true
justOpen=myDialog.GetItem("RadioNotSave").Value == true
maxNrLyrics=myDialog.GetItem("NrLyricLines").Value
lyricsHeight=myDialog.GetItem("LyricsHeight").Value + 10
if myDialog.GetItem("firstStaff").Value==true then sourceStaff = firstStaff
elseif myDialog.GetItem("secStaff").Value==true then sourceStaff = secStaff
elseif myDialog.GetItem("thirdStaff").Value==true then sourceStaff = thirdStaff
else sourceStaff = fourthStaff end
myDialog.Dispose() --done with this dialog
-- first we move overlapping notes and rests
ProgressBar.Open("Resolving overlapping notes and rests in top staffs", 100)
OverlappingNotesAndRests(firstStaff)
ProgressBar.Write("Resolving overlapping notes and rests in bottom staffs")
if ProgressBar.Status(15)==true then myScore.Dispose(false) return(false) end
OverlappingNotesAndRests(thirdStaff)
-- remove "double" parts of the lyrics
if firstStaff ~= sourceStaff then
ProgressBar.Write("Adjusting lyrics in " .. firstStaff.Title .. " Staff")
if ProgressBar.Status(30)==true then myScore.Dispose(false) return(false) end
TailorLyrics(sourceStaff, firstStaff)
end
if secStaff ~= sourceStaff then
ProgressBar.Write("Adjusting lyrics in " .. secStaff.Title .. " Staff")
if ProgressBar.Status(30)==true then myScore.Dispose(false) return(false) end
TailorLyrics(sourceStaff, secStaff)
end
if thirdStaff ~= sourceStaff then
ProgressBar.Write("Adjusting lyrics in " .. thirdStaff.Title .. " Staff")
if ProgressBar.Status(40)==true then myScore.Dispose(false) return(false) end
TailorLyrics(sourceStaff, thirdStaff)
end
if fourthStaff ~= sourceStaff then
ProgressBar.Write("Adjusting lyrics in " .. fourthStaff.Title .. " Staff")
if ProgressBar.Status(50)==true then myScore.Dispose(false) return(false) end
TailorLyrics(sourceStaff, fourthStaff)
end
-- move the lyrics to the correct position in the staff space
ProgressBar.Write("Calculate Needed Staff height top staffs, please wait ....")
if ProgressBar.Status(60)==true then myScore.Dispose(false) return(false) end
SetStaffMetrics(firstStaff, maxNrLyrics, lyricsHeight, sourceStaff,0)
ProgressBar.Write("Calculate Needed Staff height bottom staffs, please wait ....")
if ProgressBar.Status(80)==true then myScore.Dispose(false) return(false) end
SetStaffMetrics(thirdStaff, maxNrLyrics, lyricsHeight, sourceStaff,1)
-- and merge
ProgressBar.Close()
firstStaff.MergeWithNext()
thirdStaff.MergeWithNext()
-- final handling
if justPrint==true then myScore.Print() myScore.Dispose(false)
elseif justSave==true then myScore.CopyTo(orgScore) orgScore.Save() myScore.Dispose(false) orgScore.Dispose(false)
elseif justOpen==true then myScore.CopyTo(orgScore) myScore.Dispose(false) orgScore.FirstStaff.Title=orgScore.FirstStaff.Title
else Alert("Script Error: nothing Selected") return(false) end
return(true) -- script succesfully executed
end -- of function MergeBarbershopStyle()
if MergeBarbershopStyle()==false then Message("Script not executed, Score left unchanged") end
-
Seduar,
Looks like code to work with that program, making calls to and from it. I downloaded it a while back thinking I could use a midi keyboard to generate the tones for the voice and output it and convert it to a ogg readable by the Haptek engine, then you could use keywords to activate a HAP file which called the particular song in the Haptek ogg file format and have HAL sing, but the sound board I used to hook up the midi keyboard was in an older computer that wouldn't work with the program, so I moved on to other things instead of playing surgeon. The WAV output from the shareware program didn't look like it was terminated with an EOF marker and I couldn't get the OGG to create properly and since I didn't have the sound board in a bigger computer I didn't feel like buying the program, not knowing whether it would work or not from the sharware example. I think it would work fine if I moved the board and bought the full version, it's inexpensive enough. I thought I read one could train the phonemes with the program using an input, and I thought of using the TTS voice input, that way you could have the TTS voice you like sing the song which is a great option. I like how the program has so many voice options, it seems pretty great for such a low price. I remember one of the Alice bots singing the 2001 HAL song "Daisy", I thought it would be fun to try that, having HAL slow the tempo just like in the movie, with this program I believe it's possible to do that sort of thing.
-
Hi Guys
The songs that I created for Hal 5 would work with either of the male of female voices supplied with Hal. I did try to make some songs that were just sung by females to make it more natural. But the main point is that what ever voice you used for Hal would sing the songs. They may be a little higher or lower in pitch but it was you own voices that did the singing.
Maybe I or someone else can port the code to Hal 6.
Bill
-
Thanks Bill, I forgot all about that work. Though I could only get it to work with the other SAPI voices and not the voice I like to use from AT&T because it has a set pitch. Robert hints in:
http://www.zabaware.com/forum/topic.asp?TOPIC_ID=3316&SearchTerms=stop,listening
that the control is under Haptek or the MSAgent not HAL once the voice is sent to the character, so the lip synch is lost and that's what I found when I loaded the birthday.txt from Robert in:
http://www.zabaware.com/forum/topic.asp?TOPIC_ID=843&SearchTerms=Birthday.txt
to the HalPad vs. lipsynch when dragged to the Haptek Console, but no tone, just reading the script. It looks like in my case the tone would have to be generated before introduction to the Haptek control, but using a different method, perhaps using midi since it's widely available, and easy enough to generate a tone through a sequencer. I remember years ago I found a program to take an analog input and convert it to midi, but it didn't work for me. That might be the way to attempt this, just merge the midi frequency with the voice file as in the above coding and output it with a phoneme file to the Haptek input. Lot's of work no doubt, and would require either an external program to align the tones with the words. For some reason I thought the midi output was ascii and was directed to a game port, so that port could be used to access and generate the timing and tones for the staffs, then the words could be typed or pasted in and aligned with the notes. But it seems like that's pretty much what this program already does, just have to take the wav output and convert it to ogg for HAL lipsync. Doesn't seem like reinventing the wheel is worth the number of angels on the head of that pin to mix my metaphorical cliche's[:I]
-
Thanks danbaltzell and bill819 for getting involved in this subject, if you guys want to check this script, i got it of harmony assistant.
something like this might work with Hal; insted of sending all the information to 'Sampa' we can probably send it to Hal's brain ( to the text box).
let me know what you guys think.
Methods of pop menu
-- Init : called just after the dialog has been displayed for the first time
function Init(dialog,item)
local i
i=1
while tabLanguage do
item.SetExtraValue(i,tabLanguage)
i=i+1
end
item.Value=defaultLanguage
end
Methods of text 'text'
ction Init(dialog,item)
item.Value=strVoidText
item.UserTable.Inited=false
end
function Push(dialog,item)
if item.UserTable.Inited==false then
item.Value=""
item.UserTable.Inited=true
end
end
Methods of Botton 'convert'
-- Release : called when mouse button is released
function Release(dialog,item)
local text,first,last,char,score,staff,pos
local lyrics,i,word,phon,result
-- Create score
score=NewScore(false)
staff=score.AddStaff()
staff.IsLyrics=true
staff.VirtualSingerVoice.Language=dialog.GetItem("Language").Value
staff.VirtualSingerVoice.IsActive=true
pos=0
text=dialog.GetItem("Text").Value
last=1
repeat
first,last=strfind(text,"(%w+)",last)
if first and last then
if last>first then
staff.InsertNote(pos,DURATION_QUARTER,5*12,false)
staff.SetLyricAtTime(pos,strsub(text,first,last+1),1)
pos=pos+DURATION_QUARTER
end
last=last+1
end
until last==nil
lyrics=staff.CreateLyricsArray()
i=1
result=""
while lyrics do
if dialog.GetItem("Sampa").Value==true then
phon=lyrics.Sampa
else
phon=lyrics.Fragment
end
first,last,word=strfind(lyrics.Lyric,"(%w+)")
result=result..word
if dialog.GetItem("AddBrackets").Value==true then
result=result.."[#"..phon.."]"
else
result=result.."\t"..phon
end
result=result.."\r"
i=i+1
end
dialog.GetItem("SampaText").Value=result
score.Dispose(false)
end
Methods of radio'sampa'
-- Init : called just after the dialog has been displayed for the first time
function Init(dialog,item)
item.Value=true
end
Methods of text 'sampa text'
-- Init : called just after the dialog has been displayed for the first time
function Init(dialog,item)
item.Value=true
end
Sergio [:)]
-
Right where you can see (language) we might be able to set up a voice (Microsoft mary, neospeech, etc.)
Sergio [:)]
-
It doesn't seem ethical to use someones code without their permission, not that I can see anything here of value without all the other functions to support the program, and it's doubtful they'd provide it.