The following script demonstrates a few ways to modify music files. It prompts you to load a file and then plays it in four modified versions, each for 10 seconds.
Code: Select all
@REQUIRE "avcodec"
@REQUIRE "soundfx"
SetFont(#SANS, 22)
filename$ = FileRequest("Select a music file", {Filters = "wav|mp3|flac|ogg"})
If filename$ = "" Then End()
id = LoadSample(Nil, filename$)
pvol=15
SetVolume(id, pvol)
NPrint("\nPlay for 10 seconds (unchanged)")
PlaySample(id)
Sleep(10000)
CopySample(id, 2)
id2=3
level=9
NPrint("Increase the treble by",level,"...")
soundfx.Process(2, id2, {{"treble", ToString(level)}})
SetVolume(id2, pvol)
NPrint("Play the modified sample")
PlaySample(id2)
Sleep(200)
StopSample(id)
Sleep(10000)
id3=4
level=9
NPrint("Boost the bass by",level,"...")
soundfx.Process(id, id3, {{"bass", ToString(level)}})
SetVolume(id3, pvol)
NPrint("Play the modified sample")
PlaySample(id3)
Sleep(200)
StopSample(id2)
Sleep(10000)
NPrint("Reduce the speed to 0.8 ...")
soundfx.Process(id, id2, {{"tempo", "0.8"}})
SetVolume(id2, pvol)
NPrint("Play the sample at 0.8 speed")
PlaySample(id2)
Sleep(200)
StopSample(id3)
Sleep(10000)
NPrint("Increase the speed to 1.7 ...")
soundfx.Process(id, id3, {{"tempo", "1.7"}})
SetVolume(id3, pvol)
NPrint("Play the sample at 1.7 speed")
PlaySample(id3)
Sleep(200)
StopSample(id2)
FreeSample(id2)
Sleep(5000)
NPrint("\nDone. Play until the end of the track.")
While IsSamplePlaying(id3)
Wend
Code: Select all
; benötigte Plugins
@REQUIRE "soundFX"
volume$="0.05"
SetFont(#SANS, 22)
NPrint("Bend effect from manual")
Sleep(500)
soundfx.Generate(1, {
{"synth", "2.5", "sin", "667"},
{"gain", "1"},
{"bend", "0.35,180,0.25", "0.15,740,0.53", "0,-520,0.3"},
{"vol", volume$}
})
PlaySample(1)
Sleep(5000)
FreeSample(1)
NPrint("Start")
Sleep(500)
soundfx.Generate(1, {
{"synth", "9.0", "sin", "600-1600", "noise"},
{"tremolo", "4", "10"},
{"reverb", "100", "80", "100", "100", "20", "-10"},
{"fade", "h", "0.1", "5.0", "4.0"},
{"vol", volume$}
})
PlaySample(1)
Sleep(5000)
FreeSample(1)
duration=6000
NPrint("On board")
;(https://github.com/fabsh/scripts/blob/master/warpdrive.sh)
soundfx.Generate(1, {
{"synth", "whitenoise"},
{"lowpass", "-1", "120"},
{"lowpass", "-1", "120"},
{"lowpass", "-1", "120"},
{"gain", "+14"},
{"fade", "h", ToString(duration/2000), ToString(duration/1000), ToString(duration/2000)},
{"vol", volume$}
})
PlaySample(1)
Sleep(duration+500)
FreeSample(1)
NPrint("Phaser")
soundfx.Generate(1, {
{"synth", "0.25", "square", "3000-100"},
{"flanger", "2", "0.8", "70", "0.6", "5", "lin"},
{"echo", "0.6", "0.3", "15", "0.5"},
{"vol", volume$}
})
PlaySample(1)
Sleep(500)
FreeSample(1)
soundfx.Generate(2, {
{"synth", "0.4", "saw", "4000-40"},
{"synth", "0.4", "whitenoise", "mix"},
{"overdrive", "15", "5"},
{"echo", "0.8", "0.4", "30", "0.3"},
{"vol", volume$}
})
PlaySample(2)
Sleep(200)
;synth 5.0 sine 60-120 synth 5.0 sine 90-40 tremolo 6 60 reverb 100 80 100 100 20 -10 fade h 0.5 5.0 2.0
NPrint("Engine stops")
soundfx.Generate(1, {
{"synth", "5.0", "sine", "60-120"},
{"synth", "5.0", "sine", "90-40"},
{"tremolo", "6", "60"},
{"reverb", "100", "80", "100", "100", "20", "-10"},
{"fade", "h", "0.5", "5.0", "2.0"},
{"vol", volume$}
})
PlaySample(1)
Sleep(6000)
FreeSample(1)
FreeSample(2)
; from https://www.reeltoreel.nl/knowledgebase/books/audio/page/sox-audio-examples
NPrint("\nTHX")
Sleep(500)
;play -q -n synth sq F2 sq C3 remix - fade 0 5 .1 norm -4 bend 0.5,2477,3 fade 0 5 0.8
soundfx.Generate(1, {
{"synth", "square", "F2", "square", "C3"},
{"remix", "-"},
{"fade", "0", "5", ".1"},
{"norm", "-4"},
{"phaser", "0.9", "0.6", "3", "0.34", "2", "-t"},
{"bend", "0.5,2477,3"},
{"fade", "0", "5", "0.8"},
{"vol", volume$}, Channels = 1
})
PlaySample(1)
Sleep(5000)
FreeSample(1)
NPrint("Warble")
soundfx.Generate(1, {
{"synth", "square", "C"},
{"trim", "0", "4"},
{"vol", 0.2},
{"chorus", "1", "1", "21", "1", "4", "10", "-s"},
{"bend", "0,2400,4"},
{"fade", "0.1", "4", "2"},
{"vol", volume$}
})
PlaySample(1)
Sleep(4000)
FreeSample(1)
duration=100
NPrint("Semitone steps, sine,",duration,"ms")
For i=-48 To 48
i$=ToString(i)
If i>=0 Then i$="+"..i$
Print(i,"")
soundfx.Generate(1, {{"synth", "sin", "%"..i$},
{"fade", "h", ToString(duration/10000), ToString(duration/1000), ToString(duration/10000)},
{"vol", volume$},
Channels = 1})
SetVolume(1, 10)
PlaySample(1)
Sleep(duration)
FreeSample(1)
Next
Sleep(500)
duration=200
NPrint("\nMajor scale upward")
notetable={-12,-10,-8,-7,-5,-3,-1,0,2,4,5,7,9,11,12}
For i=0 To TableItems(notetable)-1
i$=ToString(Notetable[i])
If Notetable[i]>=0 Then i$="+"..i$
Print(i$.." ")
soundfx.Generate(1, {{"synth", "sin", "%"..i$},
{"fade", "h", "0.05", ToString(duration/1000), "0.1"},
{"vol", volume$}, Channels = 1})
SetVolume(1, 10)
PlaySample(1)
Sleep(duration)
FreeSample(1)
Next
Sleep(300)
NPrint("\nMajor scale downward")
For i=TableItems(notetable)-1 To 0 Step -1
i$=ToString(Notetable[i]-12)
If Notetable[i]-12>=0 Then i$="+"..i$
Print(i$.." ")
soundfx.Generate(1, {{"synth", "exp", "%"..i$}, {"fade", "h", "0.05", ToString(duration/1000), "0.1"}, {"vol", volume$}, Channels = 1})
SetVolume(1, 15)
PlaySample(1)
Sleep(duration)
FreeSample(1)
Next
Sleep(500)
NPrint("\nGuitar chords")
type$="pluck"
soundfx.Generate(1, {{"synth", type$, "%-24", type$, "%-12", type$, "%-8", type$, "%-5", type$, "%-2"},
{"delay", "0", ".05", ".15" }, {"fade", "h", "0.1", "2", "0.1"}, {"vol", volume$}, Channels = 1})
PlaySample(1)
Sleep(2000)
soundfx.Generate(1, {{"synth", type$, "%-24", type$, "%-12", type$, "%-7", type$, "%-3"},
{"delay", "0", ".05", ".1" }, {"fade", "h", "0.1", "2", "0.1"}, {"vol", volume$}, Channels = 2})
PlaySample(1)
Sleep(2000)
soundfx.Generate(1, {{"synth", type$, "%-24", type$, "%-12", type$, "%-8", type$, "%-5"},
{"delay", "0", ".1", ".2" }, {"fade", "h", "0.1", "3", "0.1"}, {"vol", volume$}, Channels = 2})
PlaySample(1)
Sleep(3500)
NPrint("Smoke")
Sleep(1000)
notetable={-26,"0.38",500, -23,"0.4",500, -21,"0.66",800, -26,"0.4",500, -23,"0.4",500, -20,"0.28",280, -21,"0.7",1000,
-26,"0.4",500, -23,"0.4",500, -21,"0.7",800, -23,"0.4",500, -26,"1.4",1500}
For i=0 To TableItems(notetable)-1 Step 3
l$=ToString(Notetable[i])
h$=ToString(Notetable[i]+5)
soundfx.Generate(1, {{"synth", Notetable[i+1], "pluck", "%"..l$, "pluck", "%"..h$, "pluck", "%"..l$, "pluck", "%"..h$ },
{"delay", "0", "0.01", "0.02", "0.03"},
{"remix", "-"},
{"gain", "20"},
{"compand", "0.01,0.1", "6:-60,-10,-10,-5,-5,0", "-5"},
{"highpass", "60"},
{"equalizer", "1000", "0.5q", "-6"},
{"highpass", "60"},
{"gain", "12"},
{"compand", "0.01,0.05", "6:-60,-20,-10,0", "0", "-5"},
{"chorus", "0.7", "0.9", "55", "0.4", "0.25", "2", "-t"},
{"echo", "0.8", "0.8", "25", "0.3"},
{"reverb", "50", "50", "100"},
{"vol", volume$}, Channels = 2}
)
PlaySample(1)
Sleep(Notetable[i+2])
FreeSample(1)
Next
Sleep(1000)