手机录制命令记录

运行脚本

  1. 脚本文件夹位置:

    1
    cd /data/tmp/local/racer
  2. record_3.5mm.sh 指耳机孔位置的麦克风录制脚本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #!/bin/sh
    # recording - 3.5mm headphone jack mic
    tinymix "IN1 OSR" "6.144MHz"
    tinymix "IN2 OSR" "6.144MHz"
    tinymix "Sample Rate 3" "192kHz"
    tinymix "FX Rate" "SYNCCLK rate 3"
    tinymix "DSP1 Rate" "SYNCCLK rate 3"
    tinymix "DSP2 Rate" "SYNCCLK rate 3"
    tinymix "DSP3 Rate" "SYNCCLK rate 3"
    tinymix "In Rate" "SYNCCLK rate 3"
    tinymix "LHPF1 Input 1" "IN1R"
    tinymix "LHPF2 Input 1" "IN1R"
    tinymix "AIF1TX1 Input 1" "IN1R"
    tinymix "AIF1TX2 Input 1" "IN1R"
    tinymix "SEN_MI2S_TX Format" "S16_LE"
    tinymix "SEN_MI2S_TX SampleRate" "KHZ_192"
    tinymix "SEN_MI2S_TX Channels" "Two"
    tinymix "MultiMedia1 Mixer SEN_MI2S_TX" "1"
    tinycap $1 -c 1 -r 192000 -b 16 -p 19200
  3. record_two_mics.sh 指使用双麦克风进行手机自动降噪处理的录制脚本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #!/bin/sh
    # recording - built-in mics
    tinymix "IN1 OSR" "6.144MHz"
    tinymix "IN2 OSR" "6.144MHz"
    tinymix "Sample Rate 3" "192kHz"
    tinymix "In Rate" "SYNCCLK rate 3"
    tinymix "LHPF1 Input 1" "IN1L"
    tinymix "LHPF2 Input 1" "IN2L"
    tinymix "AIF1TX1 Input 1" "IN1L"
    tinymix "AIF1TX2 Input 1" "IN2L"
    tinymix "AIF1TX1 Input 1 Volume" "48"
    tinymix "AIF1TX2 Input 1 Volume" "48"
    tinymix "IN1L Volume" "31"
    tinymix "IN2L Volume" "31"
    tinymix "IN1L Digital Volume" "80"
    tinymix "IN2L Digital Volume" "80"
    tinymix "SEN_MI2S_TX Format" "S16_LE"
    tinymix "SEN_MI2S_TX SampleRate" "KHZ_192"
    tinymix "SEN_MI2S_TX Channels" "Two"
    tinymix "MultiMedia1 Mixer SEN_MI2S_TX" "1"
    tinycap $1 -c 2 -r 192000 -b 16 -p 19200
  4. 脚本运行要先进入root和shell

    1
    2
    3
    ## root 是获取权限 shell是进入交互界面
    adb root
    adb shell
  5. 授权+运行,以PowerPhone-main\racer\record_two_mics.sh 为例:

    1
    2
    3
    chmod +x record_two_mics.sh
    ./record_two_mics.sh 产出的文件名.wav
    ./record_two_mics.sh record.wav

导出音频

另起一个cmd窗口

1
2
3
4
5
6
##基础命令
adb pull /data/tmp/local/racer/产出的文件名.wav 电脑文件夹
## 单个文件导出,较为稳定
adb pull /data/tmp/local/racer/.wav D:\CS\SRTP\Lab\Wave
## 批量导出文件,大概率会寄,一般是设备offline
adb pull -a /data/tmp/local/racer D:\CS\SRTP\Lab\Wave

Pytorch安装

B站
参考1
参考2

CUDA安装

路径: D:\CUDA

1
2
## 检查安装及环境变量
nvcc --version

cuDNN安装

解压包安装,复制到D:\CUDA

Pytorch安装

切记执行命令的窗口不是在cmd,在base(anaconda)/pytorch(anaconda)
挂梯子
打开Anaconda Prompt

1
2
3
4
5
6
## 创建env
conda create -n pytorch python=3
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
conda activate pytorch
##激活之后继续安装
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

进入pytorch环境

打开anaconda prompt窗口

1
conda activate pytorch

Pytorch验证

  • 初步验证(以下命令均在pytorch环境下进行,相当于新建了虚拟环境,在windows cmd 中是无法执行下面验证语句的)
1
2
3
## pytorch env
conda list
pip list

或者

1
2
3
python
import torch
torch.cuda.is_available()

验证Pytorch是否导入Pycharm环节,main.py输入:

1
2
3
4
from future import print_function
import torch
x = torch.rand(5, 3)
print(x)

main.py验证Pytorch是否可以使用GPU和CUDA

1
2
import torch
torch.cuda.is_available()

点击运行没报错,输出 True 就说明配置成功了。

深度学习