예제 #1
0
파일: sender.py 프로젝트: tmgriffin/8349
def soundSend():

    #Generators for each of the pitches. Need to adjust numbers
    #zeroGen = (audiogen.util.crop(audiogen.tone(1000), .2))
    #oneGen = (audiogen.util.crop(audiogen.tone(2000), .2))
    #controlGen = (audiogen.util.crop(audiogen.tone(3000), .2))
    #audiogen.sampler.play(zeroGen)

    # open file with secret message
    with open(sys.argv[2], 'rb') as f, nullPrint():
        byte = f.read(1)
        mask = 1
        char = 'a'

        #wait for the other side to start
        time.sleep(1)

        # process 1 byte at a time
        while len(byte) > 0:
            bit = 0
            # convert ascii into decimal equivalent
            byte = ord(byte)
            # convert decimal byte into binary bits
            # play corresponding tone for each bit
            for i in reversed(range(8)):
                bit = (mask & (byte >> i))
                if bit == 0:
                    audiogen.sampler.play(
                        audiogen.util.crop(audiogen.tone(1000), .2), True)
                else:
                    audiogen.sampler.play(
                        audiogen.util.crop(audiogen.tone(2000), .2), True)

            byte = f.read(1)

        # play tone signaling eof
        audiogen.sampler.play(audiogen.util.crop(audiogen.tone(3000), .4),
                              True)
예제 #2
0
def sound():
    """
    base sound to use
    :return: sine wave at 150Hz
    """
    return tone(150)
예제 #3
0
import audiogen
from audiogen import *
import sys


if __name__ == "__main__":

    audiogen.sampler.write_wav(sys.stdout, audiogen.tone(440))


예제 #4
0
def play(freq):
    time = 0.5
    n = audiogen.sampler.play(audiogen.tone(freq), blocking=False)
    time.sleep(time)
    n.close()
예제 #5
0
파일: play.py 프로젝트: vencewill/myscripts
import audiogen

audiogen.sampler.play(audiogen.tone(20000))
예제 #6
0
파일: morse.py 프로젝트: casebeer/koch
def tone_for(seconds):
    tone = audiogen.crop(audiogen.util.volume(audiogen.tone(HERTZ), -3),
                         seconds)
    return tone
예제 #7
0
"""
Solfeggio Frequencies
"""
import audiogen

chakras = {'first':'174','second':'285','third':'396','fourth':'417','fifth':'528','sixth':'639','seventh':'741','eigth':'852','nineth':'963'}
for chakra in chakras:
    try:
        audiogen.sampler.play(audiogen.tone(int(chakras.get(chakra,""))))
    except:
        pass
예제 #8
0
파일: morse.py 프로젝트: casebeer/koch
def tone_for(seconds):
	tone = audiogen.crop(audiogen.util.volume(audiogen.tone(HERTZ), -3), seconds)
	return tone
예제 #9
0
import audiogen
from audiogen import *
import sys

if __name__ == "__main__":

    audiogen.sampler.write_wav(sys.stdout, audiogen.tone(440))
예제 #10
0
#!/usr/bin/python

import audiogen
import sys
from audiogen.util import constant

#audiogen.sampler.write_wav(sys.stdout, audiogen.tone(440))
audiogen.sampler.play(
    audiogen.util.mixer((audiogen.tone(50), audiogen.tone(52)), [
        (constant(0.3), constant(0.3)),
    ]))
예제 #11
0
import audiogen

audiogen.sampler.play(audiogen.tone(440))
예제 #12
0
import audiogen
from note_freqs import getFreq

print getFreq('F#4')
print getFreq('E4')

import time

# This is using the old method:
audiogen.sampler.play(audiogen.tone(getFreq('F#4')))

# from davy wybiral's script we can do the same thing using waveforms:
# but how exactly??