Hi,
I'm planning to use LuckFox Pico Plus for audio playback and audio recording, so I need to use line-out and line-in ports. As far as I understand, CODEC_LINEOUT output is signle-ended and referenced to ground, so I can connect it directly to headphones/amplifier, is this correct?
For audio recording I will not use microphone, I will use single-ended line-out from another computer, how do I connect it? Is there an example schematic? Also, how can I test the recoring and playback features (what commands? any extra packages required?) Do I ned to explicitly specify that I'm using line-in and not a passive microphone in software?
Thanks in advance,
Alex
Luckfox Pico Plus - Audio line-in and line-out example schematics
Hello,
You can refer to the content in the following manual as well as the MIC reference circuit.
Document download: MIC reference circuit:
You can refer to the content in the following manual as well as the MIC reference circuit.
Document download: MIC reference circuit:
Thanks, I tried the command from the document:
rk_mpi_ao_test -i audi.pcm --sound_card_name=hw:0,0 --device_ch=2 --device_rate=16000 --input_rate=16000 --input_ch=2
Here is the output I get:
# rk_mpi_ao_test -i audi.pcm --sound_card_name=hw:0,0 --device_ch=2 --device_rate=16000 --input_rate=16000 --input_ch=2
cmd parse result:
input file name : audi.pcm
output file name : (null)
loop count : 1
channel number : 1
open sound rate : 16000
open sound channel : 2
input stream rate : 16000
input channel : 2
bit_width : 16
period_count : 4
period_size : 1024
sound card name : hw:0,0
device id : 0
set volume : 100
set mute : 0
set track_mode : 0
get volume : 0
get mute : 0
get track_mode : 0
query stat : 0
pause and resume chn : 0
save file : 0
query save file stat : 0
clear buf : 0
get attribute : 0
clear attribute : 0
set loopback mode : 0
adec input file name : (null)
rockit log path (null), log_size = 0, can use export rt_log_path=, export rt_log_size= change
log_file = (nil)
RTVersion 00:18:28-995 {dump :064} ---------------------------------------------------------
RTVersion 00:18:28-995 {dump :065} rockit version: git-8cb4d25b8 Tue Feb 28 11:12:39 2023 +0800
RTVersion 00:18:28-996 {dump :066} rockit building: built- 2023-02-28 15:23:19
RTVersion 00:18:28-996 {dump :067} ---------------------------------------------------------
(null) 00:18:28-996 {log_level_init :203}
please use echo name=level > /tmp/rt_log_level set log level
name: all cmpi mb sys vdec venc rgn vpss vgs tde avs wbc vo vi ai ao aenc adec
log_level: 0 1 2 3 4 5 6
rockit default level 4, can use export rt_log_level=x, x=0,1,2,3,4,5,6 change
(null) 00:18:28-996 {read_log_level :093} text is all=4
(null) 00:18:28-997 {read_log_level :095} module is all, log_level is 4
(null) 00:18:29-001 {monitor_log_level :144} #Start monitor_log_level thread, arg:(nil)
cmpi 00:18:29-009 {main :750} start running loop count = 0
RKAoChn 00:18:29-010 {setVqeAttr :784} pstVqeConfig = (nil), set mVqeEnable = false
cmpi 00:18:29-018 {commandThread :315} test info : mute = 0, volume = 100
cmpi 00:18:29-020 {sendDataThread :248} params->s32ChnIndex : 0
I don't hear any sound comming from the speaker connected to lineout and ground with a series 100ohm resistor, also there is nothing on the scope. Am I missing something? Also is there a library in the SDK which would allow me to play audio using python?
rk_mpi_ao_test -i audi.pcm --sound_card_name=hw:0,0 --device_ch=2 --device_rate=16000 --input_rate=16000 --input_ch=2
Here is the output I get:
# rk_mpi_ao_test -i audi.pcm --sound_card_name=hw:0,0 --device_ch=2 --device_rate=16000 --input_rate=16000 --input_ch=2
cmd parse result:
input file name : audi.pcm
output file name : (null)
loop count : 1
channel number : 1
open sound rate : 16000
open sound channel : 2
input stream rate : 16000
input channel : 2
bit_width : 16
period_count : 4
period_size : 1024
sound card name : hw:0,0
device id : 0
set volume : 100
set mute : 0
set track_mode : 0
get volume : 0
get mute : 0
get track_mode : 0
query stat : 0
pause and resume chn : 0
save file : 0
query save file stat : 0
clear buf : 0
get attribute : 0
clear attribute : 0
set loopback mode : 0
adec input file name : (null)
rockit log path (null), log_size = 0, can use export rt_log_path=, export rt_log_size= change
log_file = (nil)
RTVersion 00:18:28-995 {dump :064} ---------------------------------------------------------
RTVersion 00:18:28-995 {dump :065} rockit version: git-8cb4d25b8 Tue Feb 28 11:12:39 2023 +0800
RTVersion 00:18:28-996 {dump :066} rockit building: built- 2023-02-28 15:23:19
RTVersion 00:18:28-996 {dump :067} ---------------------------------------------------------
(null) 00:18:28-996 {log_level_init :203}
please use echo name=level > /tmp/rt_log_level set log level
name: all cmpi mb sys vdec venc rgn vpss vgs tde avs wbc vo vi ai ao aenc adec
log_level: 0 1 2 3 4 5 6
rockit default level 4, can use export rt_log_level=x, x=0,1,2,3,4,5,6 change
(null) 00:18:28-996 {read_log_level :093} text is all=4
(null) 00:18:28-997 {read_log_level :095} module is all, log_level is 4
(null) 00:18:29-001 {monitor_log_level :144} #Start monitor_log_level thread, arg:(nil)
cmpi 00:18:29-009 {main :750} start running loop count = 0
RKAoChn 00:18:29-010 {setVqeAttr :784} pstVqeConfig = (nil), set mVqeEnable = false
cmpi 00:18:29-018 {commandThread :315} test info : mute = 0, volume = 100
cmpi 00:18:29-020 {sendDataThread :248} params->s32ChnIndex : 0
I don't hear any sound comming from the speaker connected to lineout and ground with a series 100ohm resistor, also there is nothing on the scope. Am I missing something? Also is there a library in the SDK which would allow me to play audio using python?
Ok, I managed to play a .wav file using alsaaudio and python. The strange thing is that I get audio output on TP4, but according to schematic for Luckfox pico plus, it's a CODEC_MICBIAS port. Is the schematic on the luckfox website not up-to-date? If so, can you share an updated version.
The TP4 is indeed an audio output interface for LINEOUT.
Hi, can you share how you got audio out with alsaaudio and python? Which distribution/modules, do you have some pointers/code? Thx.saSHA256 wrote: ↑2024-01-24 19:35 Ok, I managed to play a .wav file using alsaaudio and python. The strange thing is that I get audio output on TP4, but according to schematic for Luckfox pico plus, it's a CODEC_MICBIAS port. Is the schematic on the luckfox website not up-to-date? If so, can you share an updated version.
Last edited by frankb on 2024-05-14 21:14, edited 1 time in total.