Multiple monitor internet audio editor and participant with waveform preview
React-studio-js


options Record monitor, reduce, cut up, shift monitor, CRUD operations for Annotations, save to native storage(non-obligatory) 
Demo
Browser Support
react-studio-js requires webaudio within the browser to operate appropriately: Can I Use?
Installation
npm i react-studio-js
GitHub Reactjs instance
https://github.com/TareqFl/react-studio-js-example
import ReactStudio from "react-studio-js"; // =============Annotations Actions================> const actions = [ { class: "fas.fa-play", title: "Play Annotation", action: (annotation) => { ee.emit("play", annotation.start, annotation.end); }, }, { class: "fas.fa-plus", title: "Insert New Annotation", action: (annotation, i, annotations, opts) => { if (i === annotations.length - 1) { return console.log("not possible"); } let newIndex = i + 1; const newAnnotation = { id: String(newIndex), start: annotation.end, end: annotations[i + 1].begin, traces: ["New Draft"], lang: "en", }; annotations.forEach((ann, indx) => { if (indx >= newIndex) { return (ann.id = String(indx + 1)); } }); annotations.splice(i + 1, 0, newAnnotation); }, }, { class: "fas.fa-trash", title: "Delete annotation", motion: (annotation, i, annotations) => { annotations.splice(i, 1); }, }, ]; // =============Annotations Actions================> var playlist = ReactStudio({ samplesPerPixel: 3000, mono: true, waveHeight: 70, timescale: true, container: doc.getElementById("playlist"), state: "cursor", colours: { waveOutlineColor: "#222B36", timeColor: "gray", fadeColor: "black", }, controls: { present: true, width: 175, widgets: { collapse: false, }, }, annotationList: { annotations: [], controls: actions, editable: true, isContinuousPlay: false, linkEndpoints: false, }, zoomLevels: [500, 1000, 3000, 5000], }); playlist .load([ { src: "track 1 source", name: "name", gain: 1, }, { src: "track 2 source", name: "name", start: 8.5, fadeIn: { duration: 0.5, }, fadeOut: { shape: "logarithmic", duration: 0.5, }, }, ]) .then(operate () { // can do stuff with the playlist. });
Playlist Options
var choices = { // webaudio api AudioContext ac: new (window.AudioContext || window.webkitAudioContext)(), // DOM container aspect REQUIRED container: doc.getElementById("playlist"), // pattern charge of the challenge. (used for proper peaks rendering) sampleRate: new ( window.AudioContext || window.webkitAudioContext ).sampleRate(), // variety of audio samples per waveform peak. // have to be an entry in possibility: zoomLevels. samplesPerPixel: 4096, // whether or not to attract a number of channels or mix them. mono: true, // permits "unique solo" the place solo switches between tracks exclSolo: false, // default fade curve kind. fadeType: "logarithmic", // (logarithmic | linear | sCurve | exponential) // whether or not or to not embody the time measure. timescale: false, // management panel on left facet of waveform controls: { // whether or not or to not embody the monitor controls present: false, // width of controls in pixels width: 150, // whether or not to render the widget or not within the controls panel. widgets: { // Mute & solo button widget muteOrSolo: true, // Volume slider quantity: true, // Stereo pan slider stereoPan: true, // Collapse monitor button collapse: true, // Remove monitor button take away: true, }, }, colours: { // coloration of the wave background waveOutlineColor: "white", // coloration of the time ticks on the canvas timeColor: "gray", // coloration of the fade drawn on canvas fadeColor: "black", }, // peak in pixels of every canvas aspect a waveform is on. waveHeight: 128, // width in pixels of waveform bars. barWidth: 1, // spacing in pixels between waveform bars. barGap: 0, // interplay state of the playlist // (cursor | choose | fadein | fadeout | shift) state: "cursor", // (line | fill) seekStyle: "line", // Array of zoom ranges in samples per pixel. // Smaller numbers have a better zoom in. zoomLevels: [512, 1024, 2048, 4096], // Whether to routinely scroll the waveform whereas enjoying isAutomaticScroll: false, // configuration object for the annotations add on. annotationList: { // Array of annotations in [Aeneas](https://github.com/readbeyond/aeneas) JSON format annotations: [], // Whether the annotation texts can be in updateable contenteditable html parts editable: false, // User outlined capabilities which may manipulate the loaded annotations controls: [ { // class names for generated <i> tag separated by '.' class: "fa.fa-minus", // title attribute for the generated <i> tag title: "Reduce annotation end by 0.010s", // function which acts on the given annotation row // when the corresponding <i> is clicked. action: (annotation, i, annotations, opts) => { // @param Object annotation - current annotation // @param Number i - index of annotation // @param Array annotations - array of annotations in the playlist // @param Object opts - configuration options available // - opts.linkEndpoints }, }, ], // If false when clicking an annotation id phase // playback will cease after phase completion. isContinuousPlay: false, // If true annotation endpoints will stay linked when dragged // in the event that they had been the identical worth earlier than dragging began. linkEndpoints: false, // move a customized operate which is able to obtain the mastergainnode for this playlist and the audio context's vacation spot. // when you move a operate, you need to join these two nodes to listen to sound at minimal. // if you want to clear one thing up when the graph is disposed, return a cleanup operate. react-studio-js will cleanup the nodes handed as arguments. results: operate (masterGainNode, vacation spot, isOffline) { // analyser nodes do not work offline. if (!isOffline) masterGainNode.join(analyser); masterGainNode.join(vacation spot); // return operate cleanup() { // // when you create webaudio nodes that must be cleaned up do this right here // // see the monitor results instance. // }; }, }, };
Track Options
{ // a media path for XHR, a Blob, a File, or an AudioBuffer object. src: 'monitor supply .mp3 .wav', // identify that can show within the playlist management panel. identify: 'identify', // quantity degree of the monitor between [0-1] achieve: 1, // whether or not the monitor ought to initially be muted. muted: false, // whether or not the monitor ought to initially be soloed. soloed: false, // time in seconds relative to the playlist // ex (monitor will begin after 8.5 seconds) // DEFAULT 0 - monitor begins at starting of playlist begin: 8.5, // monitor fade in particulars fadeIn: exponential) form: 'logarithmic', // size of fade ranging from the start of this monitor, in seconds. length: 0.5, , // monitor fade out particulars fadeOut: linear // the place the waveform for this monitor ought to start from // ex (Waveform will start 15 seconds into this monitor) // DEFAULT begin in the beginning - 0 seconds cuein: 15, // the place the waveform for this monitor ought to finish // ex (Waveform will finish at 30 second into this monitor) // DEFAULT length of the monitor cueout: 30, // customized class for distinctive monitor styling customClass: 'vocals', // customized background-color for the canvas-drawn waveform waveOutlineColor: '#f3f3f3', // interplay states allowed on this monitor. // DEFAULT - all true states: { cursor: true, fadein: true, fadeout: true, choose: true, shift: true, }, // pre-selected part on monitor. // ONLY ONE choice is permitted in an inventory of tracks, will take most not too long ago set if a number of handed. // This monitor is marked as 'lively' chosen: { // begin time of choice in seconds, relative to the playlist begin: 5, // finish time of choice in seconds, relative to the playlist finish: 15, }, // worth from -1 (full left pan) to 1 (full proper pan) stereoPan: 0, // move a customized operate which is able to obtain the final graphnode for this monitor and the mastergainnode. // when you move a operate, you need to join these two nodes to listen to sound at minimal. // if you want to clear one thing up when the graph is disposed, return a cleanup operate. react-studio-js will cleanup the nodes handed as arguments. results: operate(graphEnd, masterGainNode, isOffline) { var reverb = new Tone.Reverb(1.2); Tone.join(graphEnd, reverb); Tone.join(reverb, masterGainNode); return operate cleanup() { reverb.disconnect(); reverb.dispose(); } } }
Playlist Events
react-studio-js makes use of an occasion of event-emitter to ship & obtain messages from the playlist.
import EventEmitter from "event-emitter"; import ReactStudio from "react-studio-js"; var playlist = WaveformPlaylist( { container: doc.getElementById("playlist"), }, // you possibly can move your individual occasion emitter EventEmitter() ); // retrieves the occasion emitter the playlist is utilizing. var ee = playlist.getEventEmitter();
An instance of utilizing the occasion emitter to manage the playlist will be present in /dist/js/examples/emitter.js
Events to Invoke
| occasion | arguments | description |
|---|---|---|
play |
begin:non-obligatory, finish:non-obligatory |
Starts playout of the playlist. Takes non-obligatory Number parameters in seconds begin and finish to play simply an audio phase. begin will be handed with out an finish to play to the top of the monitor. |
pause |
none | Pauses playout of the playlist. |
cease |
none | Stops playout of the playlist. |
rewind |
none | Stops playout if playlist is enjoying, resets cursor to the start of the playlist. |
fastforward |
none | Stops playout if playlist is enjoying, resets cursor to the top of the playlist. |
clear |
none | Stops playout if playlist is enjoying, removes all tracks from the playlist. |
file |
none | Starts recording an audio monitor. Begins playout of different tracks in playlist if there are any. |
zoomin |
none | Changes zoom degree to the following smallest entry (if one exists) from the array zoomLevels. |
zoomout |
none | Changes zoom degree to the following largest entry (if one exists) from the array zoomLevels. |
trim |
none | Trims presently lively monitor to the cursor choice. |
reduce |
none | cuts presently lively monitor to the cursor choice. |
cut up |
none | cut up presently lively monitor |
statechange |
cursor / choose / fadein / fadeout / shift |
Changes interplay state to the state given. |
fadetype |
logarithmic / linear / sCurve / exponential |
Changes playlist default fade kind. |
newtrack |
File |
Loads File object into the playlist. |
addAnnotation |
json |
provides Annotations for present playlist. |
clearAnnotations |
none | clears loaded annotations. |
volumechange |
quantity, monitor |
Set quantity of monitor to quantity (0-100) |
mastervolumechange |
quantity |
Set a brand new grasp quantity quantity (0-100) |
choose |
begin, finish, monitor:non-obligatory |
Seek to the beginning time or begin/finish choice optionally with lively monitor monitor. |
startaudiorendering |
wav / buffer |
Request for a downloadable file or internet Audio buffer that symbolize the present work |
automaticscroll |
true/false |
Change property isAutomaticScroll. |
continuousplay |
true/false |
Change property isContinuousPlay. |
linkendpoints |
true/false |
Change property linkEndpoints. |
annotationsrequest |
none | Requests to obtain the annotations to a json file. |
stereopan |
panvalue, monitor |
Set pan worth of monitor to panvalue (-1-1) |
Events to Listen to
| occasion | arguments | description |
|---|---|---|
choose |
begin, finish, monitor |
Cursor choice has occurred from begin to finish with lively Track monitor. |
timeupdate |
playbackPosition |
Sends present place of playout playbackPosition in seconds. |
scroll |
scrollLeft |
Sends present place of scroll scrollLeft in seconds. |
statechange |
state |
Sends present interplay state state. |
shift |
deltaTime, monitor |
Sends deltaTime in seconds change for Track monitor |
mute |
monitor |
Mute button has been pressed for monitor |
solo |
monitor |
Solo button has been pressed for monitor |
enableCut |
boolean |
Emits a boolean worth when a area is made (non-obligatory) |
enableSplit |
boolean |
Emits a boolean worth to allow cut up (non-obligatory) |
take awayTrack |
monitor |
Remove button has been pressed for monitor |
take awayTrackFromDb |
monitor |
Event listener to take away monitor from native storage (opotional)monitor |
saveTracksToLocalStorage |
monitor |
Event listener for monitor replace and save to native storage (non-obligatory) monitor |
saveToLocalFromSplit |
monitor |
Event listener for monitor replace on cut up and save to native storage(non-obligatory)monitor |
getTrackLength |
playlist length |
Event listener for playlist length. |
newTimeDurationAfterEdit |
playlist length |
Event listener for playlist length after edit. |
changeTrackView |
monitor, opts |
Collapse button has been pressed for monitor |
volumechange |
quantity, monitor |
Volume of monitor has modified to quantity (0-100) |
mastervolumechange |
quantity |
Master quantity of the playlist has modified to quantity (0-100) |
audiorequeststatechange |
state, src |
Loading audio src (string or File) is now in state (Number) UNINITIALIZED = 0, LOADING = 1, DECODING = 2,FINISHED = 3, |
loadprogress |
%, src |
Loading audio src has loaded % % (0-100) |
audiosourcesloaded |
none | Audio decoding has completed for all tracks |
tracksUpdated |
boolean |
Event Listener when tracks are loaded that recieves a bool. |
audiosourcesrendered |
none | Tracks are rendered to the playlist |
tracksLeft |
none | Tracks remaining within the playlist. |
audiosourceserror |
err |
Error thrown whereas loading tracks |
completed |
none | Event fired when cursor ( whereas enjoying ) reaches the top (most length) |
audiorenderingstarting |
offlineCtx, setUpPromiseArray |
Event fired after the OfflineAudioContext is created earlier than any rendering begins. If any setup is async earlier than offline redering, push a promise to the setUpPromiseArray. |
audiorenderingfinished |
kind, information |
Return the results of the rendering within the desired format. kind will be buffer or wav and can be utilized to dertermine the information kind. When kind is wav, information is a blob object that symbolize the wav file. |
stereopan |
panvalue, monitor |
Pan worth of monitor has been modified to panvalue |
Tests
npm take a look at
Development with out instance adjustments
npm set up && npm begin
This will set up dependencies and begin the webpack server.
npm set up && npm run dev
This will construct and watch the jekyll web site and startup the webpack dev server.
License
GitHub
HI-FI News
through React.js Examples https://ift.tt/ivAsuLk
October 21, 2023 at 02:44AM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT








