Exemplo n.º 1
0
##\example tu_002a_sound_generation.py
#More Advance sound generation!!
#
#\n\n <small>Click on each functions for more detail </small>\n

import peaceaudio
import peaceaudiolib

peaceaudio.init_peaceaudio(sample_rate = 44100, inch = 0, outch=2, framesPerBuffer = 128)
peaceaudio.createTable(1024)
peaceaudio.openStream()


def callback():
	peaceaudio.generate()
	peaceaudio.writeBuffer()
	
track = peaceaudio.createStandTrack(freq=220.0,waveshape=peaceaudio.wavetype.sinewave)
mixer = peaceaudio.createMixer()
mixer.addTrack(track)
track.setvolume(0.5)
peaceaudio.setMixer(mixer)
peaceaudio.setCallback(callback)

peaceaudio.start()
raw_input("Press Enter to exit")
peaceaudio.stop()
Exemplo n.º 2
0
##\example tu_003a_Signal_viewer_basic.py
#View generated signal!!
#
#\n\n <small>Click on each functions for more detail </small>\n

import peaceaudio
import peacevisual
import gl


peaceaudio.init_peaceaudio(framesPerBuffer = 256)#Modify framesPerBuffer for different results
peaceaudio.createTable(1024)
peaceaudio.openStream()
wave = []

def callback():
	peaceaudio.generate()
	peaceaudio.writeBuffer()
	return 1

track = peaceaudio.createStandTrack(freq=220.0,waveshape=peaceaudio.wavetype.sinewave)
mixer = peaceaudio.createMixer()
mixer.addTrack(track)
track.setvolume(0.5)
peaceaudio.setMixer(mixer)

peaceaudio.setCallback(callback)

peaceaudio.start()
raw_input("Press Enter to Continue")
wave = peaceaudio.getBufferl()#Capture signal from left channel
Exemplo n.º 3
0
##\example tu_005a_NES_Famicom_sound_emulation.py
#Play sequence data of NES (famicom) sound emulation V0.03
#
#\n\n <small>Click on each functions for more detail </small>\n
#

import peaceaudio
import time
import song.nes.sidepocket_test as demosong

buffersize = 128
peaceaudio.init_peaceaudio(sample_rate = 44100, inch = 0, outch=2, framesPerBuffer = buffersize)
peaceaudio.openStream()

track = peaceaudio.createNESTrack()
track.initStringCompiler(demosong.text)
track.compileString()

def callback():
        peaceaudio.generate()
        peaceaudio.writeBuffer()
        return 1


mixer = peaceaudio.createMixer()
mixer.addTrack(track)

peaceaudio.setMixer(mixer)
peaceaudio.setCallback(callback)
peaceaudio.start()