Compare commits
No commits in common. "afcdc8a74995464131d0e3a04274e2860a899b69" and "7bc4e7ef7885c272c5dd5b50868bf660b021ef33" have entirely different histories.
afcdc8a749
...
7bc4e7ef78
|
@ -1,57 +0,0 @@
|
||||||
package com.jwl.driver.server.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import com.jwl.driver.server.dto.LoginUserDto;
|
|
||||||
import com.jwl.driver.server.response.BaseResponse;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.sound.sampled.*;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 支付表 前端控制器
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Automated procedures
|
|
||||||
* @since 2023-08-10
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/voice")
|
|
||||||
@Slf4j
|
|
||||||
public class VoiceController {
|
|
||||||
@ApiOperation("文字转语音")
|
|
||||||
@GetMapping("/contentToAudio")
|
|
||||||
public void contentToAudio(@RequestParam String content) {
|
|
||||||
log.info("文字转语音======>content:{}", content);
|
|
||||||
final AudioFormat format = new AudioFormat(44100, 16, 1, true, false);
|
|
||||||
|
|
||||||
DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, format);
|
|
||||||
|
|
||||||
if (!AudioSystem.isLineSupported(dataLineInfo)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TargetDataLine targetDataLine;
|
|
||||||
try {
|
|
||||||
targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo);
|
|
||||||
targetDataLine.open(format);
|
|
||||||
targetDataLine.start();
|
|
||||||
|
|
||||||
// Record audio
|
|
||||||
AudioInputStream audioInputStream = new AudioInputStream(targetDataLine);
|
|
||||||
|
|
||||||
// Save audio to file
|
|
||||||
File audioFile = new File("recorded_audio.wav");
|
|
||||||
AudioSystem.write(audioInputStream, AudioFileFormat.Type.WAVE, audioFile);
|
|
||||||
targetDataLine.close();
|
|
||||||
} catch (LineUnavailableException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@ spring:
|
||||||
application:
|
application:
|
||||||
name: '@artifactId@'
|
name: '@artifactId@'
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: test
|
||||||
#mybatis
|
#mybatis
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations: classpath*:/mapper/**Mapper.xml
|
mapper-locations: classpath*:/mapper/**Mapper.xml
|
||||||
|
|
Loading…
Reference in New Issue