I am having two audio files and I am taking their 1D convolution. The output has 3 points for each audio file. I wanted to plot the outputs of both the files on the scatter plot but I am able to plot just the last output. Can anybody please help me to plot both the outputs?
path = 'C:/Users/....'
for filename in glob.glob(os.path.join(path, '*.wav')):
sample_rate,audio = wavfile.read(filename)
x = audio
z = x.reshape(1,audio.shape[0],1)
z = tf.constant(z, dtype=tf.float32)
print(x.shape)
print(audio.shape[0])
y = tf.keras.layers.Conv1D(1, 44095, activation='relu', input_shape=(1,audio.shape[0],1))(z)
y=y.numpy()
print(y)
aa=y.reshape(-1)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(np.arange(3), aa, color = 'crimson')
plt.show()
The plot that I am getting is:
CodePudding user response:
You don't really need 3d for your case, as you have index feature, so you only need 2 dimensions for each point, you can use the default 2d plotting context and use:
# in the loop
plt.scatter(np.arange(3), aa, color = 'crimson')
# outside the loop
plt.show()