An interesting idea, but unfortunately not really possible with the source sound engine. The sound just take too long to start/stop to be practical.
The closest thing that I've got to anything like this is:
[highlight=E2]@name Ring Tone Transfer Language E2
@inputs
@outputs Name:string Compleat
@persist DefDuration DefOctave DefTempo
@persist NotesList:array CurrentNote NoteCount
@persist ThritySecondNoteTime
@trigger all
if(first())
{
#SongInfo = "HauntedHouse: d=4,o=5,b=108: 2a, 2e, 2d#, 2b, 2a, 2e, 2d, 2a#4, 2e., e, 1f4, 1a4, 1d#, 2e., d, 2c., b4, 1a4, 1p, 2a4, 2e, 2d#, 2b4, 2a4, 2c, 2d, 2a#4, 2e., e, 1f4, 1a4, 1d#, 2e., d, 2c., b4, 1a4"
#SongInfo = "fifth:d=4,o=5,b=63:8P,8G5,8G5,8G5,2D#5"
SongInfo = "TocattaFugue:d=32,o=5,b=100:a#.,g#.,2a#,g#,f#,f,d #.,4d.,2d#,a#.,g#.,2a#,8f,8f#,8d,2d#,8d,8f,8g#,8b, 8d6,4f6,4g#.,4f.,1g"
#SongInfo = "The shoop shoop song: d=4,o=5,b=120:g,g,g,g,f,8f,8d#,8f,8d#,c,g,8g,8g,g, 8g,8g,b,8g,g.,8e,8d,8f,e,d."
#SongInfo = "Scatman:d=4,o=5,b=200:8b,16b,32p,8b,16b,32p,8b,2d 6,16p,16c#.6,16p.,8d6,16p,16c#6,8b,16p,8f#,2p.,16c #6,8p,16d.6,16p.,16c#6,16b,8p,8f#,2p,32p,2d6,16p,1 6c#6,8p,16d.6,16p.,16c#6,16a.,16p.,8e,2p.,16c#6,8p ,16d.6,16p.,16c#6,16b,8p,8b,16b,32p,8b,16b,32p,8b, 2d6,16p,16c#.6,16p.,8d6,16p,16c#6,8b,16p,8f#,2p.,1 6c#6,8p,16d.6,16p.,16c#6,16b,8p,8f#,2p,32p,2d6,16p ,16c#6,8p,16d.6,16p.,16c#6,16a.,16p.,8e,2p.,16c#6, 8p,16d.6,16p.,16c#6,16a,8p,8e,2p,32p,16f#.6,16p.,1 6b.,16p."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,8e4,8f4, 8g4,8d4,d4,8d4,8e4,8f4,c4,16p,8c4,8d4,8c4,8e4,g4,1 6p,8g4,8g4,8a4,c,16p"
#SongInfo = "FunkyTown:d=4,o=4,b=125:8c6,8c6,8a#5,8c6,8p,8g5,8 p,8g5,8c6,8f6,8e6,8c6,2p,8c6,8c6,8a#5,8c6,8p,8g5,8 p,8g5,8c6,8f6,8e6,8c6"
#SongInfo = "National Anthem:d=4,o=5,b=140:g5,g5,a5,f#5.,8g5,a5,b5,b5,c6 ,b6.,8a5,g5,a5,g5,f#5,g5"
#SongInfo = "Greensleaves:d=4,o=5,b=140:g,2a#,c6,d6.,8d#6,d6,2 c6,a,f.,8g,a,2a#,g,g.,8f,g,2a,f,2d,g,2a#,c6,d6.,8e 6,d6,2c6,a,f.,8g,a,a#.,8a,g,f#.,8e,f#,2g"
#SongInfo = "Hitchcoc:d=4,o=5,b=200:16c,16p,16f4,8p,8f,32g,32p ,16f,32p,16e,32p,16d,32p,16e,8p,16f,32p,16g,8p.,16 c,16p,16f4,8p,8f,32g,32p,16f,32p,16e,32p,16d,32p,1 6e,8p,16f,32p,16g,8p.,16c,16p,16f4,8p,16g#,32p,8c6 ,16p,16a#,32p,16g#,8p,16c6,32p,8d#6,16p,16c#6,32p, 16c6,8p,16d#6,32p,8g6,16p,16f6,32p,16e6,32p,16c#6, 32p,16c6,32p,16a#,32p,16g#,32p,16g,32p,8f4"
#SongInfo = "missathing:d=4,o=5,b=125:2p,16a,16p,16a,16p,8a.,1 6p,a,16g,16p,2g,16p,p,8p,16g,16p,16g,16p,16g,8g.,1 6p,c6,16a#,16p,a,8g,f,g,8d,8f.,16p,16f,16p,16c,8c, 16p,a,8g,16f,16p,8f,16p,16c,16p,g,f"
#SongInfo = "hipsdontlie:d=4,o=5,b=100:c6,8a#,16c6,16a#,16p,16 a#,16a#,16a#,8g,8a#,8g,8g,16f,16f,16g,16f,16p,16d# ,8c,8p,16c,16c,8d#,8c,8p,16p,16c,8d#,8c,8p,16c,16c ,8d#,16c,16c,16d#,8c,16c,8d#,8c,p,16p,16c6,16c6,16 c6,8a#,16c6,16a#,16p,16a#,16a#,16a#,8g,8a#,8g,8g,1 6f,16f,16g,16f,16p,16d#,8c,8p,16c,16c,8d#,8c,8p,16 p,16c,8d#,8c,8p,16c,16c,8d#,16c,16c,16d#,8c,16c,8d #,8c "
#================= Get Raw Data ===============
SongData = SongInfo:explode(":")
Part = 1
#get the name
Name = SongData:string(Part)
Part++
#get the raw settings
Settings = SongData:string(Part):lower()
Part++
if(!Settings:find("="))
{
Settings = SongData:string(Part):lower()
Part++
}
#get the raw notes
NotesString = SongData:string(Part):lower()
Part++
#================= Translate Settings ===============
SettingInfo = Settings:trim():explode(",")
N = 1
#get the first setting info number
if(SettingInfo:string(N):trim():lower():left(1) == "d")
{
DefDuration = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "o")
{
DefOctave = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "b")
{
DefTempo = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
N++
#get the second setting info number
if(SettingInfo:string(N):trim():lower():left(1) == "d")
{
DefDuration = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "o")
{
DefOctave = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "b")
{
DefTempo = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
N++
#get the third setting info number
if(SettingInfo:string(N):trim():lower():left(1) == "d")
{
DefDuration = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "o")
{
DefOctave = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
elseif(SettingInfo:string(N):trim():lower():left(1 ) == "b")
{
DefTempo = SettingInfo:string(N):trim():lower():explode("="): string(2):toNumber()
}
#================= Get Notes ===============
NotesList = NotesString:explode(",")
NoteCount = NotesList:count()
CurrentNote = 1
#================ Setup Time ================
ThritySecondNoteTime = 60000/(DefTempo*8)
interval(10)
exit()
}
if(clk() & CurrentNote <= NoteCount)
{
#================== Start Note Decoding =================
Note = NotesList:string(CurrentNote):trim():lower()
NoteLength = ThritySecondNoteTime*8*(4/DefDuration)
NoteLetter = "a"
NoteOctave = DefOctave
#check for duration identifier
if(Note:index(1):toNumber() != 0)
{
Index = 1
#get the note length
if(Note:index(1):toNumber() != 0 & Note:index(2):toNumber() != 0)
{
NoteLength = ThritySecondNoteTime*8*(4/Note:sub(Index,Index+1):toNumber())
Index += 2
}
else
{
NoteLength = ThritySecondNoteTime*8*(4/Note:index(Index):toNumber())
Index++
}
if(Note:right(1) == ".")
{
NoteLength *= 1.5
}
#get the note letter
if(Note:index(Index+1) == "#")
{
NoteLetter = Note:sub(Index,Index+1)
Index += 2
}
else
{
NoteLetter = Note:index(Index)
Index++
}
#get the octave
if(Note:index(Index) == "" | Note:index(Index) == "." )
{
NoteOctave = DefOctave
}
else
{
NoteOctave = Note:index(Index):toNumber()
}
}
else
{
NoteLength = ThritySecondNoteTime*8*(4/DefDuration)
Index = 1
#get the note letter
if(Note:index(Index+1) == "#")
{
NoteLetter = Note:sub(Index,Index+1)
Index += 2
}
else
{
NoteLetter = Note:index(Index)
Index++
}
#get the octave
if(Note:index(Index) == "" | Note:index(Index) == "." )
{
NoteOctave = DefOctave
}
else
{
NoteOctave = Note:index(Index):toNumber()
}
}
#============ Set The Sound Pitch ==============
NotePitchNum = 1
if(NoteLetter == "c"){
NotePitchNum = 1
}
elseif(NoteLetter == "c#"){
NotePitchNum = 2
}
elseif(NoteLetter == "d"){
NotePitchNum = 3
}
elseif(NoteLetter == "d#"){
NotePitchNum = 4
}
elseif(NoteLetter == "e"){
NotePitchNum = 5
}
elseif(NoteLetter == "f"){
NotePitchNum = 6
}
elseif(NoteLetter == "f#"){
NotePitchNum = 7
}
elseif(NoteLetter == "g"){
NotePitchNum = 8
}
elseif(NoteLetter == "g#"){
NotePitchNum = 9
}
elseif(NoteLetter == "a"){
NotePitchNum = 10
}
elseif(NoteLetter == "a#"){
NotePitchNum = 11
}
elseif(NoteLetter == "b"){
NotePitchNum = 12
}
elseif(NoteLetter == "p"){
#the pause note
CurrentNote++
interval(NoteLength)
exit()
}
NoteFrequency = 261.62*(2^(NoteOctave-5))*(2^(1/12))^(NotePitchNum-1)
Pitch = (5*NoteFrequency)/22
soundPlay(entity():id()+CurrentNote,(NoteLength/1000),"synth/tri.wav")
soundPitch(entity():id()+CurrentNote,Pitch)
CurrentNote++
Compleat = ((CurrentNote-1)/NoteCount)*100
interval(NoteLength)
}
elseif(CurrentNote > NoteCount)
{
CurrentNote = 1
interval(5000)
}
[/highlight]


LinkBack URL
About LinkBacks




Reply With Quote





Bookmarks