Audio frequency generator: Difference between revisions
m
Automated syntax highlighting fixup (second round - minor fixes)
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
Thundergnat (talk | contribs) m (Automated syntax highlighting fixup (second round - minor fixes)) |
||
Line 1:
[[Category:Sciences]]
[[Category:Sound]]
{{draft task}}
▲[[Category:Electronics]] [[Category:Sciences]]
▲[[Category:Sound]] [[Category:Temporal media]]
{{omit from|GUISS}}▼
{{omit from|Lotus 123 Macro Scripting}}▼
{{omit from|Scala}}▼
{{omit from|TPP}}▼
An audio [[wp:Signal_generator|frequency generator]] produces a continual audible monotone at a set frequency and level of volume.
There are controls to adjust the frequency and the volume up and down as desired.
Line 30 ⟶ 28:
=={{header|Action!}}==
<syntaxhighlight lang=
volu,dist,freq,key=764
Line 86 ⟶ 84:
=={{header|Axe}}==
{{untested|Axe}}
<syntaxhighlight lang="axe">ClrHome
Disp "FREQ:",i
10→F
Line 105 ⟶ 103:
The duration of the monotone is set in advance (to a small number of seconds) and the application ends when it finishes playing. Consequently, a method to silence it is not required.
<syntaxhighlight lang="go">package main
import (
Line 178 ⟶ 176:
=={{header|Julia}}==
Uses the PortAudio library.
<syntaxhighlight lang="julia">using PortAudio
if Sys.iswindows()
Line 295 ⟶ 293:
=={{header|Locomotive Basic}}==
<syntaxhighlight lang="locobasic">10 mode 1:input "Enter initial frequency in Hz";f:cls
20 if sq(2)<128 then sound 2,62500/f,100
30 a$=inkey$
Line 308 ⟶ 306:
{{trans|Go}}
As in the Go version, we use the Sox "play" command to emulate the audio frequency generator. This version is a faithful translation of the Go version, even if the way things are done is pretty different.
<syntaxhighlight lang=
type Waveform {.pure.} = enum
Line 340 ⟶ 338:
=={{header|Perl}}==
<syntaxhighlight lang="perl">use strict 'vars';
use feature 'say';
use feature 'state';
Line 377 ⟶ 375:
=={{header|Phix}}==
<!--<syntaxhighlight lang=
<span style="color: #000080;font-style:italic;">-- demo/rosetta/Audio_frequency_generator.exw</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
Line 641 ⟶ 639:
=={{header|Ring}}==
<syntaxhighlight lang="ring">
# Project : Audio frequency generator
Line 812 ⟶ 810:
SuperCollider is a sound programming language, so the task is predictably easy.
<syntaxhighlight lang=
// the server application detects audio hardware.
Server.default.boot;
Line 849 ⟶ 847:
{{libheader|Snack}}
This does not work on Windows due the use of the external <tt>stty</tt> program.
<syntaxhighlight lang="tcl">package require sound
set baseFrequency 261.63
Line 916 ⟶ 914:
{{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_frequency_generator.wren */
class C {
Line 961 ⟶ 959:
<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 1,065 ⟶ 1,063:
There is no volume control on the Spectrum.
<syntaxhighlight lang="zxbasic">10 REM The crappest signal generator in the world
20 REM We do not check for boundary errors in this simple demo
30 LET n=1
Line 1,074 ⟶ 1,072:
80 BEEP 0.1,n: REM beep for 0.1 second at n semitones relative to middle C
90 GO TO 40</syntaxhighlight>
▲{{omit from|GUISS}}
▲{{omit from|Lotus 123 Macro Scripting}}
▲{{omit from|Scala}}
▲{{omit from|TPP}}
|