Skip to content

module SunVox #

Constants#

CURRENT_VERSION_MAJOR = 1 #

CURRENT_VERSION_MINOR = 9 #

CURRENT_VERSION_MINOR2 = 6 #

DEFAULT_CHANNELS = 2 #

DEFAULT_CONFIG = "" #

DEFAULT_FREQ = 44100 #

MAX_SLOTS = 16 #

NO_MODULE = -1 #

OUTPUT_MODULE = 0 #

Class methods#

.close_slot(slot : Slot) #

Closes a slot. Raises exception if the slot is closed or something goes wrong.

.connect_module(slot : Slot, src, dest) #

Connect a module src to a module dest.

.disconnect_module(slot : Slot, src, dest) #

Disconnect a module src from a module dest.

.end_of_song?(slot : Slot) : Bool #

Is the song over and the end has been reached?

.find_module(slot : Slot, name) #

Find a module in a slot by name

.find_pattern(slot : Slot, name) #

Finds the pattern in slot by name

.frequency_to_pitch(in_freq) #

.get_current_line(slot : Slot) #

The current line the playhead is at

.get_current_line2(slot : Slot) #

THe current line the play head is at in a fractional form (not sure how this works) https://warmplace.ru/soft/sunvox/sunvox_lib.php#sv_get_current_line2

.get_current_signal_level(slot : Slot, channel) #

Gets the current output signal level

.get_log(bytes : Int32) #

Gets the debug log messages

.get_module_color(slot : Slot, module_num) #

Get the color of a module in 0xBBGGRR format.

.get_module_ctl_name(slot : Slot, module_num, ctl_num) #

Get the name of a module's controller.

.get_module_ctl_value(slot : Slot, module_num, ctl_num, scaled = false) #

Get the value of a modules controller.

.get_module_curve(slot : Slot, module_num, curve_num, length) #

Get the curve from a module

.get_module_finetune(slot : Slot, module_num) #

Get module's finetune values.

.get_module_flags(slot : Slot, module_num) #

Get the flags set on a module

.get_module_inputs(slot : Slot, module_num) #

A list of all the inputs a module has.

.get_module_inputs_number(slot : Slot, module_num) #

The number of module inputs.

.get_module_name(slot : Slot, name) #

Gets the name of a module.

.get_module_outputs(slot : Slot, module_num) #

A list of all the outputs a module has.

.get_module_outputs_number(slot : Slot, module_num) #

The number of module outputs.

.get_module_scope(slot : Slot, module_num, channel, samples_to_read) #

Get the raw audio output values for a module.

.get_module_xy(slot : Slot, module_num) #

Get the x, y positon of a module.

.get_number_of_module_ctls(slot : Slot, module_num) #

Get the number of controllers a module has.

.get_number_of_modules(slot : Slot) #

The number of modules in slot

.get_number_of_patterns(slot : Slot) #

Gets the number of patterns in a slot

.get_pattern_data(slot : Slot, pattern_num) #

Get the event data, seperated by tracks.

.get_pattern_lines(slot : Slot, pattern_num) #

Gets the number of lines in a pattern

.get_pattern_name(slot : Slot, pattern_num) #

Gets the pattern's name

.get_pattern_tracks(slot : Slot, pattern_num) #

Get the number of track in the pattern.

.get_pattern_x(slot : Slot, pat_num) #

Gets the pattern's starting line.

.get_pattern_y(slot : Slot, pat_num) #

Gets the pattern's height.

.get_song_bpm(slot : Slot) #

Gets the BPM of the song in slot

.get_song_length(slot : Slot) #

Get the length of the song in seconds

.get_song_length_frames(slot : Slot) #

The total length in ticks of the song in slots.

.get_song_length_lines(slot : Slot) #

The total song length in lines of slot.

.get_song_name(slot : Slot) #

Gets the name of the song in slot

.get_song_tpl(slot : Slot) #

Number of lines executed in a second in the song.

.load(slot : Slot, filename) #

Loads a filename into a slot.

.load_module(slot : Slot, filename, x = 0, y = 0, z = 0) #

Load a module from a file. File can be sunsynth, xi, wav, or aiff.

.module_bypass?(slot : Slot, module_num) #

.module_effect?(slot : Slot, module_num) #

.module_exists?(slot : Slot, module_num) #

.module_mute?(slot : Slot, module_num) #

.module_solo?(slot : Slot, module_num) #

.new_module(slot : Slot, type : ModuleType, name = "", x = 0, y = 0, z = 0) #

Create a new module in slot. Returns the number of the new module.

.open_slot(slot : Slot) #

Opens a slot

.pattern_mute(slot : Slot, pattern_num, mute = true) #

Mute/Unmute the pattern.

.pause(slot : Slot) #

Pauses the playback at the current line.

.pitch_to_frequency(in_pitch) #

.play(slot : Slot) #

Plays the current song from the current line.

.play_from_beginning(slot : Slot) #

Plays the current song from the beginning.

.remove_module(slot : Slot, module_num) #

Remove the module module_num in slot.

.repeats?(slot : Slot) : Bool #

Returns whether or not a song will repeat when the end is reached.

.resume(slot : Slot) #

Resumes playback from a paused state.

.sample_rate #

.sampler_load(slot : Slot, sampler_module_num, filename, sample_slot = -1) #

Loads a file into a sampler. File must be xi, wav, or aiff.

.send_event(slot : Slot, track_num, note : Int32, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0) #

Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num of 0 causes no effect, so any module you would like to actually use must have 1 added to it

.send_event(slot : Slot, track_num, event : Event) #

Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num of 0 causes no effect, so any module you would like to actually use must have 1 added to it

.send_event(slot : Slot, track_num, note : Note, velocity, module_num = -1, ctl = 0, effect = 0, ctl_value = 0) #

Sends an event to SunVox. Can be used to send notes, change ctl values, or set note effects. A module_num of 0 causes no effect, so any module you would like to actually use must have 1 added to it

.set_event_time(slot : Slot, timestamp : UInt32 = 0_u32, set = true) #

Changes how SunVox processes send_event. Instead of playing the event as soon as it's called, this allows send_event to be delayed by a number of ticks. When setting set to false it will reset the timing method back to immediate. When used timestamp should generally be SunVox.ticks + (SunVox.ticks_per_second/1000 * delay_milliseconds)

.set_module_curve(slot : Slot, module_num, curve_num, curve_data : Slice(Float32)) #

Set the curve data of a module

.set_repeat(slot : Slot, bool) : Nil #

Sets whether or not a song will repeat when the end is reached.

.skip_to_line(slot : Slot, line_num : Int32) #

Jumps the current position of the playhead to a line number.

.start_engine(config = DEFAULT_CONFIG, freq = DEFAULT_FREQ, channels = DEFAULT_CHANNELS, no_debug_output = false, offline = false, sample_type = SampleType::Int16, one_thread = false) #

Starts up the SunVox Engine. Hooks at_exit to ensure stop_engine is run on close

.started? #

.stop(slot : Slot) #

Stops the current song from playing. 2 calls will stop all the synths and sounds.

.stop_engine #

Shuts down the engine.

.ticks : UInt32 #

The current tick

.ticks_per_second : UInt32 #

How many ticks happen per second

.time_map(slot : Slot, start_line, len, flags = 0) #

Honestly, no idea how this one works. Seems like it should be useful if someone who isn't me wants to figure it out lol: https://warmplace.ru/soft/sunvox/sunvox_lib.php#sv_get_time_map Good Luck!

.update_input #

.volume(slot : Slot, volume : UInt8) #

Sets the output volume of the slot.