Jump to content

Waveform analysis/Top and tail: Difference between revisions

m
syntax highlighting fixup automation
m (→‎{{header|Phix}}: added syntax colouring, marked p2js incompatible)
m (syntax highlighting fixup automation)
Line 14:
 
Setting the squelch level to 2 or 3 per cent of the maximum sample value worked reasonably well in my tests.
<langsyntaxhighlight lang="go">package main
 
import (
Line 92:
err = os.Remove(tmp2)
check(err)
}</langsyntaxhighlight>
 
 
=={{header|Julia}}==
Implemented as a Gtk GUI app.
<langsyntaxhighlight lang="julia">using FileIO, Gtk, LibSndFile, Printf
 
function dB(buf, i, channels, cutoff=0.001)
Line 246:
 
silencecropperapp()
</syntaxhighlight>
</lang>
 
=={{header|Nim}}==
{{trans|Go}}
<langsyntaxhighlight Nimlang="nim">import os, osproc, strutils
 
const Sec = "00:00:01"
Line 305:
# Remove the temporary files.
removeFile(tmp1)
removeFile(tmp2)</langsyntaxhighlight>
 
=={{header|Phix}}==
Line 312:
You may want to check for average volume over some period, rather than just all-0.<br>
This is clearly just a starting point and not a practical/useful/finished product!
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (file i/o)</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">sample_rate</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">44100</span><span style="color: #0000FF;">,</span>
Line 395:
<span style="color: #000000;">system</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"aplay notes.wav"</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</langsyntaxhighlight>-->
 
=={{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.
<langsyntaxhighlight lang="ecmascript">/* waveform_analysis_top_and_tail.wren */
 
class C {
Line 452:
// Remove the temporary files.
C.removeFile(tmp1)
C.removeFile(tmp2)</langsyntaxhighlight>
<br>
We now embed this in the following C program, compile and run it.
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
Line 553:
free(script);
return 0;
}</langsyntaxhighlight>
 
{{omit from|AWK}}
10,333

edits

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