Audio overlap loop: Difference between revisions
m
syntax highlighting fixup automation
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 7:
{{libheader| Winapi.Windows}}
{{libheader| Winapi.MMSystem}}
<
program Audio_Overlap_Loop;
Line 120:
vol := vol * (1 - decay);
end;
end.</
{{out}}
<pre>Enter number of repetitions (1 to 20) :
Line 130:
=={{header|Go}}==
As Go does not have any audio support in its standard library, this invokes the SoX utility's 'play' command with the appropriate parameters to achieve the 'echo chamber' effect.
<
import (
Line 188:
err := cmd.Run()
check(err)
}</
=={{header|JavaScript}}/{{header|HTML}}==
<
var j = prompt("Enter the sound manipulation level you want", "");
for(i=0; i<j; i++) {
document.write("<bgsound src='loop.wav'>")
}
</script></
=={{header|Julia}}==
Uses Julia's ability to run iterations of a 4 loop in separate threads to play a file 4 times, with each play 0.1 seconds out of sync with the previous play. Requires available threads on the CPU at Julia startup.
<
if length(ARGS) < 1
Line 214:
end
end
</syntaxhighlight>
=={{header|Nim}}==
{{trans|Go}}
As in Go version, we use Sox "play" command.
<
proc getValue[T: int | float](msg: string; minval, maxval: T): T =
Line 249:
args.add $(i * delay)
args.add $decay2
echo execProcess("play", args = args, options = {poStdErrToStdOut, poUsePath})</
=={{header|Phix}}==
<!--<
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\AudioOverlapLoop.exw
Line 268:
<span style="color: #0000FF;">?</span><span style="color: #008000;">"done"</span>
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">wait_key</span><span style="color: #0000FF;">()</span>
<!--</
The distributed version also has a loop/wait for all channels to finish playing
before terminating the program, or you could just use sleep() or as above wait_key().
Line 286:
Either of these may be desirable in different circumstances, so both are left as an example.
<
package require snack
Line 387:
make_gui
</syntaxhighlight>
=={{header|Wren}}==
{{trans|Go}}
The ability to call external processes such as ''SoX'' is expected to be added to Wren-cli in the next release. In the meantime, we embed the following Wren script in a C host to complete this task.
<
class C {
Line 429:
args.add(decayS)
}
C.play(args.join(" "))</
<br>
We now embed this in the following C program, compile and run it.
<
#include <stdio_ext.h>
#include <stdlib.h>
Line 524:
free(script);
return 0;
}</
{{omit from|Bc}}
|