#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('pylab', 'inline') from __future__ import print_function from __future__ import division from scipy.io import wavfile get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: img1 = imread('dark.png') # In[3]: imshow(img1) # In[4]: music1=img1.reshape(img1.size) # In[5]: music1.shape # In[6]: countSeg = int(music1.size / 128) # In[7]: finalpart = zeros(countSeg*(128*2 -2)) #set a long array instead of concatenate function to shorten run time for x in range(0,countSeg): # divide into several segments perpart = music1[0+128*x:128*(x+1)] iftpart = irfft(perpart) #finalpart = concatenate((finalpart, iftpart)) finalpart[254*x:254*(x+1)] = iftpart #put every part into the long array plot(finalpart) # In[8]: finalpart.size # In[9]: from IPython.display import Audio Audio(finalpart ,rate=44100) # In[ ]: