proteaaudio: Simple audio library for Windows, Linux, OSX.

[ bsd3, library, sound ] [ Propose Tags ]

Simple audio library for Windows, Linux, OSX. Supports PCM, Ogg and Wav playback and multichannel mixing.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
example

Build with example

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.0.1, 0.7.1.0, 0.8.0, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0, 0.10.1
Change log CHANGELOG.md
Dependencies base (>=4 && <5), bytestring (>=0.10 && <0.11), filepath (>=1.4 && <2), proteaaudio [details]
License BSD-3-Clause
Author Csaba Hruska
Maintainer csaba.hruska@gmail.com
Category Sound
Source repo head: git clone https://github.com/csabahruska/proteaaudio
Uploaded by CsabaHruska at 2018-12-03T16:14:26Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Executables proteaaudio-play
Downloads 5803 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-12-03 [all 1 reports]

Readme for proteaaudio-0.7.1.0

[back to package description]

Overview

ProteaAudio is a stereo audio mixer/playback library for

  • Linux (PulseAudio)
  • Macintosh OS X (CoreAudio)
  • Windows (DirectSound)

Supported audio formats:

  • Wav
  • Ogg
  • Raw linear PCM

Samples can be loaded from file or memory.

Example

import Control.Monad
import System.Environment
import System.FilePath
import qualified Data.ByteString as SB
import Control.Concurrent

import Sound.ProteaAudio

waitPayback = do
  n <- soundActive
  when  (n > 0) $ do
    threadDelay 1000000
    waitPayback

main = do
    args <- getArgs
    filename <- case args of
      a : _ -> pure a
      _ -> fail "usage: proteaaudio-play SAMPLE_FILE_NAME"

    result <- initAudio 64 44100 1024 -- max channels, mixing frequency, mixing buffer size
    unless result $ fail "failed to initialize the audio system"

    -- (A) load sample from file
    sampleA <- sampleFromFile filename 1.0 -- volume

    soundPlay sampleA 1 1 0 1 -- left volume, right volume, time difference between left and right, pitch factor for playback
    waitPayback

    -- (B) load from memory buffer
    buffer <- SB.readFile filename
    sampleB <- case takeExtension filename of
      ".ogg" -> sampleFromMemoryOgg buffer 1.0
      ".wav" -> sampleFromMemoryWav buffer 1.0

    soundPlay sampleB 1 1 0 1 -- left volume, right volume, time difference between left and right, pitch factor for playback
    waitPayback

    finishAudio