Menu

Audio

Gwenn

Audio

Classes and Methods

cogpy.Audio()

      Collection of useful methods for the production of audio stimuli.

      file( path )

            Plays the audio file at the specified path.

            The following formats are accepted: 8svx, aif, aifc, aiff, aiffc, al, amb, au, avr, cdda, cdr, cvs, cvsd, cvu,
            dat, dvms, f32, f4, f64, f8, fssd, gsm, gsrt, hcom, htk, ima, ircam, la, lpc, lpc10, lu, maud, nist, prc, raw,
            s1, s16, s2, s24, s3, s32, s4, s8, sb, sf, sl, sln, smp, snd, sndr, sndt, sou, sox, sph, sw, txw, u1, u16,
            u2, u24, u3, u32, u4, u8, ub, ul, uw, vms, voc, vox, wav, wavpcm, wve, xa.

      noise( duration=0.5 )

            Generates a sample of white noise of the specified duration (in seconds).

      speech( text )

            Uses Steel TTS text-to-speech wrappers to generate speech from the given text.

            Can use either Microsoft Speech API 5.x, NS Speech Synthesizer, eSpeak, or FreeTTS for speech generation.

      system( type="bell" )

            Plays the system sound of the underlying OS specified by type.

            Currently the only system sound supported is "bell" or "warning".

      tone( type="sine", frequency=1700, duration=0.5 )

            Generates a tone sound and plays it to the computer's audio player.

            type can be any of: "sine", "saw", "tri", or "square".

            frequency is specified in Hz.

            duration is specified in seconds.


Example Usage

import cogpy

class Test(cogpy.Experiment):
    audio = cogpy.Audio()

    def start(self):
        audio.tone("saw",900)
        yield 1
        audio.speech("Hello world!")
        yield 1
        audio.file("~/music.wav")

exp = Test()
exp.run()

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.