0% found this document useful (0 votes)
103 views5 pages

Signals and Systems Final Report

The project aimed to create a program that converts images into audio files by mapping pixel values to frequencies and amplitudes. The program divides images into vertical strips, maps pixel heights to frequencies and intensities to amplitudes. A Python script generates sine waves for each strip and combines them into a sound file representing the original image. The project applies concepts from signals and systems by treating the image as a sampled frequency signal that transforms to the time domain as summed sine waves. Potential improvements include using a pentatonic scale or converting audio back to images, while future applications could include encryption.

Uploaded by

brendan.ritter
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views5 pages

Signals and Systems Final Report

The project aimed to create a program that converts images into audio files by mapping pixel values to frequencies and amplitudes. The program divides images into vertical strips, maps pixel heights to frequencies and intensities to amplitudes. A Python script generates sine waves for each strip and combines them into a sound file representing the original image. The project applies concepts from signals and systems by treating the image as a sampled frequency signal that transforms to the time domain as summed sine waves. Potential improvements include using a pentatonic scale or converting audio back to images, while future applications could include encryption.

Uploaded by

brendan.ritter
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Audializer:ConvertingPicturestoSound SignalsandSystems:ProjectFinalReport BrendanRitter,BrendanQuinlivan,&GregEdelston Spring2013 ProjectOverview Thegoalofourprojectwastocreateanimagetoaudioconverter.Wesetouttodevelopa programthattookinanimagefileasinput,andproducedanaudiofilewhich,whenanalyzed throughaspectrumanalyser,showedtheoriginalimage.Ideally,theprogramwouldhave producedwonderfulsoundingaudio. Inordertoaccomplishthistask,ourteaminitiallysetouttodeveloptheentireprogramin MATLAB.However,afterrunningintosomeissueswithMATLABssoundpackages,wedecided tocompletetheimageanalysisinMATLAB,andthencallaPythonscriptfromMATLABto completethesoundgeneration. Withthisproject,ourteamgoalscenteredarounddevelopinganexcitingapplicationofsignals andsystemswhichwoulddeepenourintuitiveunderstandingofthecontent.

Thiswasespecially importanttousbecausethefocusoftheearlierportionoftheclasswasontheory.Additionally, inthisprojectwewantedtodrawconnectionsbetweensignalprocessingandotherdisciplines (inthiscasewechosemusic). ImageAnalysis OurprogrambeginsbytakinganimageintoMATLABinanyofseveraldifferentfileformats,and convertingthatimageintogreyscale.Afterthisconversion,theimageisdividedintovertical slivers,eachonepixelwide.AnexampleofthiscanbeseeninFigures1and2.

Figure1.Agreyscaleimageofadiagonallinewheretheverticalpositionofeachpixelandthe greyscalevaluecorrespondtothefrequencyandamplitudeofthesoundwavesproduced. Additionally,thehorizontalpositionofeachpixeldeterminethetimeatwhichthesoundwave occursinthesoundclip.

Figure2.AverticalsliverofthediagonallinefoundinFigure1thatisonepixelwide(imagenotto scale). Withthephotodividedintoslivers,theprogrammapseachpixelinthatslivertoalogscaleof frequenciesourlaptopspeakerscouldproduce(80Hzto5,500Hz)basedonthepixelsheightin thesliver.Itismappedsuchthatthepixelsatthebottomoftheimagecorrespondtolow frequenciesandthoseatthetopcorrespondtohighfrequencies. Finally,eachpixelnotonlyhasanassociatedfrequencybasedonitsverticalpositioninthe image,butalsoanassociatedamplitudebasedonthegreyscalevalueofthepixel.Darkerpixels denotehigheramplitudes,whilelighterpixelsareloweramplitudes.Foreachslivertheprogram mapsthefrequenciestothecorrespondingamplitudesasshowninthegraphinFigure3.

