This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "core-js/stable"; | |
| import "regenerator-runtime/runtime"; | |
| import { render, html, nothing } from 'lit/html.js'; | |
| import { resumeAudioContext } from '@ircam/resume-audio-context'; | |
| import { getTime } from '@ircam/sc-gettime'; | |
| import { Scheduler, Transport, MTCSend, MTCReceive } from '../../../src/index.js'; | |
| import '@ircam/simple-components/sc-bang.js'; | |
| import '@ircam/simple-components/sc-clock.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function quantize(val, precision = 1e-9) { | |
| return Math.round(val / precision) * precision; | |
| } | |
| // works by reference | |
| function swap(arr, i1, i2) { | |
| const tmp = arr[i1]; | |
| arr[i1] = arr[i2]; | |
| arr[i2] = tmp; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use llq::{Node, Queue}; | |
| struct AudioRenderer { | |
| is_real_node: bool, | |
| garbage_collector: Option<llq::Producer<Self>>, | |
| garbage_node: Option<llq::Node<Self>>, | |
| } | |
| impl AudioRenderer { | |
| fn new(garbage_collector: llq::Producer<Self>) -> Self { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use web_audio_api::context::{AudioContext, AudioContextOptions, BaseAudioContext}; | |
| use web_audio_api::media_devices; | |
| use web_audio_api::media_devices::{enumerate_devices_sync, MediaDeviceInfo, MediaDeviceInfoKind}; | |
| use web_audio_api::media_devices::{MediaStreamConstraints, MediaTrackConstraints}; | |
| use web_audio_api::node::AudioNode; | |
| fn ask_source_id() -> Option<String> { | |
| println!("Enter the input 'device_id' and press <Enter>"); | |
| println!("- Use 0 for the default audio input device"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Simple Linear Regression for 2 dimensionnal data | |
| * | |
| * @param {Array<Array>} observations - data | |
| */ | |
| function simpleLinearRegression(observations) { | |
| // means | |
| let xSum = 0; | |
| let ySum = 0; | |
| const length = observations.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class Scheduler { | |
| constructor(ctx, period = 0.025, lookahead = 0.1) { | |
| this.queue = []; | |
| this.ctx = ctx; | |
| this.period = period; | |
| this.lookahead = lookahead; | |
| this.tick = this.tick.bind(this); | |
| // @todo - launch only if there is somthing to do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title></title> | |
| </head> | |
| <body> | |
| <button>play/pause</button> | |
| <script> | |
| var audioCtx = new AudioContext(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Transport Buttons</title> | |
| <link rel="stylesheet" type="text/css" href="./transport-btns.css" /> | |
| </head> | |
| <body> | |
| <code>Play/Pause Button</code> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OrthogonalData { | |
| constructor() { | |
| this._cols = null; // object of arrays | |
| this._rows = null; // array of objects | |
| } | |
| // verify that data are consistents | |
| _checkConsistency() { | |
| let size = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>css</title> | |
| <style> | |
| a { | |
| display: block; | |
| border :1px solid #787878; | |
| width: 300px; |
NewerOlder