Skip to content

Commit

Permalink
Merge pull request #936 from AI4Bharat/waveSurfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ishvindersethi22 authored Feb 23, 2024
2 parents 3f97429 + 38c46a4 commit 3c70c09
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const AllAudioTranscriptionLandingPage = () => {
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(128);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
const [waveSurferProgressColor, setWaveSurferProgressColor] = useState("#dd5e98");
Expand All @@ -344,7 +344,7 @@ const AllAudioTranscriptionLandingPage = () => {
const [waveSurferBarWidth, setWaveSurferBarWidth] = useState(2);
const [waveSurferBarGap, setWaveSurferBarGap] = useState(0);
const [waveSurferBarRadius, setWaveSurferBarRadius] = useState(0);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(1);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(2.2);

const [waveSurferWaveformSettings, setWaveSurferWaveformSettings] = useState({
"height": waveSurferHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ useEffect(() => {
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(128);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
const [waveSurferProgressColor, setWaveSurferProgressColor] = useState("#dd5e98");
Expand All @@ -803,7 +803,7 @@ const [waveSurferCursorWidth, setWaveSurferCursorWidth] = useState(1);
const [waveSurferBarWidth, setWaveSurferBarWidth] = useState(2);
const [waveSurferBarGap, setWaveSurferBarGap] = useState(0);
const [waveSurferBarRadius, setWaveSurferBarRadius] = useState(0);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(1);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(2.2);

const [waveSurferWaveformSettings, setWaveSurferWaveformSettings] = useState({
"height": waveSurferHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ useEffect(() => {
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(128);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
const [waveSurferProgressColor, setWaveSurferProgressColor] = useState("#dd5e98");
Expand All @@ -1000,7 +1000,7 @@ const [waveSurferCursorWidth, setWaveSurferCursorWidth] = useState(1);
const [waveSurferBarWidth, setWaveSurferBarWidth] = useState(2);
const [waveSurferBarGap, setWaveSurferBarGap] = useState(0);
const [waveSurferBarRadius, setWaveSurferBarRadius] = useState(0);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(1);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(2.2);

const [waveSurferWaveformSettings, setWaveSurferWaveformSettings] = useState({
"height": waveSurferHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ useEffect(() => {
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(128);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
const [waveSurferProgressColor, setWaveSurferProgressColor] = useState("#dd5e98");
Expand All @@ -848,7 +848,7 @@ const [waveSurferCursorWidth, setWaveSurferCursorWidth] = useState(1);
const [waveSurferBarWidth, setWaveSurferBarWidth] = useState(2);
const [waveSurferBarGap, setWaveSurferBarGap] = useState(0);
const [waveSurferBarRadius, setWaveSurferBarRadius] = useState(0);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(1);
const [waveSurferBarHeight, setWaveSurferBarHeight] = useState(2.2);

const [waveSurferWaveformSettings, setWaveSurferWaveformSettings] = useState({
"height": waveSurferHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ const TranscriptionRightPanel = ({
</Box>

<Box id={"subTitleContainer"} className={classes.subTitleContainer} sx={{
height: showAcousticText ? "calc(100vh - 380px)" : "calc(100vh - 385px)",
height: showAcousticText ? "calc(102vh - 380px)" : "calc(102vh - 385px)",
alignItems: "center",
}}>
{currentPageData?.map((item, index) => {
Expand Down
11 changes: 7 additions & 4 deletions src/ui/pages/container/CL-Transcription/wavesurfer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useRef, memo, useState, useCallback } from "react";
import WaveSurfer from "wavesurfer.js";
import RegionsPlugin from "../../../../../node_modules/wavesurfer.js/dist/plugins/regions.esm.js";
import Minimap from "../../../../../node_modules/wavesurfer.js/dist/plugins/minimap.esm.js";
import TimelinePlugin from '../../../../../node_modules/wavesurfer.js/dist/plugins/timeline.esm.js';
import { useSelector, useDispatch } from "react-redux";
import { setSubtitles } from "../../../../redux/actions/Common";
Expand Down Expand Up @@ -260,16 +259,20 @@ const Timeline2 = ({ details, waveformSettings }) => {
}
}
updateSub(currentSubsCopy);
player.play();
if (region.start.toFixed(3) === parseFloat(DT.t2d(currentSubsCopy[region.id -1].start_time))){
player.currentTime = region.end;
}else{
player.currentTime = region.start;
}
updateRegions(currentSubsCopy);
}
})
}

return (
<>
<div style={{ paddingLeft: "20px", paddingRight: "20px" }} id="minimap"></div>
<div style={{ paddingLeft: "20px", paddingRight: "20px" }} id="waveform"></div>
<div style={{ paddingLeft: "20px", paddingRight: "20px", backgroundColor: "#ffffff" }} id="minimap"></div>
<div style={{ paddingLeft: "20px", paddingRight: "20px", backgroundColor: "#ffffff" }} id="waveform"></div>
</>
);
};
Expand Down
5 changes: 3 additions & 2 deletions src/ui/pages/container/Label-Studio/AllTaskLSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ const LabelStudioWrapper = ({annotationNotesRef, loader, showLoader, hideLoader,
// debugger

useEffect(() => {
localStorage.setItem("labelStudio:settings", JSON.stringify({
bottomSidePanel: ProjectDetails?.project_type?.includes("Audio") ? false : true ,
let sidePanel = ProjectDetails?.project_type?.includes("OCRSegmentCategorization");
localStorage.setItem("labelStudio:settings", JSON.stringify({
bottomSidePanel: !sidePanel,
continuousLabeling: false,
enableAutoSave: false,
enableHotkeys: true,
Expand Down
5 changes: 2 additions & 3 deletions src/ui/pages/container/Label-Studio/LSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,11 @@ const LabelStudioWrapper = ({
}, [userData]); */

useEffect(() => {
let sidePanel = ProjectDetails?.project_type?.includes("OCRSegmentCategorization");
localStorage.setItem(
"labelStudio:settings",
JSON.stringify({
bottomSidePanel:
!(ProjectDetails?.project_type?.includes("Audio")
|| ProjectDetails?.project_type?.includes("Acoustic")),
bottomSidePanel: !sidePanel,
continuousLabeling: false,
enableAutoSave: true,
enableHotkeys: true,
Expand Down
5 changes: 2 additions & 3 deletions src/ui/pages/container/Label-Studio/ReviewLSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,11 @@ const LabelStudioWrapper = ({
}, [userData]); */

useEffect(() => {
let sidePanel = ProjectDetails?.project_type?.includes("OCRSegmentCategorization");
localStorage.setItem(
"labelStudio:settings",
JSON.stringify({
bottomSidePanel:
!(ProjectDetails?.project_type?.includes("Audio")
|| ProjectDetails?.project_type?.includes("Acoustic")),
bottomSidePanel: !sidePanel,
continuousLabeling: false,
enableAutoSave: false,
enableHotkeys: true,
Expand Down
5 changes: 2 additions & 3 deletions src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ const LabelStudioWrapper = ({
}, [userData]); */

useEffect(() => {
let sidePanel = ProjectDetails?.project_type?.includes("OCRSegmentCategorization");
localStorage.setItem(
"labelStudio:settings",
JSON.stringify({
bottomSidePanel: ProjectDetails?.project_type?.includes("Audio")
? false
: true,
bottomSidePanel: !sidePanel,
continuousLabeling: false,
enableAutoSave: false,
enableHotkeys: true,
Expand Down

0 comments on commit 3c70c09

Please sign in to comment.