Audio overlap loop: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 77: | Line 77: | ||
=={{header|Julia}}== |
=={{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 4 available threads on the CPU at Julia startup. |
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 4 available threads on the CPU at Julia startup. |
||
<lang julia>soundfile = "loop.wav" |
<lang julia>const soundfile = "loop.wav" |
||
if length(ARGS) < 1 |
|||
⚫ | |||
println("Usage: give number of repetitions in echo effect as argument to the program.") |
|||
⚫ | |||
else |
|||
((repetitions = tryparse(Int, ARGS[1])) != nothing) || (repetitions = 3) |
|||
(repetitions < 1) && (repetitions = 3) |
|||
(repetitions > Threads.nthreads()) && (repetitions = Threads.nthreads()) |
|||
⚫ | |||
⚫ | |||
end |
|||
end |
end |
||
</lang> |
</lang> |