Skip to content

Commit 07c964c

Browse files
author
LittleMouse
committed
[update] update software version
1 parent 3a16259 commit 07c964c

File tree

5 files changed

+37
-8
lines changed

5 files changed

+37
-8
lines changed

projects/llm_framework/main_audio/SConstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if 'CONFIG_AX_620E_MSP_ENABLED' in os.environ:
2828
STATIC_FILES += [AFile('audio.json'), AFile('audio_kit.json')]
2929
STATIC_FILES += Glob('mode_*.json')
3030

31-
env['COMPONENTS'].append({'target':'llm_audio-1.6',
31+
env['COMPONENTS'].append({'target':'llm_audio-1.7',
3232
'SRCS':SRCS,
3333
'INCLUDE':INCLUDE,
3434
'PRIVATE_INCLUDE':PRIVATE_INCLUDE,

projects/llm_framework/main_audio/src/main.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,48 @@ class llm_audio : public StackFlow {
4949
self->pub_ctx_->send_data((const char *)data, size);
5050
}
5151

52+
static std::string mono_to_stereo_s16le(const std::string &mono_data)
53+
{
54+
if (mono_data.empty()) return mono_data;
55+
56+
size_t sample_count = mono_data.size() / 2;
57+
std::string stereo_data;
58+
stereo_data.reserve(mono_data.size() * 2);
59+
60+
const char *src = mono_data.data();
61+
for (size_t i = 0; i < sample_count; ++i) {
62+
stereo_data.append(src + i * 2, 2);
63+
stereo_data.append(src + i * 2, 2);
64+
}
65+
return stereo_data;
66+
}
67+
5268
void hw_queue_play(const std::shared_ptr<void> &arg)
5369
{
5470
if (audio_clear_flage_) {
5571
return;
5672
}
73+
5774
std::shared_ptr<pzmq_data> originalPtr = std::static_pointer_cast<pzmq_data>(arg);
75+
std::string audio_data(static_cast<const char *>(originalPtr->data()), originalPtr->size());
76+
77+
std::string final_data = audio_data;
78+
if (play_config.channel == 2) {
79+
final_data = mono_to_stereo_s16le(audio_data);
80+
}
81+
5882
std::lock_guard<std::mutex> guard(ax_play_mtx);
5983
ax_play(play_config.card, play_config.device, play_config.volume, play_config.channel, play_config.rate,
60-
play_config.bit, originalPtr->data(), originalPtr->size());
84+
play_config.bit, final_data.c_str(), final_data.length());
6185
}
6286

6387
void hw_play(const std::string &audio_data)
6488
{
89+
std::string final_data = audio_data;
90+
91+
if (play_config.channel == 2) {
92+
final_data = mono_to_stereo_s16le(audio_data);
93+
}
6594
std::lock_guard<std::mutex> guard(ax_play_mtx);
6695
ax_play(play_config.card, play_config.device, play_config.volume, play_config.channel, play_config.rate,
6796
play_config.bit, audio_data.c_str(), audio_data.length());

projects/llm_framework/main_llm/SConstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ignore['ignore'] = list(set(ignore['ignore']))
6666
with open('../dist/fileignore', 'w') as f:
6767
json.dump(ignore, f, indent=4)
6868

69-
env['COMPONENTS'].append({'target':'llm_llm-1.9',
69+
env['COMPONENTS'].append({'target':'llm_llm-1.10',
7070
'SRCS':SRCS,
7171
'INCLUDE':INCLUDE,
7272
'PRIVATE_INCLUDE':PRIVATE_INCLUDE,

projects/llm_framework/main_openai_api/SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LINK_SEARCH_PATH = []
1818
STATIC_FILES = []
1919

2020

21-
ModuleLLMOpenAIPluginPath = wget_github_commit('https://github.com/m5stack/ModuleLLM-OpenAI-Plugin.git', '748ec04e6dde31e6283921e9635204b4b8f8ede2', True)
21+
ModuleLLMOpenAIPluginPath = wget_github_commit('https://github.com/m5stack/ModuleLLM-OpenAI-Plugin.git', '5298be215735f5b1c21bc9225c38d7cb9c1933db', True)
2222
python_venv = check_wget_down("https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/linux/llm/m5stack_llm-openai-api-python-venv_v1.6.tar.gz", 'm5stack_llm-openai-api-python-venv_v1.6.tar.gz')
2323

2424

@@ -52,7 +52,7 @@ ignore['ignore'] = list(set(ignore['ignore']))
5252
with open('../dist/fileignore', 'w') as f:
5353
json.dump(ignore, f, indent=4)
5454

55-
env['COMPONENTS'].append({'target':'llm_openai_api-1.7',
55+
env['COMPONENTS'].append({'target':'llm_openai_api-1.8',
5656
'SRCS':SRCS,
5757
'INCLUDE':INCLUDE,
5858
'PRIVATE_INCLUDE':PRIVATE_INCLUDE,

projects/llm_framework/tools/llm_pack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ def create_bin_deb(package_name, version, src_folder, revision = 'm5stack1', dep
374374
# Unit
375375
'lib-llm':[create_lib_deb,'lib-llm', '1.8', src_folder, revision],
376376
'llm-sys':[create_bin_deb,'llm-sys', '1.6', src_folder, revision],
377-
'llm-audio':[create_bin_deb,'llm-audio', '1.6', src_folder, revision],
377+
'llm-audio':[create_bin_deb,'llm-audio', '1.7', src_folder, revision],
378378
'llm-kws':[create_bin_deb,'llm-kws', '1.9', src_folder, revision],
379379
'llm-asr':[create_bin_deb,'llm-asr', '1.7', src_folder, revision],
380-
'llm-llm':[create_bin_deb,'llm-llm', '1.9', src_folder, revision],
380+
'llm-llm':[create_bin_deb,'llm-llm', '1.10', src_folder, revision],
381381
'llm-tts':[create_bin_deb,'llm-tts', '1.6', src_folder, revision],
382382
'llm-melotts':[create_bin_deb,'llm-melotts', '1.9', src_folder, revision],
383383
'llm-camera':[create_bin_deb,'llm-camera', '1.9', src_folder, revision, 'lib-llm'],
@@ -387,7 +387,7 @@ def create_bin_deb(package_name, version, src_folder, revision = 'm5stack1', dep
387387
'llm-depth-anything':[create_bin_deb,'llm-depth-anything', '1.7', src_folder, revision],
388388
'llm-vad':[create_bin_deb,'llm-vad', '1.8', src_folder, revision],
389389
'llm-whisper':[create_bin_deb,'llm-whisper', '1.8', src_folder, revision],
390-
'llm-openai-api':[create_bin_deb,'llm-openai-api', '1.7', src_folder, revision],
390+
'llm-openai-api':[create_bin_deb,'llm-openai-api', '1.8', src_folder, revision],
391391
'llm-cosy-voice':[create_bin_deb,'llm-cosy-voice', '1.8', src_folder, revision],
392392
# keyword spotting Audio file
393393
'llm-model-audio-en-us':[create_data_deb,'llm-model-audio-en-us', data_version, src_folder, revision],

0 commit comments

Comments
 (0)