Added reprocess audio button to waveform display

This commit is contained in:
2018-09-10 17:56:32 +01:00
parent e46012c988
commit 7ee4d1ea76
3 changed files with 24 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -60,6 +60,8 @@ public class AudiobookRecorder extends JFrame {
JSpinner endOffset;
JSpinner postSentenceGap;
JButton reprocessAudio;
Thread playingThread = null;
Random rng = new Random();
@@ -228,6 +230,22 @@ public class AudiobookRecorder extends JFrame {
sampleControl.add(sampleWaveform, BorderLayout.CENTER);
reprocessAudio = new JButton(Icons.redo);
reprocessAudio.setToolTipText("Reprocess Audio");
reprocessAudio.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedSentence != null) {
selectedSentence.autoTrimSample();
selectedSentence.recognise();
sampleWaveform.setData(selectedSentence.getAudioData());
sampleWaveform.setMarkers(selectedSentence.getStartOffset(), selectedSentence.getEndOffset());
startOffset.setValue(selectedSentence.getStartOffset());
endOffset.setValue(selectedSentence.getEndOffset());
postSentenceGap.setValue(selectedSentence.getPostGap());
}
}
});
startOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
startOffset.setPreferredSize(new Dimension(100, 20));
endOffset = new JSpinner(new SteppedNumericSpinnerModel(0, 0, 1, 0));
@@ -265,6 +283,8 @@ public class AudiobookRecorder extends JFrame {
});
JPanel controls = new JPanel();
controls.add(reprocessAudio);
controls.add(new JLabel("Start Offset:"));
JButton startFastDown = new JButton("<<");

View File

@@ -17,6 +17,8 @@ public class Icons {
static public ImageIcon recordRoom;
static public ImageIcon save;
static public ImageIcon redo;
static void loadIcons() {
book = new ImageIcon(Icons.class.getResource("icons/book.png"));
chapter = new ImageIcon(Icons.class.getResource("icons/chapter.png"));
@@ -32,6 +34,8 @@ public class Icons {
recordRoom = new ImageIcon(Icons.class.getResource("icons/record-room.png"));
save = new ImageIcon(Icons.class.getResource("icons/save.png"));
redo = new ImageIcon(Icons.class.getResource("icons/redo.png"));
}
}