Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Quentin Aristote
Soundscapes
Commits
ea684b44
Commit
ea684b44
authored
Jan 07, 2020
by
Quentin Aristote
Browse files
changed filenmame
parent
299606f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
results/spectrogram_to_sound.ipynb
View file @
ea684b44
...
...
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count":
10
,
"execution_count":
4
,
"metadata": {
"autoscroll": false,
"collapsed": false,
...
...
@@ -20,7 +20,24 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 5,
"metadata": {
"autoscroll": false,
"collapsed": false,
"ein.hycell": false,
"ein.tags": "worksheet-0",
"slideshow": {
"slide_type": "-"
}
},
"outputs": [],
"source": [
"name = 'gen'"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"autoscroll": false,
"collapsed": false,
...
...
@@ -35,15 +52,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"(128, 240
0
)\n"
"(128, 240
1
)\n"
]
}
],
"source": [
"spectrogram = np.load('
test3
.npy')
[0]
\n",
"spectrogram = np.load('
spectrograms/' + name + '
.npy')\n",
"print(spectrogram.shape)\n",
"audio = librosa.feature.inverse.mel_to_audio(spectrogram, sr = 16000, n_fft = 400, hop_length = 200, win_length = 400)\n",
"librosa.output.write_wav('
test3
.wav', audio, 16000)"
"librosa.output.write_wav('
sounds/' + name + '
.wav', audio, 16000)"
]
}
],
...
...
%% Cell type:code id: tags:
```
python
import
librosa
import
numpy
as
np
```
%% Cell type:code id: tags:
```
python
spectrogram
=
np
.
load
(
'test3.npy'
)[
0
]
name
=
'gen'
```
%% Cell type:code id: tags:
```
python
spectrogram
=
np
.
load
(
'spectrograms/'
+
name
+
'.npy'
)
print
(
spectrogram
.
shape
)
audio
=
librosa
.
feature
.
inverse
.
mel_to_audio
(
spectrogram
,
sr
=
16000
,
n_fft
=
400
,
hop_length
=
200
,
win_length
=
400
)
librosa
.
output
.
write_wav
(
'
test3
.wav'
,
audio
,
16000
)
librosa
.
output
.
write_wav
(
'
sounds/'
+
name
+
'
.wav'
,
audio
,
16000
)
```
%%%% Output: stream
(128, 240
0
)
(128, 240
1
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment