Sndlib Functions#
in pysndlib.sndlib
Sound files have built-in descriptors known as headers. The following functions return the information in the header. In each case the argument to the function is the full file name of the sound file.
- mus_sound_samples(file)#
 samples of sound according to header
- mus_sound_framples(file)#
 samples per channel
- mus_sound_datum_size(file)#
 bytes per sample
- mus_sound_data_location(file)#
 location of first sample (bytes)
- mus_sound_chans(file)#
 number of channels (samples are interleaved)
- mus_sound_srate(file)#
 sampling rate
- mus_sound_header_type(file)#
 header type (aiff etc)
- mus_sound_sample_type(file)#
 sample type (alaw etc)
- mus_sound_original_sample_type(file)#
 
- mus_sound_comment_start(file)#
 comment start (bytes) if any
- mus_sound_comment_end(file)#
 comment end (bytes)
- mus_sound_length(file)#
 true file length in bytes
- mus_sound_fact_samples(file)#
 
- mus_sound_type_specifier(file)#
 original header type identifier
- mus_sound_block_align(file)#
 
- mus_sound_bits_per_sample(file)#
 bits per sample
- mus_sound_set_chans(file, val)#
 set number of channels for file
- mus_sound_set_srate(file, val)#
 set the sample rate of the file
- mus_sound_set_header_type(file, mus_header)#
 set header type of file
- mus_sound_set_sample_type(file, mus_sample)#
 set sample type of file
- mus_sound_set_data_location(file, val)#
 set the data location of the file
- mus_sound_set_samples(file, val)#
 set number of samples in the file
- mus_header_type_name(header_type)#
 get file header type as a string
- mus_header_type_to_string(header_type)#
 convert a header enum to a string
- mus_sample_type_name(samp_type)#
 get file sample type as a string
- mus_sample_type_to_string(samp_type)#
 convert a sample enum to a string
- mus_sample_type_short_name(samp_type)#
 convert a sample enum to a short name string
- mus_sound_comment(file)#
 retrieve file comment if one exists
- mus_bytes_per_sample(samp_type)#
 bytes per sample
- mus_sound_duration(file)#
 sound duration in seconds
- mus_sound_override_header(file, srate, chans, sample_type, header_type, location, size)#
 override the header information
- mus_sound_loop_info(filename)#
 8 loop vals (mode,start,end) then base-detune and base-note (empty list if no loop info found)
- mus_sound_set_loop_info(filename, info)#
 set file loop information
- mus_sound_open_input(filename)#
 open file to read as input
- mus_sound_open_output(file, srate, chans, sample_type, header_type, comments)#
 open file for output
- mus_sound_reopen_output(file, srate, chans, sample_type, header_type, location)#
 reopen a file for further input
- mus_sound_close_input(fd)#
 close file for input
- mus_sound_close_output(fd, bytes_of_data)#
 close file for output
- mus_set_clipping(new_value)#