Figure3.ThenormalizedamplitudesandfrequenciesfortheslivershowninFigure2.Notice thatatapproximately250Hzthereisaspikeintheamplitudewhichcorrespondstotheblack pixelsfoundinFigure2. Thus,theprogramhasbrokeneachverticalsliverdownintoaseriesoffrequenciesand correspondingamplitudes. SoundGeneration Aftereachsliverisanalyzed,alistofallofthefrequenciesandamplitudesforallofthesliversis passedtoaPythonscriptthroughaCSVfile.Eachsliveristhenmadeintoapythondictionaryof frequenciesandtheirassociatedamplitudes. Asinewaveintime(witharbitraryduration)isgeneratedforeveryfrequencyandamplitudein thisdictionarywiththeincorporationofafrequencyscalingconstant.Thus,theoutcomeofthis processismultiplesinewaves.Thesewavesarethenaddedtomakeachordandnormalized basedonhowmanysinewaveswereaddedsotheamplitudedoesntgetdistorted.Theresultis asoundbyterepresentingoneparticularsliveroftheimage. Whenthisprocessisrepeatedforallthesliversinthepictureandtheircorrespondingsound bytesareconcatenated,anaudializedversionofthepictureiscreated.

HowweusedSignalsandSystems Whenweanalyzeanimage,wecreateasignalinthefrequencydomainwhichmustthen processintothetimedomain.However,sincewearealsooperatinginadiscretespace,the

signalbehavesasasampledfunctionwithdeltasasthevaluesateachpoint. WeusethelinearityoftheFouriertransformtorealizethattheinversetransformofthesumof impulsesisequivalenttothesumoftheinversetransformsoftheimpulses. Wealsorealizethatinorderforthetimedomainsignaltobereal,thefrequencydomainsignal mustbesymmetricalacrosstheyaxistherefore,wemirrorthefrequencies.Foragiven frequency 0 ,thiscreatesthefrequencysignal ( + 0) + ( 0) .FromSignalsand Systems,weknowthatthisequationistheFouriertransformofacosinefunctiontherefore, eachimpulseinthefrequencydomainmapstoasinusoidalfunctioninthetimedomain. Itshouldbenotedthatasinefunctioncanbeinterchangedwithacosinefunction,sincethey equivalent,saveforaphaseshift. SignalsandSystemshelpedustounderstandwhatwasgoingonbehindthescenes.Itwould havebeenpossibletoblindlyacceptthatasinewaveproducesapuretoneandthereforemakes sensetoproduce.However,usingouraccumulatedknowledgefromthesemester,we understoodeverythingthathappened,andwereabletoproducemusicwithfullknowledgeof whyitworks. Conclusions Overall,wewerecapableofmakingapicturetosoundconverter.However,therewereseveral areasofourprojectthatcouldhavebeenimproved. Onefeaturethatwouldhavemadeourprojectmorecohesivewouldhavebeenonlyperforming operationsinMATLAB.Wedecidedoriginallynottodothisduetocomplicationswiththesound producingabilitiesofMATLAB.However,givenmoretimewecouldhavestraightenedthese problemsout. Inaddition,anotheroptionavailabletouswastouseapieceofcodecreatedinMATLABthat producedguitarlikenotesusingsomesortofdynamicfilter.Althougheffortwasputinto deconstructingitsmethodofsoundcreation,ourcurrentmethodwasfinalizedbeforewecould fullyunderstandtheguitarcode.Thus,afurtherdeconstructionwouldhaveallowedustostayin theMATLABdomain,andincludeevenmoresignalsandsystems. Afurtherareaofinvestigationcouldhavebeenthecapabilitiesofourlaptopsspeakers.Itwasat timesunclearwhetherourprogrammingmethodswereincorrect,orwhetherweweregetting distortionbyrunningupagainstthehardwarelimitofourspeakers.Afurtherlookintothehard limitsmighthaveactuallyvalidatedpreviousMATLABattemptstomakesound.

AreasforFutureWork Thereisthepotentialforalotoffutureworkonthisproject.Onepotentialimprovementcouldbe convertingthefrequenciestoapentatonicscale.Thiswouldhavethebenefitofmakingevery imagesoundpleasing.However,thismodificationwouldmaketheprocessirreversiblebecause therewouldnolongerbeaonetoonemappingofverticalpositiontofrequencies. Alongthosesamelines,afutureprojectcouldbereversetheaudializeprocessandmakea pictureoutofasoundfile.Basedonourcurrentprogramitwouldbetrivialtoconvertthe amplitudesandfrequenciesassociatedwitheachpixelbackintoanimage.However,the processofdissectingtheconstructedaudiofileintotheseamplitudesandfrequencies associatedwitheachpixelwouldrequireasignificantamountofwork. Wecanalsoforeseeapplicationsforoursoftwarewithencryption.Ifthereisaparticular algorithmformappingagivenpixeltoafrequency,amplitude,andtimemorecomplexthana simplelogarithmicmappingthenanimagecouldbesecurelyencodedintoasoundfile.

You might also like