You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Medussa: A cross-platform high-level audio library for Python
Usage Examples
importmedussa# Open default audio deviced=medussa.open_default_device()
# Load a sound file into memory, then play it looped:data,fs=medussa.read_file('/path/to/file2.wav')
s1=d.open_array(data,fs)
s1.is_looping=Trues1.play()
# Try out the blocking functions; be careful with long duration soundfiles# Read a soundfile into a numpy arraybuff,fs=medussa.read_file('/path/to/shortfile.wav')
# Now play it on the default output devicemedussa.play_array(buff, fs)
# Stream the same file from disk; also blocksmedussa.play_file('/path/to/shortfile.wav')
# Create a 500-Hz tone streams2=d.create_tone(500)
# mix_mat is a numpy array that allows you to route input (file or array channels) to output channels, and adjust channel volumemm=s2.mix_matmm*=.1# turn the volume downs2.mix_mat=mms2.play()
# Pink noise in right channels3=d.create_pink()
mm=s3.mix_matmm[0] =0# turn off left channelmm[1] =.1# turn on right channels3.mix_mat=mms3.is_playing=True# Same as s3.play()s3.is_muted=True# mute; same as s3.mute(True)# Stream a flac file, show off fading:s4=medussa.open_file('/path/to/file.flac')
s4.mix_mat_fade_duration=1.# Set fade to 1 secs4.play()
mm=s4.mix_matmm=mm[::-1] # Swap left and right channelss4.mix_mat=mm# Fade will start here, when mix_mat is assigned. Left channel will fade out, right will fade ins1.stop()