123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051moduleSystem=structexternalenv_logger_init_raw:unit->unit="env_logger_init"letis_initialized=reffalseletenv_logger_init()=ifnot!is_initializedthen(is_initialized:=true;env_logger_init_raw())endmoduleWav=structexternalread_wav_file_mono_exn_raw:string->floatarray="read_wav_file_mono"letread_wav_file_mono_exnpath=(* TODO: This array can't be indexed with [Array.get] but values can be
obtained with (say) [Array.iter]. This is possibly a bug in the ocaml
rust bindings for the [float array] special case. *)letbroken_array=read_wav_file_mono_exn_rawpathinArray.of_list(Array.to_listbroken_array)endmoduleOutput_stream=structtypetexternalcreate_with_downsample_32:int32->t="create_output_stream_with_downsample"letcreate_with_downsampledownsample=create_with_downsample_32(Int32.of_intdownsample)externalsample_rate_hz_32:t->int32="sample_rate_hz"letsample_rate_hzt=sample_rate_hz_32t|>Int32.to_intexternalnum_channels_32:t->int32="num_channels"letnum_channelst=num_channels_32t|>Int32.to_intexternalset_buffer_padding_32:t->int32->unit="set_buffer_padding"letset_buffer_paddingtbuffer_padding=set_buffer_padding_32t(Int32.of_intbuffer_padding)externalsamples_behind_32:t->int32="samples_behind"letsamples_behindt=samples_behind_32t|>Int32.to_intexternalsend_sample:t->float->unit="send_sample"end