Jump to content

Audio overlap loop: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 1:
[[Category:Temporal media]]
{{draft task}}
'''Audio Overlap Loop''' is a program that produces an "echo chamber" effect by playing an audio file several times in an overlapping loop. A repetition level determines the number of times that the file is looped. For the purpose of this task, write a program that takes a parameter for the number of repetitions and plays the file ''loop.wav'' in an overlapping loop according to the number of repetitions.
Line 7 ⟶ 8:
{{libheader| Winapi.Windows}}
{{libheader| Winapi.MMSystem}}
<syntaxhighlight lang=Delphi"delphi">
program Audio_Overlap_Loop;
 
Line 130 ⟶ 131:
=={{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.
<syntaxhighlight lang="go">package main
 
import (
Line 191 ⟶ 192:
 
=={{header|JavaScript}}/{{header|HTML}}==
<syntaxhighlight lang=JavaScript"javascript"><script>
var j = prompt("Enter the sound manipulation level you want", "");
for(i=0; i<j; i++) {
Line 201 ⟶ 202:
=={{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.
<syntaxhighlight lang="julia">const soundfile = "loop.wav"
 
if length(ARGS) < 1
Line 219 ⟶ 220:
{{trans|Go}}
As in Go version, we use Sox "play" command.
<syntaxhighlight lang=Nim"nim">import osproc, strutils
 
proc getValue[T: int | float](msg: string; minval, maxval: T): T =
Line 252 ⟶ 253:
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\AudioOverlapLoop.exw
Line 286 ⟶ 287:
Either of these may be desirable in different circumstances, so both are left as an example.
 
<syntaxhighlight lang=Tcl"tcl">package require Tk
package require snack
 
Line 392 ⟶ 393:
{{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.
<syntaxhighlight lang="ecmascript">/* audio_overlap_loop.wren */
 
class C {
Line 432 ⟶ 433:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
Line 525 ⟶ 526:
return 0;
}</syntaxhighlight>
 
 
{{omit from|Bc}}
Line 530 ⟶ 532:
{{omit from|GUISS}}
{{omit from|Lotus 123 Macro Scripting}}
 
[[Category:Temporal media]]
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.