pub struct Stream {
    pub events: Vec<Event>,
}
Expand description

Temporal arrangement of events

Fields

events: Vec<Event>

Implementations

Creates a new empty Stream with no events.

Examples

Basic usage:

use mumuse::music::stream::Stream;
let s = Stream::new(); 

Adds event to stream

Examples

Basic usage:

use mumuse::music::{time::Time, note::Note, stream::{Stream, Event}};
use mumuse::messages::Status;
let mut stream: Stream = Stream::new();
let time: Time = Time::new(1, 16, 1);
let note: Note = Note::try_from("A3").unwrap();
stream.add_event(Event::new(time, Status::NoteOn, note));

Adds note to stream

Examples

Basic usage:

use mumuse::music::{time::Time, note::Note, stream::Stream, duration::Duration};
let mut stream: Stream = Stream::new();
let note: Note = Note::try_from("A3").unwrap();
let time: Time = Time::new(1, 16, 1);
let duration: Duration = Duration::new(16, 1);
stream.add_note(note, time, duration);

Converts Events to seconds timeline

In order to convert the stream with Time events, one need to declare a bpm (beats per minutes) and a bpb (beats per bar).

Examples

Basic usage:

use mumuse::music::{time::Time, note::Note, stream::Stream, duration::Duration};
let mut stream: Stream = Stream::new();
let note: Note = Note::try_from("A3").unwrap();
let time: Time = Time::new(1, 16, 1);
let duration: Duration = Duration::new(16, 1);
stream.add_note(note, time, duration);
let stream_seconds = stream.to_seconds(120.0, 4);

Plays stream of events in real time

Use ticking for playing the stream of events at regular intervals. For each tick, the events with Time to seconds lying in the tick window are sent as MIDI. The bpm (beats per minutes) and bpb (beats per bar) are needed for the conversion to seconds.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.