python clinet

This commit is contained in:
wataru 2023-03-15 02:39:34 +09:00
parent 3e5ed4dac1
commit ceb458e2ce
10 changed files with 949 additions and 52 deletions

View File

@ -1 +1,10 @@
<!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
<!DOCTYPE html>
<html style="width: 100%; height: 100%; overflow: hidden">
<head>
<meta charset="utf-8" />
<title>Voice Changer Client Demo</title>
<script defer src="index.js"></script></head>
<body style="width: 100%; height: 100%; margin: 0px">
<div id="app" style="width: 100%; height: 100%"></div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,31 +0,0 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

View File

@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@dannadori/voice-changer-client-js": "^1.0.90",
"@dannadori/voice-changer-client-js": "^1.0.91",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-brands-svg-icons": "^6.3.0",
"@fortawesome/free-regular-svg-icons": "^6.3.0",
@ -3187,9 +3187,9 @@
}
},
"node_modules/@dannadori/voice-changer-client-js": {
"version": "1.0.90",
"resolved": "https://registry.npmjs.org/@dannadori/voice-changer-client-js/-/voice-changer-client-js-1.0.90.tgz",
"integrity": "sha512-+OEfe3Izmz43k4OlaM0WNCVglUfSJibLDheplN+Yo1jRdSny6Rc8AusGFOCPKLtRB1JYkCAEagZsfoEfOxUzVQ==",
"version": "1.0.91",
"resolved": "https://registry.npmjs.org/@dannadori/voice-changer-client-js/-/voice-changer-client-js-1.0.91.tgz",
"integrity": "sha512-6LFLHoPDOha7LVQfd6NDkUKn6ihYGvihdZAZG8huk//BQTVeeS2o48XB9fWk1iNyrv2zbj3XTh1GUR/nFFoHBw==",
"dependencies": {
"@types/readable-stream": "^2.3.15",
"amazon-chime-sdk-js": "^3.11.0",
@ -13567,9 +13567,9 @@
}
},
"@dannadori/voice-changer-client-js": {
"version": "1.0.90",
"resolved": "https://registry.npmjs.org/@dannadori/voice-changer-client-js/-/voice-changer-client-js-1.0.90.tgz",
"integrity": "sha512-+OEfe3Izmz43k4OlaM0WNCVglUfSJibLDheplN+Yo1jRdSny6Rc8AusGFOCPKLtRB1JYkCAEagZsfoEfOxUzVQ==",
"version": "1.0.91",
"resolved": "https://registry.npmjs.org/@dannadori/voice-changer-client-js/-/voice-changer-client-js-1.0.91.tgz",
"integrity": "sha512-6LFLHoPDOha7LVQfd6NDkUKn6ihYGvihdZAZG8huk//BQTVeeS2o48XB9fWk1iNyrv2zbj3XTh1GUR/nFFoHBw==",
"requires": {
"@types/readable-stream": "^2.3.15",
"amazon-chime-sdk-js": "^3.11.0",

View File

@ -51,7 +51,7 @@
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"@dannadori/voice-changer-client-js": "^1.0.90",
"@dannadori/voice-changer-client-js": "^1.0.91",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-brands-svg-icons": "^6.3.0",
"@fortawesome/free-regular-svg-icons": "^6.3.0",

View File

@ -483,9 +483,6 @@ body {
margin-left: 1rem;
}
.body-button-container-space-around {
justify-content: space-around;
}
.body-button-container {
display: flex;
flex-direction: row;
@ -530,6 +527,11 @@ body {
}
}
}
.body-button-container-space-around {
justify-content: space-around;
}
.body-select {
color: rgb(30, 30, 30);
max-width: 100%;

View File

@ -1,12 +1,12 @@
{
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.90",
"version": "1.0.91",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.90",
"version": "1.0.91",
"license": "ISC",
"dependencies": {
"@types/readable-stream": "^2.3.15",

View File

@ -1,6 +1,6 @@
{
"name": "@dannadori/voice-changer-client-js",
"version": "1.0.90",
"version": "1.0.91",
"description": "",
"main": "dist/index.js",
"directories": {

View File

@ -16,6 +16,7 @@ export type ClientType = typeof ClientType[keyof typeof ClientType]
///////////////////////
export const InputSampleRate = {
"48000": 48000,
"44100": 44100,
"24000": 24000
} as const
export type InputSampleRate = typeof InputSampleRate[keyof typeof InputSampleRate]
@ -241,6 +242,7 @@ export type Protocol = typeof Protocol[keyof typeof Protocol]
export const SendingSampleRate = {
"48000": 48000,
"44100": 44100,
"24000": 24000
} as const
export type SendingSampleRate = typeof SendingSampleRate[keyof typeof SendingSampleRate]

View File

@ -14,7 +14,9 @@ import signal
import sys
import numpy as np
BUFFER_SIZE = 2048 * 2
BUFFER_SIZE = 2048 * 2 * 10
SAMPLING_RATE = 44100
GAIN = 10
def setupArgParser():
@ -91,7 +93,10 @@ class MyCustomNamespace(socketio.ClientNamespace):
data = msg[1]
perf = msg[2]
print(f"RT:{responseTime}msec", perf)
# unpackedData = struct.unpack('<%sh' % (len(data) // struct.calcsize('<h')), data)
unpackedData = struct.unpack('<%sh' % (len(data) // struct.calcsize('<h')), data)
data = np.array(unpackedData)
data = data * GAIN
data = struct.pack('<%sh' % len(data), *data)
if self.file_output_stream != None:
self.file_output_stream.write(data)
@ -112,7 +117,7 @@ if __name__ == '__main__':
audio_input_stream = audio.open(
format=pyaudio.paInt16,
channels=1,
rate=24000,
rate=SAMPLING_RATE,
frames_per_buffer=BUFFER_SIZE,
input_device_index=inputDevice,
input=True)
@ -122,7 +127,7 @@ if __name__ == '__main__':
audio_output_stream = audio.open(
format=pyaudio.paInt16,
channels=1,
rate=24000,
rate=SAMPLING_RATE,
frames_per_buffer=BUFFER_SIZE,
output_device_index=outputDevice,
output=True)