Audio alarm: 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 4:
=={{header|AutoHotkey}}==
Uses Run for maximum compatibility
<syntaxhighlight lang=AHK"ahk">Inputbox, seconds, Seconds, Enter a number of seconds:
FileSelectFile, File, 3, %A_ScriptDir%, File to be played, MP3 Files (*.mp3)
Sleep Seconds*1000
Line 10:
 
=={{header|AWK}}==
<syntaxhighlight lang=AWK"awk">
# syntax: GAWK -f AUDIOALARM.AWK
BEGIN {
Line 35:
 
=={{header|Batch File}}==
<syntaxhighlight lang="dos">
@echo off
 
Line 62:
{{libheader| Bass}}
'''Bass''' is a third part library, free for non-commercial use, can be found here [https://www.un4seen.com]. Require a '''bass.dll''' in the same folder of executable.
<syntaxhighlight lang=Delphi"delphi">
program AudioAlarm;
 
Line 177:
 
=={{header|EchoLisp}}==
<syntaxhighlight lang="scheme">
(lib 'timer)
(lib 'audio)
Line 204:
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">Dim As Long sec
Dim As String song
Input "Delay in seconds: ", sec
Line 220:
=={{header|Go}}==
As Go does not have any audio support in its standard library, this invokes the SoX utility's 'play' command to play the required .mp3 file.
<syntaxhighlight lang="go">package main
 
import (
Line 266:
 
=={{header|Java}}==
<syntaxhighlight lang=Java"java">import com.sun.javafx.application.PlatformImpl;
import java.io.File;
import java.util.Scanner;
Line 307:
 
=={{header|JavaScript}}/{{header|HTML}}==
<syntaxhighlight lang=JavaScript"javascript"><title> AudioAlarm </title>
<script>
var a=prompt("Enter a number of seconds", "");
Line 316:
=={{header|Julia}}==
Works when the computer will play an MP3 file with the "play" command.
<syntaxhighlight lang="julia">print("Enter seconds to wait: ")
(secs = tryparse(Int, readline())) == nothing && (secs = 10)
 
Line 332:
=={{header|Kotlin}}==
For this to work on Ubuntu, 'glib' and 'libav-tools' need to be installed on your system.
<syntaxhighlight lang="scala">// version 1.1.51
 
import javafx.application.Application
Line 391:
If not already running, this will add an extra delay...
It will error if the mp3 file does not exist in the specified path.
<syntaxhighlight lang="lb">nomainwin
 
prompt "Delay in seconds"; sec$
Line 410:
luasdl2 and luafilesystem libraries required.
 
<syntaxhighlight lang="lua">SDL = require "SDL"
mixer = require "SDL.mixer"
lfs = require "lfs"
Line 429:
=={{header|Nim}}==
{{Trans|Go}}
<syntaxhighlight lang=Nim"nim">import os, strutils, terminal
 
var delay: int
Line 465:
requires mpg123 to be installed.
 
<syntaxhighlight lang="ocaml">let rec wait n = match n with
| 0 -> ()
| n -> Sys.command "sleep 1"; wait (n - 1);;
Line 481:
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(notonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\AudioAlarm.exw
Line 703:
{{works with|Python|3.4.1}}
 
<syntaxhighlight lang="python">import time
import os
 
Line 714:
=={{header|Racket}}==
Racket does not currently have native mp3 support so this example uses system to call an external application.
<syntaxhighlight lang="racket">#lang racket
(display "Time to wait in seconds: ")
(define time (string->number (read-line)))
Line 727:
=={{header|REXX}}==
===using SLEEP===
<syntaxhighlight lang="rexx">/*REXX pgm to prompt user for: # (of secs); a name of a MP3 file to play*/
 
say '──────── Please enter a number of seconds to wait:'
Line 743:
 
===using spin===
<syntaxhighlight lang="rexx">/*REXX pgm to prompt user for: # (of secs); a name of a MP3 file to play*/
 
say '──────── Please enter a number of seconds to wait:'
Line 760:
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
# Project : AudioAlarm
 
Line 779:
requires mpg123 to be installed.
 
<syntaxhighlight lang="ruby">puts "Enter a number of seconds:"
seconds = gets.chomp.to_i
puts "Enter a MP3 file to be played"
Line 789:
=={{header|Tcl}}==
{{libheader|Snack}}
<syntaxhighlight lang="tcl">package require sound
 
fconfigure stdout -buffering none
Line 812:
 
Currently, DOME can only playback .wav and .ogg files so we use the former here.
<syntaxhighlight lang="ecmascript">import "dome" for Window, Process, Platform
import "graphics" for Canvas, Color
import "audio" for AudioEngine
Line 855:
=={{header|XPL0}}==
Works on Raspberry Pi.
<syntaxhighlight lang=XPL0"xpl0">int Time, I, J, Ch;
char FN(80), Ext;
[Text(0, "Number of seconds to wait? ");
Line 875:
 
=={{header|Yabasic}}==
<syntaxhighlight lang=Yabasic"yabasic">input "How long to wait for (seconds): " sec
input "What file to play: " song$
wait sec
Line 886:
There is no built in sound support so this example is coded for my Linux box.
A change: rather than seconds to wait, a time is used.
<syntaxhighlight lang="zkl">hms :=Time.Date.parseTime(ask("Time to play mp3 file: "));
file:=ask("File to play: ") + ".mp3";
 
10,333

edits