$|=1; $timestart= time; use mathamusic; $filename="test-auto.wav"; $debug=1; $durata = 16 ; # in secondi $samplerate = 44100; $canali = 2; $bits = 16; $block = $canali*$bits/8; $samplestream = $durata*$samplerate*$block; $chunksize = $samplestream+44; header(); ########################################################################################## # f1 = f2/4 sine squa for(1..2){ @onda = mix ( [ envelope(1, 3, (sine(110, 4 , 10000, 1, )))], 1, [reverse envelope(1, 3, (sine(220, 4 , 7500, 1, )))], 1, ); @onda = mix (\@onda, 1, [sine(330, 4 , 5000, 1, )], 1, ); push @bassl, envelope(3, 3, reverse envelope(3, 3, smooth(10, @onda))); @onda = mix ( [ envelope(1, 3, (sine( 98, 4 , 10000, 1, )))], 1, [reverse envelope(1, 3, (sine(196, 4 , 7500, 1, )))], 1, ); @onda = mix (\@onda, 1, [sine(294, 4 , 5000, 1, )], 1, ); push @bassl, envelope(3, 3, reverse envelope(3, 3, smooth(10, @onda))); for$f(qw/ r-4 880-2 r-4 1760-2 r-4 880-2 r-4 440-2 r-2 880-2 r-2 1760-2 r-4 1175-2 r-4 988-2 r-4 784-2 r-4 587-2 r-2 494-2 r-2 392-2 /){ @note=(262, 523, 1046, 2092, 330, 659, 1319, 2638, ); ($freq, $gate) = split '-', $f; $freq = $note[int rand($#note+1)] if $freq eq 'r'; @onda = sine($freq, $gate/8, 5000-$freq*2, 1, ); push @leadl, envelope(2, 1, @onda); } } $timenow= time; print "\n\n\tgone ", $timenow-$timestart, " seconds"; @bassl = mix('bassl', 1, 'bassl', 1/2, 3/4, ); @echol = mix('leadl', 1, 'leadl', 1/3, 3/8, ); @echol = mix('echol', 1, 'leadl', 1/9, 6/8, ); @left = mix('bassl', 2/3, 'echol', 3/2, 0, ); @righ = mix('bassl', 3/2, 'echol', 2/3, 0, ); @left = smooth(10, @left); @righ = smooth(10, @righ); $timenow= time; print "\n\n\tgone ", $timenow-$timestart, " seconds"; ########################################################################################## stampa('china.wav'); $timeend= time; print "\n\n\tall done in ", $timeend-$timestart, " seconds"; __END__