LoginSignup
1
1

More than 5 years have passed since last update.

raspberry pi 1でtensrorflow lite その19

Posted at

概要

raspberry pi 1でtensorflow liteやってみた。
マイク入力を扱うので、alsaを叩いてみた。
ラズパイで、リアルタイム処理してみた。
ヴォイスチェンジャーのデータセットと学習結果。

データセット

import numpy as np
import math
import matplotlib.pyplot as plt
import scipy.signal 

sample_rate = 44100.
nsamples = 320
F_1 = 440.
A_1 = 1.0
F_15 = 5000.
A_15 = 0.6
t = np.arange(nsamples) / sample_rate
vin = -A_1 * np.sin(2 * np.pi * F_1 * t) 
vno = (A_1 * np.sin(2 * np.pi * F_1 * t) + 1.0) * A_15 * np.sin(2 * np.pi * F_15 * t)
vsa = np.zeros((nsamples, 2))
a = 0
for i in range(nsamples):
  vsa[i, 0] = vno[i]
  vsa[i, 1] = vno[i]
fig = plt.figure(1)
ax = fig.add_subplot(311)
ax.plot(vno[1 : 300])
ax = fig.add_subplot(312)
ax.plot(vin[1 : 300])
plt.show()
data = np.c_[vsa[ : , 0], vsa[ : , 1], vin]
np.savetxt('chg0.csv', data, delimiter = ',', header = "x0,x1,y")
print ("ok")

学習結果

v3.png

以上。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1